SA-MP Forums Archive
Help with this command - 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: Help with this command (/showthread.php?tid=501088)



Help with this command - Tadas - 16.03.2014

Hello, I have a problem with this command, when I tipe /paliktidarba it show SERVER: Unknown command.
pawn Код:
if(strcmp("/paliktidarba",cmdtext,true) == 0)
    {
    if(PInfo[playerid][grove] == 1) return PInfo[playerid][grove] = 0;
    SData(playerid);
    Logged[playerid] = false;
    return 1;
    }
Where is the problem ?


Re : Help with this command - Golimad - 16.03.2014

I think it should be like that :
if(!strcmp(cmdtext, "/paliktidarba", true, 13))


Re: Help with this command - Tadas - 16.03.2014

Thanks it's working. But where was the problem ?


Re : Help with this command - Golimad - 16.03.2014

The problem was in the condition, strcmp compare two strings, it will never == 0 I think
Use ZCMD + Sscanf , it's much easier and faster


Re: Help with this command - Tadas - 16.03.2014

Ok, thanks man


Re: Help with this command - Stinged - 16.03.2014

Actually, using if(!strmp(...)) is the same thing as using if(strmp(...) == 0)


Re : Re: Help with this command - Golimad - 16.03.2014

Quote:
Originally Posted by Stinged
Посмотреть сообщение
Actually, using if(!strmp(...)) is the same thing as using if(strmp(...) == 0)
I don't use strcmp so .. maybe because he forgot to insert the length of string [13]