C:\DOCUME~1\SKELLY~1\Desktop\GTASER~1\GAMEMO~1\Untitled.pwn(141) : warning 209: function "JB_OnPlayerCommandText" should return a value
C:\DOCUME~1\SKELLY~1\Desktop\GTASER~1\GAMEMO~1\Untitled.pwn(141) : error 010: invalid function or declaration
C:\DOCUME~1\SKELLY~1\Desktop\GTASER~1\GAMEMO~1\Untitled.pwn(143) : error 021: symbol already defined: "JB_SetPlayerHealth"
C:\DOCUME~1\SKELLY~1\Desktop\GTASER~1\GAMEMO~1\Untitled.pwn(144) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
3 Errors.
public OnPlayerCommandText(playerid, cmdtext[])
if(!strcmp(cmdtext, "/help", true))
{
TogglePlayerControllable(playerid,0);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "What do you need help, with?", "Commands\nLocations\nJobs", "OK", "Cancel");
TogglePlayerControllable(playerid,1);
return 1;
}
if(!strcmp(cmdtext, "/suicide", true))
{
SetPlayerHealth(playerid, 0);
return 1;
}
Originally Posted by [ĦŁ₣
ЉǾǖŦĦЗŁΛẄ ]
A Callback must have it's own set of brackets: Callback() { Statements() { Functions() } return } Then add the return at the bottom, for commandtext it should be 'return 0;' so it returns an error if a player enters an invalid command, or if you want to make your own error then instead of the '0' in 'return 0;' add a SendClientMessage 'return SendClientMessage(...);' Hope this helped you :P |
Originally Posted by [ĦŁ₣
ЉǾǖŦĦЗŁΛẄ ]
public OnPlayerCommandText(playerid, cmdtext[]) is a callback therefore needs braces: public OnPlayerCommandText(playerid, cmdtext[]) { code... return 0; } there ![]() |