HELP Error in command (001) -
BoyDenker - 01.02.2012
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;
}
Re: HELP Error in command (001) -
vakhtang - 01.02.2012
pawn Код:
if (strcmp("/command", cmdtext, true, 10) == 0)
{
//do something
return 1;
}
Try to make everything lined up so it could work
Re: HELP Error in command (001) -
BoyDenker - 01.02.2012
then i get this error + warning :
TestServer.pwn(329) : error 001: expected token: ",", but found ";"
TestServer.pwn(333) : warning 217: loose indentation
Re: HELP Error in command (001) -
vakhtang - 01.02.2012
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;
}
Re: HELP Error in command (001) -
Konstantinos - 01.02.2012
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;
}
Re: HELP Error in command (001) -
vakhtang - 01.02.2012
SendClientMessage(playerid, COLOR_GREEN,"www.ZynaGaming.com"); this should work there was ( in code
Re: HELP Error in command (001) -
Konstantinos - 01.02.2012
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
Re: HELP Error in command (001) -
Jochemd - 01.02.2012
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!
Re: HELP Error in command (001) -
BoyDenker - 01.02.2012
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
Re: HELP Error in command (001) -
BoyDenker - 01.02.2012
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.