23.05.2011, 16:40
pawn Код:
public OnPlayerConnect( playerid )
{
Carregar(playerid);
return true;
}
public OnPlayerDisconnect( playerid, reason )
{
Salvar(playerid);
return 1;
}
stock Carregar(playerid)
{
new save[37],na[MAX_PLAYER_NAME];
GetPlayerName(playerid,na,sizeof(na));
format(save,sizeof(save),"Contas/%s.txt",na);
if(fexist(save))
{
Info[playerid][Admin] = dini_Int(save,"Administrador");
Info[playerid][Level] = dini_Int(save,"Level");
Info[playerid][Lider] = dini_Int(save,"Lider");
Info[playerid][Membro] = dini_Int(save,"Membro");
Info[playerid][Preso] = dini_Int(save,"Preso");
Info[playerid][TempoP] = dini_Int(save,"TempoPreso");
}
else
{
dini_Create(save);
}
return 1;
}
stock Salvar(playerid)
{
new save[37],na[MAX_PLAYER_NAME];
GetPlayerName(playerid,na,sizeof(na));
format(save,sizeof(save),"Contas/%s.txt",na);
if(fexist(save))
{
dini_IntSet(save,"Administrador",Info[playerid][Admin]);
dini_IntSet(save,"Level",Info[playerid][Level]);
dini_IntSet(save,"Lider",Info[playerid][Lider]);
dini_IntSet(save,"Membro",Info[playerid][Membro]);
dini_IntSet(save,"Preso",Info[playerid][Preso]);
dini_IntSet(save,"TempoPreso",Info[playerid][TempoP]);
return 1;
}
return 1;
}