SA-MP Forums Archive
[HELP] Error into PlayersCommand - 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: [HELP] Error into PlayersCommand (/showthread.php?tid=97147)



[HELP] Error into PlayersCommand - Smiths - 12.09.2009

i got this :

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[500];
   

    cmd = strtok(cmdtext);

    if(strcmp(cmdtext, "/help", true) == 0) {
        SendClientMessage(playerid, 0xFF9900AA, "|-------------------------------------------------------------------------|");
        SendClientMessage(playerid, 0x33CCFFAA, ".:DAWN OF THE STUNTS - HELP:.");
        SendClientMessage(playerid, 0x33CCFFAA, "/register [password] : Keep your account's data(You need to /login too).");
        SendClientMessage(playerid, 0x33CCFFAA, "/pm [playerid] [message] : Send a Private Message to a user.");
    SendClientMessage(playerid, 0x33CCFFAA, "/telelist : All Teleport Commands.");
        SendClientMessage(playerid, 0xFF9900AA, "|-------------------------------------------------------------------------|");
 
    }
        if(strcmp(cmdtext, "/tel", true) == 0) {
        SendClientMessage(playerid, 0xFF9900AA, "|-------------------------------------------------------------------------|");
        SendClientMessage(playerid, 0x33CCFFAA, ".:DAWN OF THE STUNTS - Teleports:.");
        SendClientMessage(playerid, 0x33CCFFAA, "/bmx /air1 /airjump1");
        SendClientMessage(playerid, 0xFF9900AA, "|-------------------------------------------------------------------------|");
 
    }

   
}
And i got this error :

C:\Documents and Settings\Daniel\Desktop\SAMP SERVER\gamemodes\orrp.pwn(146) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Daniel\Desktop\SAMP SERVER\gamemodes\orrp.pwn(157) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Warnings.


Why?


Re: [HELP] Error into PlayersCommand - Correlli - 12.09.2009

The error is here:
pawn Код:
cmd = strtok(cmdtext);
it should be:
pawn Код:
new idx = 0;
cmd = strtok(cmdtext, idx);
500 cells? Are you crazy? You don't need more than 128 and you should return 0 at the end of the OnPlayerCommandText callback.


Re: [HELP] Error into PlayersCommand - LuxurioN™ - 12.09.2009

pawn Код:
new cmd[500];
500? 0o

pawn Код:
new cmd[128];
Not:
pawn Код:
cmd = strtok(cmdtext);
Yes:
pawn Код:
new idx;
cmd = strtok(cmdtext,idx);
Try:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128];
new idx;
cmd = strtok(cmdtext, idx);

if(strcmp(cmdtext, "/help", true) == 0) {
SendClientMessage(playerid, 0xFF9900AA, "|-------------------------------------------------------------------------|");
SendClientMessage(playerid, 0x33CCFFAA, ".:DAWN OF THE STUNTS - HELP:.");
SendClientMessage(playerid, 0x33CCFFAA, "/register [password] : Keep your account's data(You need to /login too).");
SendClientMessage(playerid, 0x33CCFFAA, "/pm [playerid] [message] : Send a Private Message to a user.");
SendClientMessage(playerid, 0x33CCFFAA, "/telelist : All Teleport Commands.");
SendClientMessage(playerid, 0xFF9900AA, "|-------------------------------------------------------------------------|");
return 1;
}
if(strcmp(cmdtext, "/tel", true) == 0) {
SendClientMessage(playerid, 0xFF9900AA, "|-------------------------------------------------------------------------|");
SendClientMessage(playerid, 0x33CCFFAA, ".:DAWN OF THE STUNTS - Teleports:.");
SendClientMessage(playerid, 0x33CCFFAA, "/bmx /air1 /airjump1");
SendClientMessage(playerid, 0xFF9900AA, "|-------------------------------------------------------------------------|");
return 1;
}
return 0;
}



Re: [HELP] Error into PlayersCommand - Smiths - 13.09.2009

lol thank you! and sorry for the string[500] ... epic fail xD