14.06.2013, 21:54
You need a command with parameters include and I'd recommend to use Zeex's zcmd.inc, because it's a simple include for beginners with these commands.
https://sampforum.blast.hk/showthread.php?tid=91354
Don't forgot to add sscanf to your script, because this script makes your script easier.
(Just copy the stock code and paste it to your script)
https://sampwiki.blast.hk/wiki/Sscanf
Open your script and include the y_commands before you start at scripting.
Then find an empty place, that you want write your command there.
(IMPORTANT! Don't write your command in a callback)
https://sampforum.blast.hk/showthread.php?tid=91354
Don't forgot to add sscanf to your script, because this script makes your script easier.
(Just copy the stock code and paste it to your script)
https://sampwiki.blast.hk/wiki/Sscanf
Open your script and include the y_commands before you start at scripting.
pawn Код:
#include <zcmd>
(IMPORTANT! Don't write your command in a callback)
pawn Код:
CMD:skin(playerid, params[]) // Creating the /skin command.
{
new skinid;
// If you want make this command only available for Rcon Admins, then remove // characters below this.
//if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You aren't allowed to use this command.");
if(sscanf(params, "d", skinid)) // d or i = integer, s = string and f = float! As you know skinid is an integer and i defined 'd'
return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /skin (skinid)"); // Player has used the command without params, then we send him a message.
// Now the variable 'skinid' contains the value that player has gave as params.
// Example /skin 294 and the variable contains now the value '294'
if(skinid > 299 || skinid < 0) // There are only from 0 - 299 skin id's and it should send a warning message
return SendClientMessage(playerid, 0xFF0000FF, "Invalid Skin ID!");
// Now everything seems okay and we change his skin!
SetPlayerSkin(playerid, skinid); // As you know the 'skinid' contains the value of player's given params.
return 1; // Of course we need return a value.
}