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;
}
//OnDialogResponse
if(!respond) OnPlayerCommandText(playerid,"/q");
you cant close the players client... the max you can do is kick the player and force him to quit.
|
//top of the script
new bool:Quited[MAX_PLAYERS];
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:
{
if(Quited[playerid] == true)
{
format(string,sizeof string,"%s left the server. (Leaving)",name);
}
else format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
}
}
SendClientMessageToAll(0xFFFFFFAA,string);
return 1;
}
//OnDialogResponse
if(!reason)
{
Quited[playerid] = true;
Kick(playerid);
return 1;
}