Admin duty script.
#1

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

Код:
if(strcmp(cmd, "/aduty", true) == 0)
{
    if(IsPlayerAdmin(playerid))
    {
        SetPlayerColor(giveplayerid, 0x00CA0000);
        return 1;
    }
}
Reply
#3

pawn Код:
CMD:aduty(playerid, params[])
{
SetPlayerColor(playerid, Your Color);
SetPlayerHealth(playerid, 100000);
SendClientMessage(playerid, Your Color,"You are Now on Admin Duty!");
return 1;
}
if need more advance.. then tell.
Reply
#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
#5

Quote:
Originally Posted by FalconX
Посмотреть сообщение
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
(66441) : error 010: invalid function or declaration
(66481) : error 017: undefined symbol "fCountDutyStatus"
Reply
#6

Quote:
Originally Posted by Misterflowers
Посмотреть сообщение
(66441) : error 010: invalid function or declaration
(66481) : error 017: undefined symbol "fCountDutyStatus"
Umm, sorry just replace this:-

pawn Код:
format( Fstring, sizeof( Fstring ), "Players on duty: %d", fCountDutyStatus );
with

pawn Код:
format( Fstring, sizeof( Fstring ), "Players on duty: %d", fCountDutyPlayers );
Reply
#7

Quote:
Originally Posted by FalconX
Посмотреть сообщение
Umm, sorry just replace this:-

pawn Код:
format( Fstring, sizeof( Fstring ), "Players on duty: %d", fCountDutyStatus );
with

pawn Код:
format( Fstring, sizeof( Fstring ), "Players on duty: %d", fCountDutyPlayers );
Thanks, but I got more one error.

error 010: invalid function or declaration
Reply
#8

Quote:
Originally Posted by Misterflowers
Посмотреть сообщение
Thanks, but I got more one error.

error 010: invalid function or declaration
Line?
Reply
#9

Help?
Reply
#10

Dude he meant just copy this line and paste it in your OnPlayerConnect and OnPlayerDisconnect :
pawn Код:
fCheckDutyStatus[ playerid ] = false;
Don't delete your OnPlayerConnect and OnPlayerDisconnect contents which you had earlier.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)