PHP код:
public OnPlayerDisconnect(playerid, reason)
{
PlayersOnline--;
SalvarDados(playerid);
//DOF2_Exit();
DOF2_Exit();
if(GetarDado(playerid, Admin) > 0)
{
format(String, sizeof(String), "~w~Admin ~g~%s ~r~Offline", Nome(playerid));
GameTextForAll(String, 1000, 1);
}
//new ipdop[50]; GetPlayerIp(playerid, ipdop, 50);
switch(reason)
{
case 0: format(gString, sizeof(gString), "[DISCONNECT]: %s saiu do servidor. [Problemas/Conexгo]", nome(playerid));
case 1: format(gString, sizeof(gString), "[DISCONNECT]: %s saiu do servidor. [Vontade Prуpria]", nome(playerid));
case 2: format(gString, sizeof(gString), "[DISCONNECT]: %s saiu do servidor. [Kickado/Banido]", nome(playerid));
}
SendClientMessageToAll(cinza, gString);
return 1;
}
PHP код:
stock SalvarDados(playerid)
{
new ip[25];
GetPlayerIp(playerid, ip, sizeof(ip));
format(StringContas, sizeof(StringContas), "LLADMIN/Contas/%s.txt", Nome(playerid));
DOF2_SetInt(StringContas, "Matou", PlayerDados[playerid][Matou]);
DOF2_SetInt(StringContas, "Morreu", PlayerDados[playerid][Morreu]);
DOF2_SetInt(StringContas, "Grana", GetPlayerMoney(playerid));
DOF2_SetInt(StringContas, "Score", GetPlayerScore(playerid));
DOF2_SetInt(StringContas, "Advertencias", PlayerDados[playerid][Advertencias]);
DOF2_SetInt(StringContas, "Preso", PlayerDados[playerid][Preso]);
DOF2_SetString(StringContas, "IP", ip);
new str[50];
format(str, 50, "LLADMIN/Admins/%s.sav", Nome(playerid));
if(PlayerDados[playerid][Vip] == false)
{
if(DOF2_IsSet("LLADMIN/Vips.vip", Nome(playerid)))
{
DOF2_Unset("LLADMIN/Vips.vip", Nome(playerid));
}
}
if(PlayerDados[playerid][Helper] == false)
{
if(DOF2_IsSet("LLADMIN/Helpers.hel", Nome(playerid)))
{
DOF2_Unset("LLADMIN/Helpers.hel", Nome(playerid));
}
}
if(PlayerDados[playerid][Vip] == true)
{
DOF2_SetBool(str, "Vip", true);
}
if(PlayerDados[playerid][Helper] == true)
{
DOF2_SetBool(str, "Helper", true);
}
if(PlayerDados[playerid][Admin] > 0)
{
format(StringContas, sizeof StringContas, "LLADMIN/Admins/%s.sav", Nome(playerid));
DOF2_SetInt(str, "Admin", PlayerDados[playerid][Admin]);
}
DOF2_SaveFile();
return 1;
}