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.
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>
Warning
If the user has not activated the Pawn.RakNet library, they will receive an error number 111
.
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;
}
Instagram: ocalasans
YouTube: Calasans
Discord: ocalasans
Community: SA:MP Programming Community©