Admin duty script.
#4

Quote:
Originally Posted by Misterflowers
Посмотреть сообщение
Hey, I need admin duty script please.
/aduty and /aoffduty when you doing the command it's change your name to Green or something like that.
Not tested but I think this is what you want:-

pawn Код:
new bool:fCheckDutyStatus[ MAX_PLAYERS ]; // top

fCheckDutyStatus[ playerid ] = false; // OnPlayerConnect and OnPlayerDIsconnect

CMD:aduty( playerid, params[ ] )
{
    if( IsPlayerAdmin( playerid ) ) // if the player is admin, you can change this var to your own admin system
    {
        if( fCheckDutyStatus[ playerid ] ) // if he is on duty, he will be NOT in duty
        {
            fCheckDutyStatus[ playerid ] = false;
            SendClientMessage( playerid, -1, "SERVER: You are NOT in the duty." );
        }
        else // if he is not on duty, he gets on duty
        {
            fCheckDutyStatus[ playerid ] = true;
            SendClientMessage( playerid, -1, "SERVER: You are now in duty" );
        }
    }
    else // he is not admin
    {
        SendClientMessage( playerid, -1, "ERROR: you are not an admin." );
    }
    return 1;
}

CMD:adutycheck( playerid, params[ ] )
{
    new fCountDutyPlayers = 0, Fstring[ 35 ]; // new declared strings
    for( new f = 0; f < MAX_PLAYERS; f++ ) // looping to check who is on duty
    {
        if( IsPlayerConnected( f ) )
        {
            if( fCheckDutyStatus[ f ] ) // players those who have duty on status
            {
                fCountDutyPlayers++;
                if( fCountDutyPlayers == 0 ) return SendClientMessage( playerid, -1, "There is NO ONE on duty." );
                format( Fstring, sizeof( Fstring ), "Player %s is ON duty", fPlayerName( f ) );
                SendClientMessage( playerid, -1, Fstring );
            }
        }
    }
    format( Fstring, sizeof( Fstring ), "Players on duty: %d", fCountDutyStatus );
    SendClientMessage( playerid, -1, Fstring );
    return 1;
}

stock fPlayerName( playerid ) // stock for getting player names
{
    new FpName[ MAX_PLAYER_NAME ];
    GetPlayerName( playerid, FpName, sizeof( FpName ) );
    return FpName;
}
Hope this helps, note that it is not tested.
-FalconX
Reply


Messages In This Thread
Admin duty script. - by Misterflowers - 08.06.2012, 12:53
Re: Admin duty script. - by lewismichaelbbc - 08.06.2012, 12:56
Re: Admin duty script. - by Jarnu - 08.06.2012, 12:59
Re: Admin duty script. - by FalconX - 08.06.2012, 13:09
Re: Admin duty script. - by Misterflowers - 08.06.2012, 13:18
Re: Admin duty script. - by FalconX - 08.06.2012, 13:23
Re: Admin duty script. - by Misterflowers - 08.06.2012, 13:40
Re: Admin duty script. - by FalconX - 08.06.2012, 13:44
Re: Admin duty script. - by Misterflowers - 08.06.2012, 20:49
Re: Admin duty script. - by Faisal_khan - 09.06.2012, 17:54

Forum Jump:


Users browsing this thread: 2 Guest(s)