Skins Arrays - 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: Skins Arrays (
/showthread.php?tid=526438)
Skins Arrays -
Psyhophatic - 17.07.2014
I was thinking if there is any way if I can change this long condition to a simple array:
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 !");
}
}
To change into something like this:
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 !");
}
}
Re: Skins Arrays -
Pottus - 17.07.2014
pawn Код:
IsFactionSkin(skin)
{
switch(skin) { case 107,106,105,86,271,269,270,284,280,281,282,283,165,287,286,288,285: return 1; }
return 0;
}
Re: Skins Arrays -
Psyhophatic - 17.07.2014
ooh... this it's a good ideea too
tnx Pottus
Re: Skins Arrays -
Threshold - 17.07.2014
pawn Код:
IsFactionSkin(skin)
{
switch(skin) { case 86, 105 .. 107, 165, 269 .. 271, 280 .. 288: return 1; }
return 0;
}
Just to be a dick