strcmp to check cmdtext - 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: strcmp to check cmdtext (
/showthread.php?tid=522026)
strcmp to check cmdtext -
Faisal_khan - 25.06.2014
Hey guys,
I am doing this to check if /pm command is used. But it is not working (i.e. on using /pm I am getting the same result as when I am not using /pm). Am I comparing the string the right way? :
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success) SendClientMessage(playerid, -1, "Incorrect command, type /cmds to find out available commands");
if(success)
{
if(strcmp(cmdtext, "/pm") == 1)
{
print("");
}
}
return 1;
}
Regards.
Respuesta: strcmp to check cmdtext -
SickAttack - 25.06.2014
Use ZCMD and don't do that lol.
Re: strcmp to check cmdtext -
Faisal_khan - 25.06.2014
Dude I already made the pm command using zcmd. Here I am checking if the player is using the command or not using the function.
And nvm I solved it.
pawn Код:
if(strcmp(cmdtext, "/pm") != 1) print("1");
else