Little Problem - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Little Problem (
/showthread.php?tid=86333)
Little Problem -
DiEx - 13.07.2009
Hi All, I have a problem whit a very simple command, but i'm very n00b.
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
new cmd[256];
cmd=strtok(cmdtext,idx);
if(strcmp(cmd, "/help", true, 10) == 0)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "* * * * * AIUTI * * * * *");
SendClientMessage(playerid, COLOR_ORANGE, "Per la lista comandi digita /cmds");
SendClientMessage(playerid, COLOR_ORANGE, "Per gli obiettivi digita /obiettivi");
SendClientMessage(playerid, COLOR_ORANGE, "Per i teleport digita /tele");
SendClientMessage(playerid, COLOR_ORANGE, "Per i crediti digita /crediti");
return 1;
}
return 0;
}
The commands don't work and I have no error. Please Help!
Re: Little Problem -
woot - 13.07.2009
use [ pawn ] [ /pawn ] tags next time.
pawn Код:
if (!strcmp("/help", cmdtext, true))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "* * * * * AIUTI * * * * *");
SendClientMessage(playerid, COLOR_ORANGE, "Per la lista comandi digita /cmds");
SendClientMessage(playerid, COLOR_ORANGE, "Per gli obiettivi digita /obiettivi");
SendClientMessage(playerid, COLOR_ORANGE, "Per i teleport digita /tele");
SendClientMessage(playerid, COLOR_ORANGE, "Per i crediti digita /crediti");
return 1;
}
Re: Little Problem -
abhinavdabral - 13.07.2009
in this line
pawn Код:
if(strcmp(cmd, "/help", true, 10) == 0)
change it to -
pawn Код:
if(strcmp(cmd, "/help", true) == 0)
Re: Little Problem -
dice7 - 13.07.2009
Quote:
Originally Posted by ۞●•λвнiиаv•●۞
in this line
pawn Код:
if(strcmp(cmd, "/help", true, 10) == 0)
change it to -
pawn Код:
if(strcmp(cmd, "/help", true) == 0)
|
Yes, it is that line. But he is comparing the wrong strings. It should be
pawn Код:
if(strcmp(cmdtext, "/help", true) == 0)
since OnPlayerCommandText passes cmdtext
And this part of the code
pawn Код:
new idx;
new cmd[256];
cmd=strtok(cmdtext,idx);
is completly unnesesary
Re: Little Problem -
abhinavdabral - 13.07.2009
well ... that code is not completely unnecessary bcoz he might have used some other commands which may use it.
And thanks for correcting my error :P
-Abhinav