Join and Leave Messages [My First make]
#1

Joining Message:

Код:
public OnPlayerConnect(playerid)
{
    new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s has joined the server", pname);
    SendClientMessageToAll(0xAAAAAAAA, string);
    return 1;
}
Now join text done.


Leave Message:

Код:
public OnPlayerDisconnect(playerid, reason)
{
    new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname)); 
    switch(reason)
    {
        case 0: format(string, sizeof(string), "%s has left the server. (Lost Connection)", pname);
        case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", pname);
        case 2: format(string, sizeof(string), "%s has left the server. (Kicked)", pname);
    } 
    SendClientMessageToAll(0xAAAAAAAA, string);
    return 1;
}
If you want to make 1 more case you can do like this , EXAMPLE:

Код:
public OnPlayerDisconnect(playerid, reason)
{
    new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname)); 
    switch(reason)
    {
        case 0: format(string, sizeof(string), "%s has left the server. (Lost Connection)", pname);
        case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", pname);
        case 2: format(string, sizeof(string), "%s has left the server. (Kicked)", pname);
        case 3: format(string, sizeof(string), "%s has left the server. (Relogging)", pname);
    } 
    SendClientMessageToAll(0xAAAAAAAA, string);
    return 1;
}
Hope it worked
Reply


Messages In This Thread
Join and Leave Messages [My First make] - by kosa451 - 26.05.2013, 19:16
Re: Join and Leave Messages [My First make] - by jordy.kiesebrink - 26.05.2013, 19:35
Re: Join and Leave Messages [My First make] - by PrivatioBoni - 26.05.2013, 19:40
Re: Join and Leave Messages [My First make] - by jordy.kiesebrink - 26.05.2013, 19:48
Re: Join and Leave Messages [My First make] - by DerickClark - 26.05.2013, 20:25
Re: Join and Leave Messages [My First make] - by Cameltoe - 26.05.2013, 20:40

Forum Jump:


Users browsing this thread: 4 Guest(s)