14.04.2017, 18:06
Well for example if you want to make a give weapon cmd you can do something like this
Let's say that your command is /givewep <playerid> <weaponid>
We will use weaponid to see what the player inserted, of course we'll use sscanf for that which you can find here: https://sampwiki.blast.hk/wiki/Fast_Commands
define id and weaponid to avoid any errors
And you can check if the id that the player inserted is valid by doing this
if(weaponid >=1 && weaponid <= 46)
{
code here
}
else
{
code here if he inserted an invalid it
}
Let's say that your command is /givewep <playerid> <weaponid>
We will use weaponid to see what the player inserted, of course we'll use sscanf for that which you can find here: https://sampwiki.blast.hk/wiki/Fast_Commands
PHP код:
if (sscanf(params, "ud", id, weaponid)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/givewep <playerid/partname> <weaponid>\"");
And you can check if the id that the player inserted is valid by doing this
if(weaponid >=1 && weaponid <= 46)
{
code here
}
else
{
code here if he inserted an invalid it
}