SetSkin problem
#1

i made this command:
Код:
Код:
dcmd_setskin(playerid, params[])
{
    if(gPlayerInfo[playerid][PLAYER_LEVEL] < gCommands[VIP] && gPlayerInfo[playerid][PLAYER_LEVEL] > gCommands[VIP])
    {
        SendClientMessage(playerid, COLOR_ORANGE, "You must be an VIP to use that command!");
    }
    else
    {
        new tmp[256], index, id;
        tmp = strtok(params, index);

        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_ORANGE, "[SETSKIN] Usage: /setskin [SKIN ID]");
		}
        else
        {
            id = strval(tmp);
			if(id >= 300 && id <= -1)
			{
			SendClientMessage(playerid,COLOR_LIGHTBLUE,"Invalid ID, Valid IDS: 0-299");
			}
			else
			{
			SetPlayerSkin(playerid, id);
			}
            
        }
    }
    return 1;
}
but when you type -1 or 300+ number it doesnt show the message and playercrashes(Invalid skin id).
Reply
#2

pawn Код:
if( skinid >= 1 && skinid <= 299 )
That's mine, it's opposite of yours but it's actually the right numbers.

try returning too, might help.
Reply
#3

Replace
pawn Код:
if(id >= 300 && id <= -1)
To
pawn Код:
if(id > 299 || id < 0)
It's impossible id to be more than 299 and less 0
Reply
#4

Worked but explain, whats the diference on && and ||?
Reply
#5

Sure
pawn Код:
&& means AND

|| means OR
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)