Block Skins !
#1

hey guys,
i got Zombies vs human mode and there is option to create your own class
like skin , weapons , abillity ..
that is my code:
case CUSTOMCLASS_SKIN:
{
if(response)
{
if(!strcmp(inputtext, "67", true))
SendClientMessage(playerid,COLOR_ROJO,"This Skin is not allowed !");
}
else
{
new SkinIDInText[100];
format(SkinIDInText,sizeof(SkinIDInText),"%s",inpu ttext);
SetPlayerSkin(playerid,strval(inputtext));
playerskin = GetPlayerSkin(playerid);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"pSkin",playerskin);
pInfo[playerid][pSkin] = playerskin;
INI_Close(File);
}
return 1;
}

now i want to do that if someone choose skin id 67 he will get error , it's working but cant choose other skins too
it's just dont change the skin
help ?
Reply
#2

You need to include that "else" part inside "if(response)".
Reply
#3

Quote:
Originally Posted by DiGiTaL_AnGeL
Посмотреть сообщение
You need to include that "else" part inside "if(response)".
thanks that works ,
but how i can block few skins ? i tried if(!strcmp(inputtext, "67","68", true))

but error any idea ?
Reply
#4

Quote:
Originally Posted by s0ZNIz
Посмотреть сообщение
thanks that works ,
but how i can block few skins ? i tried if(!strcmp(inputtext, "67", true)

but error any idea ?
Use the 'and' operator which is && in PAWN language. For example;
pawn Код:
if(!strcmp(inputtext, "67", true) && !strcmp(inputtext, "68", true))
Reply
#5

Quote:
Originally Posted by Capua
Посмотреть сообщение
Use the 'and' operator which is && in PAWN language. For example;
pawn Код:
if(!strcmp(inputtext, "67", true) && !strcmp(inputtext, "68", true))
not working bro .

PHP код:
    case CUSTOMCLASS_SKIN:
    {
        if(
response)
     {
if(!
strcmp(inputtext"0"true) && !strcmp(inputtext"1"true) && !strcmp(inputtext"73"true) && !strcmp(inputtext"78"true) && !strcmp(inputtext"79"true) && !strcmp(inputtext"75"true) && !strcmp(inputtext"134"true) && !strcmp(inputtext"136"true) && !strcmp(inputtext"142"true)
&& !
strcmp(inputtext"137"true) && !strcmp(inputtext"149"true) && !strcmp(inputtext"157"true) && !strcmp(inputtext"158"true) && !strcmp(inputtext"159"true) && !strcmp(inputtext"160"true) && !strcmp(inputtext"161"true) && !strcmp(inputtext"162"true) && !strcmp(inputtext"163"true)
&& !
strcmp(inputtext"168"true) && !strcmp(inputtext"181"true) && !strcmp(inputtext"183"true) && !strcmp(inputtext"196"true) && !strcmp(inputtext"197"true) && !strcmp(inputtext"198"true) && !strcmp(inputtext"200"true) && !strcmp(inputtext"201"true) && !strcmp(inputtext"202"true)
&& !
strcmp(inputtext"212"true) && !strcmp(inputtext"213"true) && !strcmp(inputtext"217"true) && !strcmp(inputtext"220"true) && !strcmp(inputtext"229"true) && !strcmp(inputtext"230"true) && !strcmp(inputtext"239"true) && !strcmp(inputtext"241"true) && !strcmp(inputtext"242"true)
&& !
strcmp(inputtext"262"true) && !strcmp(inputtext"264"true) && !strcmp(inputtext"285"true) && !strcmp(inputtext"294"true) && !strcmp(inputtext"297"true) && !strcmp(inputtext"10"true) && !strcmp(inputtext"9"true) && !strcmp(inputtext"28"true) && !strcmp(inputtext"33"true)
&& !
strcmp(inputtext"68"true) && !strcmp(inputtext"70"true) && !strcmp(inputtext"77"true) && !strcmp(inputtext"80"true) && !strcmp(inputtext"81"true) && !strcmp(inputtext"99"true) && !strcmp(inputtext"123"true) && !strcmp(inputtext"122"true) && !strcmp(inputtext"164"true)
&& !
strcmp(inputtext"102"true) && !strcmp(inputtext"103"true) && !strcmp(inputtext"104"true) && !strcmp(inputtext"105"true) && !strcmp(inputtext"106"true) && !strcmp(inputtext"107"true) && !strcmp(inputtext"108"true) && !strcmp(inputtext"109"true) && !strcmp(inputtext"263"true)
&& !
strcmp(inputtext"110"true) && !strcmp(inputtext"269"true) && !strcmp(inputtext"270"true) && !strcmp(inputtext"271"true))
         
SendClientMessage(playerid,COLOR_ROJO,"This Skin is not allowed !");
         else
         {
         new 
SkinIDInText[100];
        
format(SkinIDInText,sizeof(SkinIDInText),"%s",inputtext);
        
SetPlayerSkin(playerid,strval(inputtext));
     
playerskin GetPlayerSkin(playerid);
        new 
INI:File INI_Open(UserPath(playerid));
        
INI_SetTag(File,"data");
           
INI_WriteInt(File,"pSkin",playerskin);
     
pInfo[playerid][pSkin] = playerskin;
           
INI_Close(File);
           }
           }
        return 
1;
    } 
No Errors , but inside the game i can still change my skin to the blocked skins.
Reply
#6

pawn Код:
case CUSTOMCLASS_SKIN:
    {
        if(response)
     {
if(!strcmp(inputtext, "0", true) && !strcmp(inputtext, "1", true) && !strcmp(inputtext, "73", true) && !strcmp(inputtext, "78", true) && !strcmp(inputtext, "79", true) && !strcmp(inputtext, "75", true) && !strcmp(inputtext, "134", true) && !strcmp(inputtext, "136", true) && !strcmp(inputtext, "142", true)
&& !strcmp(inputtext, "137", true) && !strcmp(inputtext, "149", true) && !strcmp(inputtext, "157", true) && !strcmp(inputtext, "158", true) && !strcmp(inputtext, "159", true) && !strcmp(inputtext, "160", true) && !strcmp(inputtext, "161", true) && !strcmp(inputtext, "162", true) && !strcmp(inputtext, "163", true)
&& !strcmp(inputtext, "168", true) && !strcmp(inputtext, "181", true) && !strcmp(inputtext, "183", true) && !strcmp(inputtext, "196", true) && !strcmp(inputtext, "197", true) && !strcmp(inputtext, "198", true) && !strcmp(inputtext, "200", true) && !strcmp(inputtext, "201", true) && !strcmp(inputtext, "202", true)
&& !strcmp(inputtext, "212", true) && !strcmp(inputtext, "213", true) && !strcmp(inputtext, "217", true) && !strcmp(inputtext, "220", true) && !strcmp(inputtext, "229", true) && !strcmp(inputtext, "230", true) && !strcmp(inputtext, "239", true) && !strcmp(inputtext, "241", true) && !strcmp(inputtext, "242", true)
&& !strcmp(inputtext, "262", true) && !strcmp(inputtext, "264", true) && !strcmp(inputtext, "285", true) && !strcmp(inputtext, "294", true) && !strcmp(inputtext, "297", true) && !strcmp(inputtext, "10", true) && !strcmp(inputtext, "9", true) && !strcmp(inputtext, "28", true) && !strcmp(inputtext, "33", true)
&& !strcmp(inputtext, "68", true) && !strcmp(inputtext, "70", true) && !strcmp(inputtext, "77", true) && !strcmp(inputtext, "80", true) && !strcmp(inputtext, "81", true) && !strcmp(inputtext, "99", true) && !strcmp(inputtext, "123", true) && !strcmp(inputtext, "122", true) && !strcmp(inputtext, "164", true)
&& !strcmp(inputtext, "102", true) && !strcmp(inputtext, "103", true) && !strcmp(inputtext, "104", true) && !strcmp(inputtext, "105", true) && !strcmp(inputtext, "106", true) && !strcmp(inputtext, "107", true) && !strcmp(inputtext, "108", true) && !strcmp(inputtext, "109", true) && !strcmp(inputtext, "263", true)
&& !strcmp(inputtext, "110", true) && !strcmp(inputtext, "269", true) && !strcmp(inputtext, "270", true) && !strcmp(inputtext, "271", true))
         return SendClientMessage(playerid,COLOR_ROJO,"This Skin is not allowed !"); //YOU FORGOT THE RETURN
         else
         {
         new SkinIDInText[100];
        format(SkinIDInText,sizeof(SkinIDInText),"%s",inputtext);
        SetPlayerSkin(playerid,strval(inputtext));
     playerskin = GetPlayerSkin(playerid);
        new INI:File = INI_Open(UserPath(playerid));
        INI_SetTag(File,"data");
           INI_WriteInt(File,"pSkin",playerskin);
     pInfo[playerid][pSkin] = playerskin;
           INI_Close(File);
           }
           }
        return 1;
    }
Reply
#7

Quote:
Originally Posted by Eth
Посмотреть сообщение
pawn Код:
case CUSTOMCLASS_SKIN:
    {
        if(response)
     {
if(!strcmp(inputtext, "0", true) && !strcmp(inputtext, "1", true) && !strcmp(inputtext, "73", true) && !strcmp(inputtext, "78", true) && !strcmp(inputtext, "79", true) && !strcmp(inputtext, "75", true) && !strcmp(inputtext, "134", true) && !strcmp(inputtext, "136", true) && !strcmp(inputtext, "142", true)
&& !strcmp(inputtext, "137", true) && !strcmp(inputtext, "149", true) && !strcmp(inputtext, "157", true) && !strcmp(inputtext, "158", true) && !strcmp(inputtext, "159", true) && !strcmp(inputtext, "160", true) && !strcmp(inputtext, "161", true) && !strcmp(inputtext, "162", true) && !strcmp(inputtext, "163", true)
&& !strcmp(inputtext, "168", true) && !strcmp(inputtext, "181", true) && !strcmp(inputtext, "183", true) && !strcmp(inputtext, "196", true) && !strcmp(inputtext, "197", true) && !strcmp(inputtext, "198", true) && !strcmp(inputtext, "200", true) && !strcmp(inputtext, "201", true) && !strcmp(inputtext, "202", true)
&& !strcmp(inputtext, "212", true) && !strcmp(inputtext, "213", true) && !strcmp(inputtext, "217", true) && !strcmp(inputtext, "220", true) && !strcmp(inputtext, "229", true) && !strcmp(inputtext, "230", true) && !strcmp(inputtext, "239", true) && !strcmp(inputtext, "241", true) && !strcmp(inputtext, "242", true)
&& !strcmp(inputtext, "262", true) && !strcmp(inputtext, "264", true) && !strcmp(inputtext, "285", true) && !strcmp(inputtext, "294", true) && !strcmp(inputtext, "297", true) && !strcmp(inputtext, "10", true) && !strcmp(inputtext, "9", true) && !strcmp(inputtext, "28", true) && !strcmp(inputtext, "33", true)
&& !strcmp(inputtext, "68", true) && !strcmp(inputtext, "70", true) && !strcmp(inputtext, "77", true) && !strcmp(inputtext, "80", true) && !strcmp(inputtext, "81", true) && !strcmp(inputtext, "99", true) && !strcmp(inputtext, "123", true) && !strcmp(inputtext, "122", true) && !strcmp(inputtext, "164", true)
&& !strcmp(inputtext, "102", true) && !strcmp(inputtext, "103", true) && !strcmp(inputtext, "104", true) && !strcmp(inputtext, "105", true) && !strcmp(inputtext, "106", true) && !strcmp(inputtext, "107", true) && !strcmp(inputtext, "108", true) && !strcmp(inputtext, "109", true) && !strcmp(inputtext, "263", true)
&& !strcmp(inputtext, "110", true) && !strcmp(inputtext, "269", true) && !strcmp(inputtext, "270", true) && !strcmp(inputtext, "271", true))
         return SendClientMessage(playerid,COLOR_ROJO,"This Skin is not allowed !"); //YOU FORGOT THE RETURN
         else
         {
         new SkinIDInText[100];
        format(SkinIDInText,sizeof(SkinIDInText),"%s",inputtext);
        SetPlayerSkin(playerid,strval(inputtext));
     playerskin = GetPlayerSkin(playerid);
        new INI:File = INI_Open(UserPath(playerid));
        INI_SetTag(File,"data");
           INI_WriteInt(File,"pSkin",playerskin);
     pInfo[playerid][pSkin] = playerskin;
           INI_Close(File);
           }
           }
        return 1;
    }
Not working
Reply
#8

Replace all && with ||
Reply
#9

Quote:
Originally Posted by DavidBilla
Посмотреть сообщение
Replace all && with ||
As mentioned that might work, how-ever I'd recommend making it shorter using this method,

pawn Код:
new skinid = strval(inputtext);
if(skinid == 0 || skinid == 270) // etc
or something like it. No need to use strcmp for something like this.
Reply
#10

Thanks guys !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)