HELP Error in command (001)
#1

i was trying to make a simple SendClientMessage command but i gives me the error 001 and i have no idea how to fix it.

my Command :

Код:
    if (strcmp("/url", cmdtext, true, 10) == 0)
	{
	    SendClientMessage(playerid, COLOR_GREEN,("www.ZynaGaming.com");
	    // Do something here
		return 1;
	}
	return 0;
}
Reply
#2

pawn Код:
if (strcmp("/command", cmdtext, true, 10) == 0)
    {
        //do something
        return 1;
    }
Try to make everything lined up so it could work
Reply
#3

then i get this error + warning :

TestServer.pwn(329) : error 001: expected token: ",", but found ";"
TestServer.pwn(333) : warning 217: loose indentation
Reply
#4

like this
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
    if (strcmp("/kill", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 0.0);
        return 1;
    }
    if (strcmp("/die", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 0.0);
        return 1;
    }
    if (strcmp("/weapon", cmdtext, true, 10) == 0)
    {
        GivePlayerWeapon(playerid, 26, 500);
        return 1;
    }
    //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
    return 0;
}
Reply
#5

pawn Код:
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    if( strcmp( "/url", cmdtext, true, 4 ) == 0 )
    {
        SendClientMessage( playerid, COLOR_GREEN, "www.ZynaGaming.com" );
        // Do something here
        return 1;
    }
    return 0;
}
Reply
#6

SendClientMessage(playerid, COLOR_GREEN,"www.ZynaGaming.com"); this should work there was ( in code
Reply
#7

Quote:
Originally Posted by vakhtang
Посмотреть сообщение
like this
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
    if (strcmp("/kill", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 0.0);
        return 1;
    }
    if (strcmp("/die", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 0.0);
        return 1;
    }
    if (strcmp("/weapon", cmdtext, true, 10) == 0)
    {
        GivePlayerWeapon(playerid, 26, 500);
        return 1;
    }
    //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
    return 0;
}
Btw the lenghts are wrong. They are not 10 but:
/kill -> 5
/die -> 4
/weapons -> 8
Reply
#8

Instead of only giving code also explain them what they did wrong and why it gave the error!

pawn Код:
if(!strcmp(cmdtext,"/kill",true))
{
    SendClientMessage(playerid, COLOR_GREEN,"www.ZynaGaming.com");
    // Do something here
    return 1;
}
You have used ("string") but using that you forgot to close the function with a ). The compiler misses the ) and that is why it gives that error: expected token ' ' but found ' '. You can either remove these "( )" in the message parameter because it's not really necessary but you can also add another ")" so it closes properly!
Reply
#9

Quote:
Originally Posted by Dwane
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    if( strcmp( "/url", cmdtext, true, 4 ) == 0 )
    {
        SendClientMessage( playerid, COLOR_GREEN, "www.ZynaGaming.com" );
        // Do something here
        return 1;
    }
    return 0;
}
still error 001

EDIT : nvm it worked thanks all
Reply
#10

Quote:
Originally Posted by BoyDenker
Посмотреть сообщение
still error 001

EDIT : nvm it worked thanks all
worked

EDIT : it didn't work when i type /url in game it says : SERVER UNKNOWN COMMAND
or something like that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)