How o fix this error -
Peter_Corneile - 17.08.2009
I keep doing this and everytime the same error
Код:
if(!strcmp(cmdtext, "/help", true))
{
SendClientMessage(playerid, LightBlue, "Checking");
return 1;
I dont know whats the problem but these erros show up
Код:
C:\Documents and Settings\Admin\My Documents\My Received Files\CES.pwn(202) : error 010: invalid function or declaration
C:\Documents and Settings\Admin\My Documents\My Received Files\CES.pwn(206) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.
Re: How o fix this error -
Mr_Finnigan - 17.08.2009
No closing bracket? you have { but are missing the } somewhere before retern1;
Re: How o fix this error -
Peter_Corneile - 17.08.2009
That didnt fix it sorry
Re: How o fix this error -
Mr_Finnigan - 17.08.2009
show more of the script?
Re: How o fix this error -
Peter_Corneile - 17.08.2009
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/kill", true))
{
SetPlayerHealth(playerid, 0.0);
SendClientMessage(playerid, 0xFF8282AA, "SERVER: You have killed yourself!");
return true;
}
return false;
}
if(!strcmp(cmdtext, "/help", true))
{
SendClientMessage(playerid, LightBlue, "Checking");
}
return 1;
}
the /kill command is working but /help is not
Re: How o fix this error -
Mr_Finnigan - 17.08.2009
You have a closing bracket after return false; which means your /help is not being reached
Re: How o fix this error -
Peter_Corneile - 17.08.2009
Alright i changed it to
Код:
if(!strcmp(cmdtext, "/kill", true))
{
SetPlayerHealth(playerid, 0.0);
SendClientMessage(playerid, 0xFF8282AA, "SERVER: You have killed yourself!");
return true;
}
return false;
if(!strcmp(cmdtext, "/help", true))
{
SendClientMessage(playerid, Lightblue, "Checking");
}
return 1;
}
Now it compiles with a warning
Код:
C:\Documents and Settings\Admin\My Documents\My Received Files\CES.pwn(203) : warning 225: unreachable code
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warning.
ANd also it is not working IG
Re: How o fix this error -
ACERS - 17.08.2009
No reason for the return false; there. It does nothing
Код:
if(!strcmp(cmdtext, "/kill", true))
{
SetPlayerHealth(playerid, 0.0);
SendClientMessage(playerid, 0xFF8282AA, "SERVER: You have killed yourself!");
return true;
}
if(!strcmp(cmdtext, "/help", true))
{
SendClientMessage(playerid, Lightblue, "Checking");
}
return 1;
Re: How o fix this error -
Badger(new) - 17.08.2009
The above poster is wrong.
You need to either return 1 or 0 under OnPlayerCommandText. 1 Passes it on to another script, 0 says "Server: Unknown command".
Put this:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/kill", true))
{
SetPlayerHealth(playerid, 0.0);
SendClientMessage(playerid, 0xFF8282AA, "SERVER: You have killed yourself!");
return 1;
}
if(!strcmp(cmdtext, "/help", true))
{
SendClientMessage(playerid, LightBlue, "Checking");
return 1;
}
return 0;
}
If you want your own Wrong command message, replace return 0 with:
pawn Код:
return SendClientMessage(playerid,RED,"That command doesn't exist!");
Re: How o fix this error -
Peter_Corneile - 17.08.2009
Thankyou all for your help , i really appreciate it . Keep helping people like this