Login Warning Message Code
#1

Hello guys, i want a pawno code that when someone log in my server will appear a message in chat that will say
"Playername has join the server" and when he log out it will say "Playername has left the server" .....how to do this
Reply
#2

OnPlayerConnect
pawn Код:
new str[256], pName[24], pRame[24];
    GetPlayerName(playerid, pName, 24);
    GetPlayerRame(playerid, pRame, 24);
    format(str, 256, "[JOIN] %s has joined the server.", pRame);
    SendClientMessage(i, COLOR_GREY,str);
And
OnPlayerDisconnect
pawn Код:
new pRame[24], pName[24];
    GetPlayerRame(playerid, pRame, 24);
    GetPlayerName(playerid, pName, 24);
    format(str, 256, "[LEFT] %s has left the server.", pRame);
    SendClientMessageToAll(COLOR_GREY,str);
Reply
#3

pawn Код:
public OnPlayerConnect(playerid)
{
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"%s has joined the server. Welcome!",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new
        string[64],
        name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    switch(reason)
    {
        case 0: format(string,sizeof string,"%s left the server. (Timed out)",name);
        case 1: format(string,sizeof string,"%s left the server. (Leaving)",name);
        case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
    }
    SendClientMessageToAll(0xFFFFFFAA,string);
    return 1;
}
OnPlayerConnect
OnPlayerDisconnect
Reply
#4

PHP код:
public OnPlayerConnect(playerdid)
{
    new 
name[MAX_PLAYER_NAME], string[128];
    
GetPlayerRPName(playeridnamesizeof(name));
    
format(stringsizeof(string), "%s has joined the server!"name);
    
SendClientMessageToAll(-1string);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)