26.09.2011, 01:31
Right as LAs Venturas CNR said it doesnt detect invalid IDS and if someone set your skin as an invalid ID you'll crash. Try my ZCMD and sscanf setskin cmd
Also this works only for admins whos level is 4 but you can change that value to whatever you desire.
Also this works only for admins whos level is 4 but you can change that value to whatever you desire.
pawn Код:
CMD:setskin(playerid, params[])
{
new id, ammount, name[MAX_PLAYER_NAME], string[128];
if(!(PlayerInfo[playerid][pAdmin] >= 4)) return SendClientMessage(playerid, COLOR_GREY,"You are not authorized to use this command");
else if(sscanf(params,"ui", id, ammount)) return SendClientMessage(playerid, COLOR_GREY,"[True:RP]: /setskin [playerid/partofname] [skinmodel]");
else if(ammount > 299 || ammount < 1) return SendClientMessage(playerid, COLOR_GREY,"Wrong Skin ID! Available ID's: 1-299");
else if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY,"Invalid player id");
else
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string),"Your skin have been set to %i by admin %s", ammount, name);
SendClientMessage(id, COLOR_GREEN, string);
PlayerInfo[id][pSkin] = ammount;
SetPlayerSkin(id, PlayerInfo[id][pSkin]);
}
return 1;
}