08.06.2012, 13:09
Quote:
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. |
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;
}
-FalconX