Limitations to a Command.
#3

Quote:
Originally Posted by SilentSoul
Посмотреть сообщение
Because no skins above skin id 299 avilable on sa-mp , so they set a string variable (strval) to make sure that the player can't use skin above than 299 or less than 0 which in fact they use ">"Right is bigger than "<"Left is biggerthan , Right is smaller than
#Script
pawn Код:
CMD:skin(playerid, params[])
{
new skinid, string[128];
if(sscanf(params, "d", skinid))
{
SendClientMessage(playerid, COLOR_RED, "USAGE: /s(kin) [skinID].");
}
else
{
new tmp[256];//to avoide undefined symbol error.
tmp = strtok(cmdtext,idx);
if(strval(tmp) > 299 || strval(tmp) < 0) return SendClientMessage(playerid, -1,"{FF0000}You can't use skin above 299 or lower than0.");//if the string bigger than 299 "strval(tmp) > 299" the skin won't set and send them error message
SetPlayerSkin(playerid, skinid);
format(string, sizeof(string), "You have set your skinID to %d.", skinid);
SendClientMessage(playerid, COLOR_GREEN, string);
}
return 1;
}
No idea why you needed strtok in there when you could simply use this code *command below*
pawn Код:
CMD:skin(playerid, params[])
{
    new skinid, string[128];
    if(sscanf(params, "d", skinid))
        return SendClientMessage(playerid, COLOR_RED, "USAGE: /s(kin) [skinID].");

    if(0 >= skinid >= 300)
        return SendClientMessage(playerid, -1,"{FF0000}You can't use skin above 299 or lower than0.");//if the string bigger than 299 "strval(tmp) > 299" the skin won't set and send them error message

    SetPlayerSkin(playerid, skinid);
    format(string, sizeof(string), "You have set your skinID to %d.", skinid);
    SendClientMessage(playerid, COLOR_GREEN, string);
    return true;
}
Reply


Messages In This Thread
Limitations to a Command. - by NoSoap - 01.12.2013, 14:51
Re: Limitations to a Command. - by SilentSoul - 01.12.2013, 14:58
Re: Limitations to a Command. - by Patrick - 01.12.2013, 15:02
Re: Limitations to a Command. - by NoSoap - 01.12.2013, 15:02
Re: Limitations to a Command. - by NoSoap - 01.12.2013, 17:10
Re: Limitations to a Command. - by SilentSoul - 01.12.2013, 17:17
Re: Limitations to a Command. - by Audi_Quattrix - 01.12.2013, 17:25
Re: Limitations to a Command. - by NoSoap - 01.12.2013, 17:40
Re: Limitations to a Command. - by SilentSoul - 01.12.2013, 17:45
Re: Limitations to a Command. - by NoSoap - 01.12.2013, 17:51

Forum Jump:


Users browsing this thread: 1 Guest(s)