SA-MP Forums Archive
1 error with commands for classes - 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: 1 error with commands for classes (/showthread.php?tid=81523)



1 error with commands for classes - Pawno_Master - 11.06.2009

this is my script

Код:
	if(strcmp(cmd,"/copcommands",true)==0)
		{
    if(gTeam[playerid] == TEAM_COPS)
    {
    SendClientMessage(playerid, 0xAA3333AA,"Your commands are /cuff ID /fine ID /arrest ID /rp ID");
    }
    return 1;
this is my error

Код:
C:\Gta sa server\gamemodes\freeroam.pwn(361) : error 017: undefined symbol "cmd"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: 1 error with commands for classes - dice7 - 11.06.2009

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/animals", cmdtext, true, 10) == 0)
    {
    if(gTeam[playerid] == TEAM_COPS)
    {
    SendClientMessage(playerid, 0xAA3333AA,"Your commands are /cuff ID /fine ID /arrest ID /rp ID");
    }
    return 1;
    }
return 0;
}



Re: 1 error with commands for classes - Burridge - 11.06.2009

Quote:
Originally Posted by Pawno_Master
Код:
C:\Gta sa server\gamemodes\freeroam.pwn(361) : error 017: undefined symbol "cmd"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Or, instead of changing a little bit of code, use this:

pawn Код:
//at the top of "OnPlayerCommandText"
new cmd[256];
//it would look like this:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
    if(strcmp(cmd,"/copcommands",true)==0)
        {
    if(gTeam[playerid] == TEAM_COPS)
    {
    SendClientMessage(playerid, 0xAA3333AA,"Your commands are /cuff ID /fine ID /arrest ID /rp ID");
    }
    return 1;

    return 0;
}



Re: 1 error with commands for classes - HydraX - 11.06.2009

why are putting 2 cmd[256]??

just delete one and it will complie


Re: 1 error with commands for classes - Correlli - 11.06.2009

And why 256? Command isn't that long, use 128 instead.


Re: 1 error with commands for classes - SEC - 11.06.2009

replace cmd with cmdtext