SA-MP Forums Archive
OnPlayerCommandPerformed question - 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: OnPlayerCommandPerformed question (/showthread.php?tid=619065)



OnPlayerCommandPerformed question - NeXoR - 13.10.2016

Hey, if for example, under OnPlayerCommandReceived, I do something like this:

PHP код:
public OnPlayerCommandReceived(playeridcmdtext[])
{
    if(!
PlayerInfo[playerid][pLoggedIn])
    {
        
SendClientMessage(playeridCOLOR_RED"You have to login in order to perform commands.");
        return 
0;
    }
    return 
1;

Would the "return 0" call the function OnPlayerCommandPerformed ?


Re: OnPlayerCommandPerformed question - Gotham - 13.10.2016

pLoggedIn is a bool make it
PHP код:
if(PlayerInfo[playerid][pLoggedIn] == false)
{
    
SendClientMessage(playeridCOLOR_RED"You have to login in order to perform commands.");
    return 
0;
}
return 
1



Re: OnPlayerCommandPerformed question - NeXoR - 13.10.2016

Quote:
Originally Posted by Gotham
Посмотреть сообщение
pLoggedIn is a bool make it
PHP код:
if(PlayerInfo[playerid][pLoggedIn] == false)
{
    
SendClientMessage(playeridCOLOR_RED"You have to login in order to perform commands.");
    return 
0;
}
return 
1
I pressume you didn't understand the question


Re: OnPlayerCommandPerformed question - Gotham - 13.10.2016

I think return 0; would do it :P


Re: OnPlayerCommandPerformed question - AndySedeyn - 13.10.2016

Quote:
Originally Posted by Gotham
Посмотреть сообщение
pLoggedIn is a bool make it
PHP код:
if(PlayerInfo[playerid][pLoggedIn] == false)
{
    
SendClientMessage(playeridCOLOR_RED"You have to login in order to perform commands.");
    return 
0;
}
return 
1
Same thing.
O.T.: returning 0 in OnPlayerCommandReceived causes the command to not perform. So, logically that would result in the callback not being called.