Dont show admins connecting
#1

How to stop when an admin logs in it doesnt say player blaa has joined the server etc, but all normal players still are shown connecting just not admins.

All help is appreciated

admins are defined like
pawn Код:
if(APlayerData[playerid][PlayerLevel] == 1) return SendClientMessage(playerid,0xff0000ff,"You aren't an admin");

on player connect is
pawn Код:
public OnPlayerConnect(playerid)
{
    // Always allow NPC's to login without password or account
    if (IsPlayerNPC(playerid))
        return 1;
     players_connected++;
     TextDrawShowForPlayer(playerid,Textdraw0);

     VisableDuty[playerid] = 0;
     SendClientMessage(playerid, -1, "{FFFF00}Try Out The New Classes: {B88A00}Paramedic {F06695}Farmer {33CCFF}Sailor {00FFFF}Train Driver, {CCFF33}Taxi Driver");
     SendClientMessage(playerid, -1, "{FFFF00}Want To No About The Server Type {00ff00}/Info or {FF0000}/Changelog");
     SendClientMessage(playerid, -1, "{FFFF00}Admins Should use {ff0000}/achangelog {FFFF00} To see what has changed for them");
     RemoveBuildingForPlayer(playerid, 8229, 0.0, 0.0, 0.0, 6000.0);
     RemoveBuildingForPlayer(playerid, 11014, 0.0, 0.0, 0.0, 6000.0);
     RemoveBuildingForPlayer(playerid, 11372, 0.0, 0.0, 0.0, 6000.0);
    ///////////////////montgomary garage...////////////
     RemoveBuildingForPlayer(playerid, 13440, 1282.2422, 369.1406, 28.7578, 0.25);
     RemoveBuildingForPlayer(playerid, 1308, 1334.4531, 474.0938, 19.2344, 0.25);
     RemoveBuildingForPlayer(playerid, 1308, 1280.1719, 485.9531, 19.2422, 0.25);
     RemoveBuildingForPlayer(playerid, 1308, 1370.5156, 457.4766, 19.1406, 0.25);
    /////////////////end//////////////////////////////

    // 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(playerid, Name, sizeof(Name));
    // Also store this name for the player
    GetPlayerName(playerid, APlayerData[playerid][PlayerName], 24);
   
    // Send a message to all players to let them know somebody else joined the server
    format(NewPlayerMsg, 128, TXT_PlayerJoinedServer, Name, playerid);
    SendClientMessageToAll(0xFFFFFFFF, NewPlayerMsg);

    // 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(playerid, DialogLogin, DIALOG_STYLE_INPUT, TXT_DialogLoginTitle, TXT_DialogLoginMsg, TXT_DialogLoginButton1, TXT_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(playerid, DialogRegister, DIALOG_STYLE_INPUT, TXT_DialogRegisterTitle, TXT_DialogRegisterMsg, TXT_DialogRegisterButton1, TXT_DialogButtonCancel);

    // The houses have been loaded but not the cars, so load all vehicles assigned to the player's houses
    for (new HouseSlot; HouseSlot < MAX_HOUSESPERPLAYER; HouseSlot++)
    {
        // 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(HouseID, true); // Load the cars of the house
    }

    // Speedometer setup
    Speedometer_Setup(playerid);

    // MissionText TextDraw setup
    APlayerData[playerid][MissionText] = TextDrawCreate(320.0, 430.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

    // Display a message if the player hasn't accepted the rules yet
    if (APlayerData[playerid][RulesRead] == false)
        SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You haven't accepted the {FFFF00}/rules{FF0000} yet");

    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 TotalBanTime, Days, Hours, Minutes, Seconds, Msg[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(playerid, 0xFFFFFFFF, TXT_StillBanned);
    format(Msg, 128, TXT_BannedDuration, Days, Hours, Minutes, Seconds);
    SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
Reply
#2

thats should work.

PHP код:
public OnPlayerConnect(playerid)
{
    
// Always allow NPC's to login without password or account
    
if (IsPlayerNPC(playerid))
        return 
1;
     
players_connected++;
     
TextDrawShowForPlayer(playerid,Textdraw0);
     
VisableDuty[playerid] = 0;
     
SendClientMessage(playerid, -1"{FFFF00}Try Out The New Classes: {B88A00}Paramedic {F06695}Farmer {33CCFF}Sailor {00FFFF}Train Driver, {CCFF33}Taxi Driver");
     
SendClientMessage(playerid, -1"{FFFF00}Want To No About The Server Type {00ff00}/Info or {FF0000}/Changelog");
     
SendClientMessage(playerid, -1"{FFFF00}Admins Should use {ff0000}/achangelog {FFFF00} To see what has changed for them");
     
RemoveBuildingForPlayer(playerid82290.00.00.06000.0);
     
RemoveBuildingForPlayer(playerid110140.00.00.06000.0);
     
RemoveBuildingForPlayer(playerid113720.00.00.06000.0);
    
///////////////////montgomary garage...////////////
     
RemoveBuildingForPlayer(playerid134401282.2422369.140628.75780.25);
     
RemoveBuildingForPlayer(playerid13081334.4531474.093819.23440.25);
     
RemoveBuildingForPlayer(playerid13081280.1719485.953119.24220.25);
     
RemoveBuildingForPlayer(playerid13081370.5156457.476619.14060.25);
    
/////////////////end//////////////////////////////
    // 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
    
if(APlayerData[playerid][PlayerLevel] == 0)
    {
        
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
    // Display a message if the player hasn't accepted the rules yet
    
if (APlayerData[playerid][RulesRead] == false)
        
SendClientMessage(playerid0xFFFFFFFF"{FF0000}You haven't accepted the {FFFF00}/rules{FF0000} yet");
    return 
1;

Reply
#3

still shows the player has joined even if admin
Reply
#4

Try this
pawn Код:
public OnPlayerConnect(playerid)
{
    // Always allow NPC's to login without password or account
    if (IsPlayerNPC(playerid))
        return 1;
     players_connected++;
     TextDrawShowForPlayer(playerid,Textdraw0);

     VisableDuty[playerid] = 0;
     SendClientMessage(playerid, -1, "{FFFF00}Try Out The New Classes: {B88A00}Paramedic {F06695}Farmer {33CCFF}Sailor {00FFFF}Train Driver, {CCFF33}Taxi Driver");
     SendClientMessage(playerid, -1, "{FFFF00}Want To No About The Server Type {00ff00}/Info or {FF0000}/Changelog");
     SendClientMessage(playerid, -1, "{FFFF00}Admins Should use {ff0000}/achangelog {FFFF00} To see what has changed for them");
     RemoveBuildingForPlayer(playerid, 8229, 0.0, 0.0, 0.0, 6000.0);
     RemoveBuildingForPlayer(playerid, 11014, 0.0, 0.0, 0.0, 6000.0);
     RemoveBuildingForPlayer(playerid, 11372, 0.0, 0.0, 0.0, 6000.0);
    ///////////////////montgomary garage...////////////
     RemoveBuildingForPlayer(playerid, 13440, 1282.2422, 369.1406, 28.7578, 0.25);
     RemoveBuildingForPlayer(playerid, 1308, 1334.4531, 474.0938, 19.2344, 0.25);
     RemoveBuildingForPlayer(playerid, 1308, 1280.1719, 485.9531, 19.2422, 0.25);
     RemoveBuildingForPlayer(playerid, 1308, 1370.5156, 457.4766, 19.1406, 0.25);
    /////////////////end//////////////////////////////

    // 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(playerid, Name, sizeof(Name));
    // Also store this name for the player
    GetPlayerName(playerid, APlayerData[playerid][PlayerName], 24);
   
    // Send a message to all players to let them know somebody else joined the server
    if(APlayerData[playerid][PlayerLevel] >= 1)
    {
   
    }
    else
    {
           format(NewPlayerMsg, 128, TXT_PlayerJoinedServer, Name, playerid);
           SendClientMessageToAll(0xFFFFFFFF, NewPlayerMsg);
    }

    // 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(playerid, DialogLogin, DIALOG_STYLE_INPUT, TXT_DialogLoginTitle, TXT_DialogLoginMsg, TXT_DialogLoginButton1, TXT_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(playerid, DialogRegister, DIALOG_STYLE_INPUT, TXT_DialogRegisterTitle, TXT_DialogRegisterMsg, TXT_DialogRegisterButton1, TXT_DialogButtonCancel);

    // The houses have been loaded but not the cars, so load all vehicles assigned to the player's houses
    for (new HouseSlot; HouseSlot < MAX_HOUSESPERPLAYER; HouseSlot++)
    {
        // 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(HouseID, true); // Load the cars of the house
    }

    // Speedometer setup
    Speedometer_Setup(playerid);

    // MissionText TextDraw setup
    APlayerData[playerid][MissionText] = TextDrawCreate(320.0, 430.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

    // Display a message if the player hasn't accepted the rules yet
    if (APlayerData[playerid][RulesRead] == false)
        SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You haven't accepted the {FFFF00}/rules{FF0000} yet");

    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 TotalBanTime, Days, Hours, Minutes, Seconds, Msg[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(playerid, 0xFFFFFFFF, TXT_StillBanned);
    format(Msg, 128, TXT_BannedDuration, Days, Hours, Minutes, Seconds);
    SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
Reply
#5

no still shows them joining
Reply
#6

You need to load the player's data before we can use the admin variable you mentioned. Once you load the data, you will want to look for this code in your OnPlayerConnect callback:

pawn Код:
format(NewPlayerMsg, 128, TXT_PlayerJoinedServer, Name, playerid);
SendClientMessageToAll(0xFFFFFFFF, NewPlayerMsg);
So again, once you have loaded your player's data, we can use the admin variable. Let's modify the code from above and add an if-statement to determine if they are NOT an administrator.

pawn Код:
if(APlayerData[playerid][PlayerLevel] < 1)
{
   format(NewPlayerMsg, 128, TXT_PlayerJoinedServer, Name, playerid);
   SendClientMessageToAll(0xFFFFFFFF, NewPlayerMsg);
}
So you can replace the code we originally searched for with that new one.

Again, I will repeat myself for the third time. YOU NEED TO LEAD PLAYER DATA BEFORE DOING THIS CHECK. If you don't, it won't work.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)