Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Latest commit

 

History

History
102 lines (82 loc) · 3.3 KB

README.eng.md

File metadata and controls

102 lines (82 loc) · 3.3 KB

Include VerificacaoPlataforma SA:MP

This is a code snippet designed to check whether the player is using a mobile or a computer. Read the categories below to stay informed.


How to install?

You should download the include. After doing so, you need to place the include in the folder (pawno > include). Once you have done that, open the pwn file of your Gamemode and insert the following code below your other includes:

#include <VerificacaoPlataforma>

Required include

Warning

If the user has not activated the Pawn.RakNet library, they will receive an error number 111.


How does it work?

Once the player connects to the server, the include automatically checks which platform they are using, whether it's mobile or computer, with the assistance of Pawn.RakNet. To verify the player's platform, simply use the boolean function IsPlayerAndroid. Below are some examples:

With the if:

CMD:platform(playerid)
{
    new bool:isAndroid, bool:haveAutoaim;
    GetPlayerPlataformInfo(playerid, isAndroid, haveAutoaim);
    //
    if(isAndroid)
        SendClientMessage(playerid, 0xFFFFFFFF, "You are connected via the Mobile platform.");
    //
    else if(!isAndroid) // Could be just else.
        SendClientMessage(playerid, 0xFFFFFFFF, "You are connected via the Computer platform.");
    //
    return true;
}

Without the if:

CMD:platform(playerid)
{
    new string[128], bool:isAndroid, bool:haveAutoaim;
    GetPlayerPlataformInfo(playerid, isAndroid, haveAutoaim);
    //
    format(string, sizeof(string), "You are connected via the %s platform.", IsPlayerAndroid(playerid) ? ("Mobile") : ("Computer"));
    SendClientMessage(playerid, 0xFFFFFFFF, string);
    //
    return true;
}

This include also has a function called PlayerHasAutoAim. This function is designed to check whether the player has automatic aiming enabled or if it is without automatic aiming, commonly known as LockOn. Below are some examples:

With the if:

CMD:aim(playerid)
{
    new bool:isAndroid, bool:haveAutoaim;
    GetPlayerPlataformInfo(playerid, isAndroid, haveAutoaim);
    //
    if(haveAutoaim)
        SendClientMessage(playerid, 0xFFFFFFFF, "Your auto-aim is Enabled.");
    //
    else if(!haveAutoaim) // Could be just else.
        SendClientMessage(playerid, 0xFFFFFFFF, "Your auto-aim is Disabled.");
    //
    return true;
}

Without the if:

CMD:aim(playerid)
{
    new string[128], bool:isAndroid, bool:haveAutoaim;
    GetPlayerPlataformInfo(playerid, isAndroid, haveAutoaim);
    //
    format(string, sizeof(string), "Your auto-aim is %s.", haveAutoaim ? ("Enabled") : ("Disabled"));
    SendClientMessage(playerid, 0xFFFFFFFF, string);
    //
    return true;
}

Contact Information

Instagram: ocalasans
YouTube: Calasans
Discord: ocalasans
Community: SA:MP Programming Community©