Problem with /setskinall
#1

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;
}
Reply
#2

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)