Function getskin -
Mister0 - 15.08.2016
I made a command to setskin and i want to make if is restricted skin to set the next skin but is not work, what is wrong?
Код:
CMD:nextskin(playerid,params[])
{
new nextskin = GetNextSkin(GetPlayerSkin(playerid));
SetPlayerSkin(playerid,nextskin);
}
GetNextSkin(skin)
{
if(skin==14||skin==15||skin==20)
skin++;
return skin;
}
When I type the command it set me skin 0
I make a debug and it return me 0 at every time
Код:
GetNextSkin(skin)
{
new newskin=skin;
new str[20];
format(str,20,"your skin %d",newskin);
SCM(0,-1,str);
if(skin==14||skin==15||skin==20)
newskin++;
format(str,20,"your next skin %d",newskin);
SCM(0,-1,str);
return newskin;
}
Re: Function getskin -
Shinja - 15.08.2016
What you want to do about skins 14 15 20?
Re: Function getskin -
Stinged - 15.08.2016
The skin will increase by 1 only when the skin is 14, 15 or 20.
Re: Function getskin -
Mister0 - 15.08.2016
Well every skin i have it set me skin 0
Re: Function getskin -
Shinja - 15.08.2016
Quote:
Originally Posted by Mister0
GetNextSkin(skin)
{
if(skin==14||skin==15||skin==20)
skin++;
return skin;
}
|
This if looks like an empty statement, add brackets for more accuracy
But what you want to do with skins 14 15 and 20?
Re: Function getskin -
F1N4L - 15.08.2016
Код:
CMD:nextskin(playerid,params[])
{
SetPlayerSkin(playerid, GetNextSkin(playerid));
return true;
}
GetNextSkin(playerid)
{
new str[20], OldSkin, NewSkin;
OldSkin = GetPlayerSkin(playerid);
format(str,20,"your skin %d", OldSkin);
SCM(playerid,-1, str);
if(OldSkin > 310)
{
NewSkin = 0;
}
else
{
NewSkin = OldSkin + 1;
}
if(NewSkin == 14 || NewSkin == 15 || NewSkin == 20)
{
// code ?
}
format(str,20,"your next skin %d", NewSkin);
SCM(playerid,-1, str);
return NewSkin;
}
Re: Function getskin -
Mister0 - 15.08.2016
Quote:
Originally Posted by Shinja
This if looks like an empty statement, add brackets for more accuracy
But what you want to do with skins 14 15 and 20?
|
I just want to don t set me that skin if that s my next skin I want to skip him to next and if the next is restricted too skip hin too
Re: Function getskin -
Mister0 - 15.08.2016
These 3 skins are "restricted" i dont want to set me, how can i skip them? But in same time to set me next id of skin whos not restricted
Re: Function getskin -
Stinged - 15.08.2016
Код:
GetNextSkin(skin)
{
switch (skin)
{
case 0..310: skin++;
case 13: skin = 16;
case 19: skin = 21;
default: skin = 0;
}
return skin;
}
Re: Function getskin -
Mister0 - 15.08.2016
Quote:
Originally Posted by Stinged
Код:
GetNextSkin(skin)
{
switch (skin)
{
case 0..310: skin++;
case 13: skin = 16;
case 19: skin = 21;
default: skin = 0;
}
return skin;
}
|
If I use this code i need to create a case for every skin i don t want to set, and there are be many
I just want to make a function
RestrictedSkin(skin)
{
if(skin==14||skin==16||skin==20||skin==100||skin== 101||skin==102||skin==103)
return 1;
return 0;
}
and if(RestrictedSkin(newSkin))
// what can i set?
[QUOTE=Shinja;3752957]
PHP код:
GetNextSkin(playerid)
{
new str[10], skin = GetPlayerSkin(playerid);
format(str,10,"Your skin %d",skin);
SendClientMessage(playerid,-1,str);
skin++;
if(skin==14) skin+=2;
if(skin==15 || skin==20) skin++;
return skin;
}
I have skins saved in variable from mysql, how can i know to set +2 or +1 or +6
That I want to say