Quote:
Originally Posted by RealCop228
This is definitely the bad way to make this command. It's a lot easier doing it with sscanf.
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; }
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.
|
You can use it in my code too.
Just type after "
SetPlayerSkin":
Code:
new skinid;
new msg[256];
skinid = strval(tmp);
format(msg,256,"You've chosen skin id %d",skinid);
SendClientMessage(playerid, COLOR_YELLOW, msg);
It's that simple :P