SA-MP Forums Archive
/offduty for /admins - 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: /offduty for /admins (/showthread.php?tid=308085)



/offduty for /admins - SomebodyAndMe - 02.01.2012

Heey guys,

I need some help.
I'm trying to make /offduty for admins so when u go /offduty your name won't show up in /admins

I know I need a variable but I don't know how to use it..

At the top of my script there is:
pawn Код:
new offduty[MAX_PLAYERS];
My /admins command:

pawn Код:
COMMAND:admins(playerid, params[])
{
    // Setup local variables
    new AdminList[500], Name[24];

    // Send the command to all admins so they can see it
    SendAdminText(playerid, "/admins", params);

    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true)
    {
        // Scan through all players
        for (new i; i < MAX_PLAYERS; i++)
        {
            // Check if this player is connected
            if (IsPlayerConnected(i))
            {
                // Get the name of the player
                GetPlayerName(i, Name, sizeof(Name));

                // Check if this player is an RCON admin
                if (IsPlayerAdmin(i))
                {
                    // Add all admin players to the list
                    format(AdminList, 500, "%s%s: %s (id: %i), admin-level: %i (RCON admin)\n", AdminList, AdminLevelName[APlayerData[i][PlayerLevel]], Name, i, APlayerData[i][PlayerLevel]); // Add the name of the admin-player to the list
                    // Re-start the for loop (skipping the remaining code for this iteration)
                    continue;
                }

                //Check if that player is an admin (using the PlayerLevel)
                if (APlayerData[i][PlayerLevel] > 2)
                {
                    // Add all admin players to the list
                    format(AdminList, 500, "%s%s: %s (id: %i), admin-level: %i\n", AdminList, AdminLevelName[APlayerData[i][PlayerLevel]], Name, i, APlayerData[i][PlayerLevel]); // Add the name of the admin-player to the list
                }
            }
        }

        // Check if there were admin-names added to the list
        if (strlen(AdminList) > 0)
            ShowPlayerDialog(playerid, DialogNoResponse, DIALOG_STYLE_LIST, "Online admins:", AdminList, "OK", "Cancel");
        else
            SendClientMessage(playerid, 0xFF0000FF, "No admin online"); // No admins are online
    }
    else
        return 0;

    // Let the server know that this was a valid command
    return 1;
}
So how do i put that in my /admins script?
ALso, if you give the new command, explain also how to, so i can do it myself in the future.

Thanks, Kevin


Re: /offduty for /admins - silvan - 02.01.2012

pawn Код:
if(offduty(i))
{
// Stuff if he's ON DUTY
}