Function getskin
#1

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;
}
Reply
#2

What you want to do about skins 14 15 20?
Reply
#3

The skin will increase by 1 only when the skin is 14, 15 or 20.
Reply
#4

Well every skin i have it set me skin 0
Reply
#5

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?
Reply
#6

Код:
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;
}
Reply
#7

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
Reply
#8

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
Reply
#9

Код:
GetNextSkin(skin)
{
	switch (skin)
	{
		case 0..310: skin++;
		case 13: skin = 16;
		case 19: skin = 21;
		default: skin = 0;
	}
	return skin;
}
Reply
#10

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==14skin+=2;
    if(
skin==15 || skin==20skin++;
    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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)