08.05.2011, 21:20
How to do so when someone comes into my server to write: [JOIN] Name has joined the server. and when he came out from the server to its written [LEFT] Name has lefted this server? Something. Thanks in advance!
// under OnPlayerConnect
new string[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
format(string,sizeof(string),"%s (%d) Has Joined The Server.",pname,playerid);
SendClientMessageToAll(grey,string);
//under OnPlayerDisconnect
new string[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
switch(reason)
{
case 0: format(string,sizeof(string),"%s (%d) Has Left The Server. (Timeout)",pname,playerid);
case 1: format(string,sizeof(string),"%s (%d) Has Left The Server. (Quit)",pname,playerid);
case 2: format(string,sizeof(string),"%s (%d) Has Left The Server. (Kicked)",pname,playerid);
case 3: format(string,sizeof(string),"%s (%d) Has Left The Server. (Banned)",pname,playerid);
SendClientMessageToAll(grey,string);
return 1;
}
pawn Код:
|
new
sStr[ 64 ], kName[ MAX_PLAYER_NAME ];
public OnPlayerConnect( playerid )
{
GetPlayerName( playerid, kName, sizeof( kName ) );
format( sStr, sizeof( sStr ), "%s has joined the server.", kName );
return SendClientMessageToAll( 0xFFF000AA, sStr ), true;
}
public OnPlayerDisconnect( playerid, reason )
{
GetPlayerName( playerid, kName, sizeof( kName ) );
switch( reason )
{
case 0: format( sStr, sizeof( sStr ), "%s left the server. (Timed out)", kName );
case 1: format( sStr, sizeof( sStr ), "%s left the server. (Leaving)", kName );
case 2: format( sStr, sizeof( sStr ), "%s left the server. (Kicked/Banned)", kName );
}
return SendClientMessageToAll( 0xFFF000AA, sStr ), true;
}