1 error with commands for classes
#1

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.
Reply
#2

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;
}
Reply
#3

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;
}
Reply
#4

why are putting 2 cmd[256]??

just delete one and it will complie
Reply
#5

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

replace cmd with cmdtext
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)