stock salvardados(playerid)
{
GetPlayerName(playerid,nick,24);
format(pfile,sizeof pfile,contas,nick);
DOF2_SetInt(pfile,"dinheiro",GetPVarInt(playerid,"dinheiro"));
DOF2_SetInt(pfile,"level",GetPVarInt(playerid,"level"));
DOF2_SetInt(pfile,"matou",GetPVarInt(playerid,"matou"));
DOF2_SetInt(pfile,"morreu",GetPVarInt(playerid,"morreu"));
DOF2_SetInt(pfile,"bombas",GetPVarInt(playerid,"bombas"));
DOF2_SetInt(pfile,"adminlevel",GetPVarInt(playerid,"adminlevel"));
DOF2_SaveFile();
return 1;
}
stock carregardados(playerid)
{
GetPlayerName(playerid,nick,24);
format(pfile,sizeof pfile,contas,nick);
SetPVarInt(playerid,"dinheiro",DOF2_GetInt(pfile,"dinheiro"));
SetPVarInt(playerid,"level",DOF2_GetInt(pfile,"level"));
SetPVarInt(playerid,"matou",DOF2_GetInt(pfile,"matou"));
SetPVarInt(playerid,"morreu",DOF2_GetInt(pfile,"morreu"));
SetPVarInt(playerid,"bombas",DOF2_GetInt(pfile,"bombas"));
SetPVarInt(playerid,"adminlevel",DOF2_GetInt(pfile,"adminlevel"));
return 1;
}
public OnPlayerDisconnect(...)
{
salvardados(playerid);
return 1;
}
stock salvardados(playerid)
{
GetPlayerName(playerid,nick,24);
format(pfile,sizeof pfile,contas,nick);
DOF2_SetInt(pfile,"dinheiro",GetPlayerMoney(playerid));
DOF2_SetInt(pfile,"level",GetPVarInt(playerid,"level"));
DOF2_SetInt(pfile,"matou",GetPVarInt(playerid,"matou"));
DOF2_SetInt(pfile,"morreu",GetPVarInt(playerid,"morreu"));
DOF2_SetInt(pfile,"bombas",GetPVarInt(playerid,"bombas"));
DOF2_SetInt(pfile,"adminlevel",info[playerid][pAdmin]);
DOF2_SaveFile();
return 1;
}
stock carregardados(playerid)
{
GetPlayerName(playerid,nick,24);
format(pfile,sizeof pfile,contas,nick);
SetPVarInt(playerid,"dinheiro",DOF2_GetInt(pfile,"dinheiro"));
SetPVarInt(playerid,"level",DOF2_GetInt(pfile,"level"));
SetPVarInt(playerid,"matou",DOF2_GetInt(pfile,"matou"));
SetPVarInt(playerid,"morreu",DOF2_GetInt(pfile,"morreu"));
SetPVarInt(playerid,"bombas",DOF2_GetInt(pfile,"bombas"));
SetPVarInt(playerid,"adminlevel",DOF2_GetInt(pfile,"adminlevel"));
SetPlayerScore(playerid,GetPVarInt(playerid,"level"));
GivePlayerMoney(playerid,GetPVarInt(playerid,"dinheiro"));
info[playerid][pAdmin] = DOF2_GetInt(pfile,"adminlevel");
return 1;
}
public OnGameModeExit()
{
for(new i = 0; i < MAX_PLAYERS; ++i) { salvardados(i); }
DOF2_Exit();
return 1;
}
CMD:gmx(playerid,params[])
{
if(info[playerid][pAdmin] >= 1)
{
format(string_,51,"O administrador %s deu GMX",nome(playerid));
SendClientMessageToAll(-1,string_);
SendRconCommand("gmx");
}
else SendClientMessage(playerid,-1,NAOADM);
return 1;
}
CMD:gmx(playerid,params[])
{
if(info[playerid][pAdmin] >= 1)
{
format(string_,51,"O administrador %s deu GMX",nome(playerid));
SendClientMessageToAll(-1,string_);
SendRconCommand("gmx");
salvardados(playerid);//aquiiiiiiiiiiiiiiiiiiii pra garantir
}
else SendClientMessage(playerid,-1,NAOADM);
return 1;
}
Teste aqui
pawn Код:
Outra coisa coloque na Callback OnPlayerDisconnect(playerid).... { salvardados(playerid);/aquiiiiiiiiiiiiii nгo em OnGameModeExit return 1; } E testa vlw |
So uma observaзгo quando da gmx o Servidor volta a primeira configuraзгo feita manualmente.
por isso volta tudo como estava! |