Admin On Duty CMD (really need help!)
#1

Hey,

Im wanted to know if its possible to make a cmd to make admin on duty
heres what I mean:

on my server when someone joins it says : Player (id X) has joined the Server
but when its a admin joining I wanted for it not to show!
only when a admin makes the on duty cmd its shows Admin Player (id X) has joined the Server
if you need any codes I can give it to you guys PLZ help me!
Reply
#2

Give me the variable of the adminlevel and the script for joining in a [code]
Reply
#3

I think this is the code you need!

PHP код:
public OnPlayerConnect(playerid)
{
    
// Always allow NPC's to login without password or account
    
if (IsPlayerNPC(playerid))
        return 
1;
    
// Setup local variables
    
new Name[MAX_PLAYER_NAME], NewPlayerMsg[128], HouseID;
    
// Setup a PVar to allow cross-script money-transfers (only from filterscript to this mainscript) and scorepoints
    
SetPVarInt(playerid"PVarMoney"0);
    
SetPVarInt(playerid"PVarScore"0);
    
// Get the playername
    
GetPlayerName(playeridNamesizeof(Name));
    
// Also store this name for the player
    
GetPlayerName(playeridAPlayerData[playerid][PlayerName], 24);
    
// Send a message to all players to let them know somebody else joined the server
    
format(NewPlayerMsg128TXT_PlayerJoinedServerNameplayerid);
    
SendClientMessageToAll(0xFFFFFFFFNewPlayerMsg);
    
// Try to load the player's datafile ("PlayerFile_Load" returns "1" is the file has been read, "0" when the file cannot be read)
    
if (PlayerFile_Load(playerid) == 1)
    {
        
// Check if the player is still banned
        
if (APlayerData[playerid][BanTime] < gettime()) // Player ban-time is passed
            
ShowPlayerDialog(playeridDialogLoginDIALOG_STYLE_INPUTTXT_DialogLoginTitleTXT_DialogLoginMsgTXT_DialogLoginButton1TXT_DialogButtonCancel);
        else 
// Player is still banned
        
{
            
ShowRemainingBanTime(playerid); // Show the remaining ban-time to the player is days, hours, minutes, seconds
            
Kick(playerid); // Kick the player
        
}
    }
    else
        
ShowPlayerDialog(playeridDialogRegisterDIALOG_STYLE_INPUTTXT_DialogRegisterTitleTXT_DialogRegisterMsgTXT_DialogRegisterButton1TXT_DialogButtonCancel);
    
// The houses have been loaded but not the cars, so load all vehicles assigned to the player's houses
    
for (new HouseSlotHouseSlot MAX_HOUSESPERPLAYERHouseSlot++)
    {
        
// Get the HouseID from this slot
        
HouseID APlayerData[playerid][Houses][HouseSlot];
        
// Check if there is a house in this slot
        
if (HouseID != 0)
            
HouseFile_Load(HouseIDtrue); // Load the cars of the house
    
}
    
// Speedometer setup
    
Speedometer_Setup(playerid);
    
// MissionText TextDraw setup
    
APlayerData[playerid][MissionText] = TextDrawCreate(320.0430.0" "); // Setup the missiontext at the bottom of the screen
    
TextDrawAlignment(APlayerData[playerid][MissionText], 2); // Align the missiontext to the center
    
TextDrawUseBox(APlayerData[playerid][MissionText], 1); // Set the missiontext to display inside a box
    
TextDrawBoxColor(APlayerData[playerid][MissionText], 0x00000066); // Set the box color of the missiontext
    
return 1;
}
// This function shows the player how long his ban still is when he tries to login (in days, hours, minutes, seconds)
ShowRemainingBanTime(playerid)
{
    
// Setup local variables
    
new TotalBanTimeDaysHoursMinutesSecondsMsg[128];
    
// Get the total ban-time
    
TotalBanTime APlayerData[playerid][BanTime] - gettime();
    
// Calculate days
    
if (TotalBanTime >= 86400)
    {
        
Days TotalBanTime 86400;
        
TotalBanTime TotalBanTime - (Days 86400);
    }
    
// Calculate hours
    
if (TotalBanTime >= 3600)
    {
        
Hours TotalBanTime 3600;
        
TotalBanTime TotalBanTime - (Hours 3600);
    }
    
// Calculate minutes
    
if (TotalBanTime >= 60)
    {
        
Minutes TotalBanTime 60;
        
TotalBanTime TotalBanTime - (Minutes 60);
    }
    
// Calculate seconds
    
Seconds TotalBanTime;
    
// Display the remaining ban-time for this player
    
SendClientMessage(playerid0xFFFFFFFFTXT_StillBanned);
    
format(Msg128TXT_BannedDurationDaysHoursMinutesSeconds);
    
SendClientMessage(playerid0xFFFFFFFFMsg);

and the variable
PHP код:
[Level
Reply
#4

pawn Код:
// Send a message to all players to let them know an admin joined the server
    if (APlayerData[playerid][Level] > 1)
    {
    format(AdminJMsg, 128, TXT_PlayerJoinedServer, Name, playerid);
    SendClientMessageToAll(0xFFFFFFFF, AdminJMsg);
    }

Under
pawn Код:
if (PlayerFile_Load(playerid) == 1)
If i'm right.

And just create
pawn Код:
AdminJMsg
As NewPlayerMsg
Reply
#5

Thx
but I wanted to let the admin join the server without letting others know (Resuming: Doesnt show the Admin Player has joined the server)!
and only when admin types cmd ex: /duty (Then it shows Admin Player has joined the server)!
Reply
#6

Then give me the /aduty command and delete this
pawn Код:
if (APlayerData[playerid][Level] > 1)
    {
    format(AdminJMsg, 128, TXT_PlayerJoinedServer, Name, playerid);
    SendClientMessageToAll(0xFFFFFFFF, AdminJMsg);
    }
Under
pawn Код:
if (PlayerFile_Load(playerid) == 1)
As soon I get your aduty command I can make it.
Reply
#7

PHP код:
// This commands allows the admin to see all admin commands!
COMMAND:aduty(playerid,params[]) {
        
// Setup local variables
    
new NewPlayerMsg[128], Name[MAX_PLAYER_NAME];
        
// Check to see if player level is more than 1
        
if (APlayerData[playerid][Level] >= 1)
    {
        
format(NewPlayerMsg128, {FFFF00}Admin {006600}%s{FFFF00} (id %iHas joined the ServerNameplayerid);
        
SendClientMessageToAll(0xFFFF00AANewPlayerMsg);
    }
    return 
1;

This is the code for the /aduty I made
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)