Join/Leave message for admins
#1

How can you create a Join/Leave message, I checked Wiki, but my Pawno is crashing from the code.

Do you got maybe one for me

Or do you know what i need to do
Reply
#2

pawn Код:
public OnPlayerConnect(playerid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerAdmin(i)) // or you can replace with your admin enum
        {
            new string[64], name[MAX_PLAYER_NAME];

            GetPlayerName(playerid, name, MAX_PLAYER_NAME);
            format(string, sizeof(string), "%s joined the server.", name);
            SendClientMessage(i, -1, string);
        }
    }
    return 1;
}
Reply
#3

Above one is connect message!
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
        switch (reason) {
            case 0:
            {
                format(str, sizeof(str), "%s (%d) has left the server ~r~[Timeout]", PlayerName, playerid);
            }
            case 1:
            {
                format(str, sizeof(str), "%s (%d) has left the server ~r~[Leaving]", PlayerName, playerid);
            }
            case 2:
            {
                format(str, sizeof(str), "%s (%d) has left the server ~r~[Kicked or Banned]", PlayerName, playerid);
            }
                        SendClientMessageToAll(-1, str);
        }
                return 1;
}
And this is your leave message
Reply
#4

pawn Код:
stock SendAdminMessage(message[])
{
    foreach(Player, i)
    {
        if(GetPVarInt(i,"Level" ) < 1)
        {
            SendClientMessage(i,-1,message);
        }
        else return 0;
    }
    return 1;
}  


example :
new string[64], name[MAX_PLAYER_NAME];

            GetPlayerName(playerid, name, MAX_PLAYER_NAME);
            format(string, sizeof(string), "%s joined the server.", name);
            SendClientMessage(i, -1, string);
            SendAdminMessage(string);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)