SA-MP Forums Archive
IsValidCustomSkin - 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: IsValidCustomSkin (/showthread.php?tid=652073)



IsValidCustomSkin - PowerF - 02.04.2018

can anyone give me function IsValidCustomSkin pls?
or an example to store custom skin in an array and do if(CustomSkinArray ??


Re: IsValidCustomSkin - ForCop - 02.04.2018

Quote:
Originally Posted by PowerF
Посмотреть сообщение
can anyone give me function IsValidCustomSkin pls?
or an example to store custom skin in an array and do if(CustomSkinArray ??
Код:
stock IsValidCustomSkin(skinid){
	switch(skinid){
	case 0..73,75..311,2000..30000: return true;
	}
return false;
}



Re: IsValidCustomSkin - PowerF - 02.04.2018

and how do I add skin id 74 to exception ?


Re: IsValidCustomSkin - ForCop - 02.04.2018

Quote:
Originally Posted by PowerF
Посмотреть сообщение
and how do I add skin id 74 to exception ?
id 74 is invalid skin


Re: IsValidCustomSkin - PowerF - 02.04.2018

Код:
error 002: only a single statement (or expression) can follow each "case"
warning 215: expression has no effect
warning 209: function "IsValidSkin" should return a value
error 054: unmatched closing brace ("}")



Re: IsValidCustomSkin - ForCop - 02.04.2018

Quote:
Originally Posted by PowerF
Посмотреть сообщение
this is my code
PHP код:
IsValidSkin(skin)
{
    return (
<= skin <= 311 && skin != 74);

I can't do it in 'case'
you said IsValidCustomSkin


Re: IsValidCustomSkin - ForCop - 02.04.2018

Код:
IsValidSkin(skin) return (0 <= skin <= 311 && skin != 74);



Re: IsValidCustomSkin - PowerF - 02.04.2018

I got this error now
PHP код:
error 002only a single statement (or expressioncan follow each "case"
warning 215expression has no effect
warning 209
: function "IsValidSkin" should return a value
error 054
unmatched closing brace ("}"
PHP код:
stock IsValidSkin(skinid)
{
    switch(
skinid)
    {
        case 
0..73,75..311,25000..25007,26001..26011,27001: return true;
        return 
false;
    }




Re: IsValidCustomSkin - ForCop - 02.04.2018

Quote:
Originally Posted by PowerF
Посмотреть сообщение
I got this error now
PHP код:
error 002only a single statement (or expressioncan follow each "case"
warning 215expression has no effect
warning 209
: function "IsValidSkin" should return a value
error 054
unmatched closing brace ("}"
PHP код:
stock IsValidSkin(skinid)
{
    switch(
skinid)
    {
        case 
0..73,75..311,25000..25007,26001..26011,27001: return true;
        return 
false;
    }

Код:
stock IsValidCustomSkin(skinid){
	switch(skinid){
	case 0..73,75..311,2000..30000: return true;
	}
return false;
}
test now


Re: IsValidCustomSkin - PowerF - 02.04.2018

thanks,it compiled.
but how do I make so that skin id 26001..26007 only can be used for premium?

PHP код:
stock IsValidSkin(skinid)
{
    switch(
skinid)
    {
        case 
0..73,75..311,25000..25007,27001: return true;
        case 
26001..26011//premium skins
        
{
            if(
Premium[playerid] < 2) return Error(playerid"Can't use this skin");
        }
    }
    return 
false;

you know,playerid is not defined.