SA-MP Forums Archive
One problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: One problem (/showthread.php?tid=569493)



One problem - Tuntun - 31.03.2015

Код:
E:\ELRP\gamemodes\ELRP1.pwn(106775) : warning 235: public function lacks forward declaration (symbol "OnPlayerCommandPerformed")
my code:
Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) SendClientMessage(playerid, -1, "Server unkown command. Check '/help' to get commands help");
    return 1;
}



Re: One problem - Mya - 31.03.2015

Код:
forward OnPlayerCommandPerformed(playerid, cmdtext[], success);
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) SendClientMessage(playerid, -1, "Server unkown command. Check '/help' to get commands help");
    return 1;
}
use it


Respuesta: One problem - JuanStone - 31.03.2015

You should use y_commands or zcmd in order to use this callback, if you use a forward to resolve this error and does not use a command processor y_commands zcmd not will be called the callback.

PHP код:
#include <zcmd.inc>
//  OR
#include <YSI\y_commands> 



Re: One problem - Tuntun - 31.03.2015

I use the default command system.


Respuesta: One problem - JuanStone - 31.03.2015

delete that and add the following code.

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/mycommand"cmdtexttrue10) == 0)
    {
        
// Do something here
        
return 1;
    }
    return 
SendClientMessage(playerid, -1"Server unkown command. Check '/help' to get commands help");

Basically what you'd do would be to change the value of the last return in "OnPlayerCommandText" for your message.