17.07.2014, 14:42
I was thinking if there is any way if I can change this long condition to a simple array:
To change into something like this:
pawn Код:
if(strval(inputtext) > -1 && strval(inputtext) < 300)
{
if(strval(inputtext) == 107||106||105||86||271||269||270||284||280||281||282||283||165||287||286||288||285) return SendClientMessage(playerid,COLOR_GREY,"This skin is used by a faction !");
else
{
SetPlayerSkin(playerid,strval(inputtext));
PlayerInfo[playerid][pClothes] = strval(inputtext);
PlayerInfo[playerid][pCash] -= 500;
new oldcash = GetPlayerMoney(playerid);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, oldcash-500);
SendClientMessage(playerid,COLOR_YELLOW,"[Clothes]: You have changed your suit !");
}
}
pawn Код:
new Skins[][] = { 107,106,...285 }
if(strval(inputtext) > -1 && strval(inputtext) < 300)
{
if(strval(inputtext) == sizeof(Skins)) return SendClientMessage(playerid,COLOR_GREY,"This skin is used by a faction !");
else
{
SetPlayerSkin(playerid,strval(inputtext));
PlayerInfo[playerid][pClothes] = strval(inputtext);
PlayerInfo[playerid][pCash] -= 500;
new oldcash = GetPlayerMoney(playerid);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, oldcash-500);
SendClientMessage(playerid,COLOR_YELLOW,"[Clothes]: You have changed your suit !");
}
}