Problem with /setskinall - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with /setskinall (
/showthread.php?tid=465775)
Problem with /setskinall -
GwENiko - 24.09.2013
Hi guys, whenever i use this command, it sets everyone's skin to CJ, instead of setting their skin ID to which was typed in the command, and here's the code:
pawn Код:
CMD:setskinall(playerid, params[])
{
new string[128], aname[MAX_PLAYER_NAME], sID;
if(pInfo[playerid][Level] < 3) return SendClientMessage(playerid, 0xFF0000AA, "[ERROR] You are not authorized to use this command.");
if(sID < 0 || sID > 299) return SendClientMessage(playerid, 0xFF0000AA, "[ERROR] You may only set valid amounts of skins between 0 and 299.");
for(new i = 0; i < MAX_PLAYERS; i++)
{
SetPlayerSkin(i, sID);
}
GetPlayerName(playerid, aname, sizeof(aname));
format(string, sizeof(string), "[ADMIN] %s has set everyone skin id to %d", aname, sID);
SendClientMessage(playerid, 0xFFFF00AA, string);
return 1;
}
Re: Problem with /setskinall -
Pottus - 24.09.2013
You need to use use sscanf() or strval() to get the sID.
ex.
if(sscanf(params, "i", sID)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /strval <skinid>");
or
sID = strval(params);
Using sscanf() is probably the better way since it takes care of checking if a value was actually given.