Show commands typed by players to admins
#10

Quote:
Originally Posted by CaptainBoi
Посмотреть сообщение
PHP код:
enum PlayerInfo
{
     
bool:Listening
}
new 
pInfo[MAX_PLAYERS][PlayerInfo];
CMD:listen(playeridparams[])
{
    if(
pInfo[playerid][Listening] == false)
    {
        
pInfo[playerid][Listening] = true;
        
SendClientMessage(playerid, -1"You have started listening to commands.");
    }
    else
    {
        
pInfo[playerid][Listening] = false;
        
SendClientMessage(playerid, -1"You have stopped listening to commands.");
    }
    return 
1;
}
public 
OnPlayerCommandReceived(playeridcmdtext[])
{
    if (!
IsPlayerConnected2(playerid)) return 0;
    new 
cstring[100],playerids[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayeridssizeof(playerids));
    
format(cstringsizeof(cstring), "[cmd] [%s]: %s"playeridscmdtext);
    foreach(new 
iPlayer)
    {
        if(
adminvariable >= && Listen(i) == 1)
        {
            if(
adminvariable <= adminvariable)
            {
                  if(
!= playeridSendClientMessage(i, -1cstring);
            }
        }
    }
return 
1;
}
forward Listen(playerid);
public 
Listen(playerid)
{
    return 
pInfo[playerid][Listening];

here
And where have you defined adminvariable? Where is the explanation? Are you just posting code to gain reputation without even explaining it?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)