[Help] Skin Numbers in one Function
#1

hello again, i'm stucked with a problem, i need to make some SKINID in one function for example:
i need to put numberskin example:64,69,75,76.. in one function we can name it "IsFactionXSkin()"
so i can make some commands with this:
if(IsFactionXSkin())
{
code...

how i'm now i need to do:
if(GetPlayerSkin(playerid) == 64 || GetPlayerSkin(playerid) == 69 || GetPlayerSkin(playerid) == VeryVeryMuchOtherSkins...
{

and this make really MUCH TIME

thanks for have read
Reply
#2

You could do
pawn Код:
new skin = GetPlayerSkin(playerid);
if(skin == 64 || skin == 69 ...)
To make your job shorter but I think you have to do them one by one instead of using a loop or another way because you might stumble upon an unsupported skin and crash the server.
Reply
#3

Save them in an array and then check like this.

pawn Код:
If(GetPlayerSkin(playerid) == arrayname)
Or just use teams and check for the team.
Reply
#4

Quote:
Originally Posted by FUNExtreme
Save them in an array and then check like this.

pawn Код:
If(GetPlayerSkin(playerid) == arrayname)
Or just use teams and check for the team.
Oh array, that's a good idea.
Reply
#5

that's the problem, i mean how to make the array?

i make the array with this?

pawn Код:
new IsFactionXSkin[TOTALSKINS]
{
64, 69, 75, ex...
}

and then put If(GetPlayerSkin(playerid) == IsFactionXSkin())
Reply
#6

Something like that, yes.
Reply
#7

I have not end to put the skin cause it take a while, but i have try the code it copile with NoErrors but if i try it will not work, i had try with "GetPlayerSkin(playerid) == 54 || ...." and was working, but now it dosn't work, here is the changes in the code:

pawn Код:
new IsFactionSkin[] =
{
    54, 55, 56, 63, 64, 69, 75, 76, 77, 85, 87, 88, 89, 91, 92, 93, 129, 131, 138,
    139, 140, 141
};

new TotalFactionSkin = sizeof(IsFactionSkin);

if(GetPlayerSkin(playerid) == IsFactionSkin[TotalFactionSkin])
{
      SendClientMessage(playerid, 0xFFFFFFAA, "Faction Skin");
}               }
else
{
      SendClientMessage(playerid, 0xFFFFFFAA, "No Faction Skin");
      return 1;
}
Reply
#8

Try without the totalfactions... thing
Reply
#9

Quote:
Originally Posted by FUNExtreme
Try without the totalfactions... thing
it give me:
error 032: array index out of bounds (variable "IsFactionSkin")

pawn Код:
if(GetPlayerSkin(playerid) == IsFactionSkin[22]) // 22 = total numbers of the skins i have add in the array
                {
-----------------------

if i do:
pawn Код:
if(GetPlayerSkin(playerid) == IsFactionSkin[])
                {
it give me:
error 029: invalid expression, assumed zero
Reply
#10

I have a stock of VALIDS skins.
And for my /setskin command is like
pawn Код:
if(!skin(strval(cmd))) return SendClientMessage(playerid,COLOR_GREY,"Invalid skin ID.");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)