SA-MP Forums Archive
Little help with Pawn.CMD - 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: Little help with Pawn.CMD (/showthread.php?tid=658866)



Little help with Pawn.CMD - v1k1nG - 14.09.2018

Hey I was trying this command processor, but I've added this
PHP код:
public OnPlayerCommandPerformed(playeridcmd[], params[], resultflags){
    if(
P[playerid][Logged] == false)return 1;
    if(
P[playerid][IsSpawned] == false)return 1;
    if(
result == -1)  {
        
SendClientMessage(playerid0xff0000ff"*SERVER {ffffff}Unknown command. Please refer to /help");
        return 
0;
    }    
    return 
1;

and it isn't sending me a message about unkown cmds.
Thanks in advance!


Re: Little help with Pawn.CMD - Sithis - 14.09.2018

Have you verified the callback is being called at all? Check that out first by placing a print() call above the first if statement.


Re: Little help with Pawn.CMD - Undef1ned - 14.09.2018

PHP код:
public OnPlayerCommandPerformed(playeridcmd[], params[], resultflags)

    
printf("[CMD] %s"cmd); //you should check the console
    
if(!P[playerid][Logged]) return 1
    if(!
P[playerid][IsSpawned]) return 1;
    
    if(
result == -1)
    { 
        
SendClientMessage(playerid0xff0000ff"*SERVER {ffffff}Unknown command. Please refer to /help"); 
        return 
0
    }     
    return 
1




Re: Little help with Pawn.CMD - v1k1nG - 14.09.2018

Yes, it prints the commands I am entering


Re: Little help with Pawn.CMD - Undef1ned - 14.09.2018

PHP код:
public OnPlayerCommandReceived(playeridcmd[], params[], flags
{
    if(!
P[playerid][Logged] || !P[playerid][IsSpawned]) return 0;
    return 
1;
}
public 
OnPlayerCommandPerformed(playeridcmd[], params[], resultflags)

    
printf("[CMD] %s"cmd);
    if(
result == -1)
    { 
        
SendClientMessage(playerid0xff0000ff"*SERVER {ffffff}Unknown command. Please refer to /help"); 
        return 
0
    }     
    return 
1

EDIT: A mistake


Re: Little help with Pawn.CMD - v1k1nG - 14.09.2018

Works indeed. Thanks!