06.03.2013, 00:38
Hi Guys, this is my first tutorial and is about a message System, on player connect & Disconnect
Letґs GO!
1° In public OnPlayerConnect(playerid) paste this:
Explication Of some things:
GetPlayerName(playerid,Nombre,50); ---> This obtains the name of the player
format(Nombre,sizeof(Nombre),"{FFFFFF}*** {DF0101} %s {FFFFFF}Has joined the server!! .",Nombre); ---> The message that show to all the server
SendClientMessageToAll(0xffffffff,Nombre); ---> Send the message to all the server
__________________________________________________ ____________________________________
2° Go to: public OnPlayerDisconnect(playerid, reason)
Explications of some things:
switch(reason) ---> The reason For which the player went out the server
{
case 0: format(string,sizeof string,"%s Has left the serve. (Reason: Crash)",name);
case 1: format(string,sizeof string,"%s Has left the server. (Reason: For if same)",name);
case 2: format(string,sizeof string,"%s Has left the server. (Reason: Kick/Ban)",name);
}
For kick, Ban or Crash
And... is all, sorry is my first tutorial and im bad for this
Letґs GO!
1° In public OnPlayerConnect(playerid) paste this:
Code:
new Name[50] GetPlayerName(playerid,Nombre,50); format(Nombre,sizeof(Nombre),"{FFFFFF}*** {DF0101} %s {FFFFFF}Has joined the server!! .",Nombre); SendClientMessageToAll(0xffffffff,Nombre);
GetPlayerName(playerid,Nombre,50); ---> This obtains the name of the player
format(Nombre,sizeof(Nombre),"{FFFFFF}*** {DF0101} %s {FFFFFF}Has joined the server!! .",Nombre); ---> The message that show to all the server
SendClientMessageToAll(0xffffffff,Nombre); ---> Send the message to all the server
__________________________________________________ ____________________________________
2° Go to: public OnPlayerDisconnect(playerid, reason)
Code:
new string[64], name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,MAX_PLAYER_NAME); switch(reason) { case 0: format(string,sizeof string,"%s partiу del server. (Crash)",name); case 1: format(string,sizeof string,"%s partiу del server. (Salio)",name); case 2: format(string,sizeof string,"%s partiу del server. (Kick/Ban)",name); } SendClientMessageToAll(0xFFFFFFAA,string);
switch(reason) ---> The reason For which the player went out the server
{
case 0: format(string,sizeof string,"%s Has left the serve. (Reason: Crash)",name);
case 1: format(string,sizeof string,"%s Has left the server. (Reason: For if same)",name);
case 2: format(string,sizeof string,"%s Has left the server. (Reason: Kick/Ban)",name);
}
For kick, Ban or Crash
And... is all, sorry is my first tutorial and im bad for this