public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], file[256], Float:X, Float:Y, Float:Z, Float:Angle;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(gPlayerLogged[playerid] == 1)
{
dini_IntSet(file, "Skin", GetPlayerSkin(playerid));
dini_IntSet(file, "Cash", GetPlayerMoney(playerid));
dini_FloatSet(file, "PosX", X);
dini_FloatSet(file, "PosY", Y);
dini_FloatSet(file, "PosZ", Z);
dini_IntSet(file, "Facing Angle", floatround(GetPlayerFacingAngle(playerid, Angle), floatround_ceil));
}
gPlayerLogged[playerid] = 0;
new String_Leaving[64], Name_Left[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name_Left,MAX_PLAYER_NAME);
switch(reason)
{
case 0: format(String_Leaving,sizeof String_Leaving,"[SERVER]: %s left the server. (Timed out)",Name_Left);
case 1: format(String_Leaving,sizeof String_Leaving,"[SERVER]: %s left the server. (Leaving)",Name_Left);
case 2: format(String_Leaving,sizeof String_Leaving,"[SERVER]: %s left the server. (Kicked/Banned)",Name_Left);
}
SendClientMessageToAll(COLOR_YELLOW,String_Leaving);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], file[256], Float:X, Float:Y, Float:Z, Float:Angle;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerName(playerid, name, sizeof(name));
GetPlayerFacingAngle(playerid, Angle);
format(file, sizeof(file), SERVER_USER_FILE, name);
if(gPlayerLogged[playerid] == 1)
{
dini_IntSet(file, "Skin", GetPlayerSkin(playerid));
dini_IntSet(file, "Cash", GetPlayerMoney(playerid));
dini_FloatSet(file, "PosX", X);
dini_FloatSet(file, "PosY", Y);
dini_FloatSet(file, "PosZ", Z);
dini_IntSet(file, "Facing Angle", floatround(Angle, floatround_ceil));
}
gPlayerLogged[playerid] = 0;
new String_Leaving[64], Name_Left[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name_Left,MAX_PLAYER_NAME);
switch(reason)
{
case 0: format(String_Leaving,sizeof String_Leaving,"[SERVER]: %s left the server. (Timed out)",Name_Left);
case 1: format(String_Leaving,sizeof String_Leaving,"[SERVER]: %s left the server. (Leaving)",Name_Left);
case 2: format(String_Leaving,sizeof String_Leaving,"[SERVER]: %s left the server. (Kicked/Banned)",Name_Left);
}
SendClientMessageToAll(COLOR_YELLOW,String_Leaving);
return 1;
}
Just a note, facing angle is a float and you don't need to round it.
|