24.09.2010, 13:29
This is definitely the bad way to make this command. It's a lot easier doing it with sscanf.
This checks if a player is an admin (RCON), if the sscanf params are correct, if not it sends a message with the correct usage (SYNTAX) if the params are correct, it continues the command. It will set your skin to the ID you chose and then send you a message telling you what skin you chose. I used ZCMD and SSCANF2 to do this. Took me 10 seconds.
pawn Code:
command(skin, playerid, params[])
{
new string[128], skinid;
if(IsPlayerAdmin(playerid))
{
if(sscanf(params, "d", skinid)
{
SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /skin [skinID]");
}
else
{
SetPlayerSkin(playerid, skinid);
format(string, sizeof(string), "You have set your skin ID to %d", skinid);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
return 1;
}