Little help with Pawn.CMD
#1

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!
Reply
#2

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

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

Reply
#4

Yes, it prints the commands I am entering
Reply
#5

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
Reply
#6

Works indeed. Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)