01.02.2019, 21:32
Pessoal, eu estou com um puta problema, as vezes os dados do player nгo й carregado, eu criei uma funзгo que reseta as coisas do player quando ele conecta, mas quando ele digita a sua senha й pra carregar as coisas salvas, mas isso as vezes acontece de carregar e as vezes nгo, alguйm pode me ajudar?
OBS: Mesmo sem desligar o servidor.
OBS: Mesmo sem desligar o servidor.
PHP код:
stock SalvarPlayer(playerid)
{
new Arquivo[40];
format(Arquivo, sizeof(Arquivo), "Contas/%s.ini", NomePlayer(playerid));
if(DOF2_FileExists(Arquivo))
{
new string[30],dia,mes,ano,hora,mins,seg;
getdate(ano,mes,dia);
gettime(hora,mins,seg);
format(string, sizeof(string),"%02d/%02d/%d as %02d:%02d:%02d",dia,mes,ano,hora,mins,seg);
strmid(PlayerInfo[playerid][pLaastLogin],string,0,strlen(string),255);
DOF2_SetString(Arquivo,"Email",PlayerInfo[playerid][pEmail]);
DOF2_SetString(Arquivo,"LU",PlayerInfo[playerid][pLaastLogin]);
DOF2_SetInt(Arquivo,"Level", PlayerInfo[playerid][pLevel]);
DOF2_SetInt(Arquivo,"AdminLevel", PlayerInfo[playerid][pAdmin]);
DOF2_SetInt(Arquivo, "Avaliacoes", PlayerInfo[playerid][pAvaliacoes]);
DOF2_SetInt(Arquivo, "AvaFinal", PlayerInfo[playerid][pAFinal]);
DOF2_SetInt(Arquivo,"HelperLevel", PlayerInfo[playerid][pHelper]);
DOF2_SetInt(Arquivo,"Char", PlayerInfo[playerid][pSkin]);
DOF2_SetInt(Arquivo,"Registered", PlayerInfo[playerid][pReg]);
DOF2_SetInt(Arquivo,"Sex",PlayerInfo[playerid][pSex]);
DOF2_SetInt(Arquivo,"Age",PlayerInfo[playerid][pAge]);
DOF2_SetInt(Arquivo,"Muted",PlayerInfo[playerid][pMuted]);
DOF2_SetInt(Arquivo,"Respect",PlayerInfo[playerid][pExp]);
DOF2_SetInt(Arquivo,"ConnectedTime", PlayerInfo[playerid][pConnectTime]);
DOF2_SetInt(Arquivo,"Money",GetPlayerMoney(playerid));
DOF2_SetInt(Arquivo,"Ouros",PlayerInfo[playerid][pOuros]);
DOF2_SetInt(Arquivo,"Bank",PlayerInfo[playerid][pConta]);
DOF2_SetInt(Arquivo,"Salario",PlayerInfo[playerid][pSalario]);
DOF2_SetInt(Arquivo,"Emprego",PlayerInfo[playerid][pEmprego]);
DOF2_SetInt(Arquivo,"PayDay",PlayerInfo[playerid][pPayDay]);
DOF2_SetInt(Arquivo,"Fome",PlayerInfo[playerid][pFome]);
DOF2_SetInt(Arquivo,"Sede",PlayerInfo[playerid][pSede]);
DOF2_SetInt(Arquivo,"DetSkill",PlayerInfo[playerid][pDetSkill]);
DOF2_SetInt(Arquivo,"LawSkill",PlayerInfo[playerid][pLawSkill]);
DOF2_SetInt(Arquivo,"PhoneNr",PlayerInfo[playerid][pPnumber]);
DOF2_SetInt(Arquivo,"Phonebook",PlayerInfo[playerid][pPhoneBook]);
DOF2_SetInt(Arquivo,"Dado",PlayerInfo[playerid][pDice]);
DOF2_SetInt(Arquivo,"Creditos",PlayerInfo[playerid][pCreditos]);
DOF2_SetInt(Arquivo,"DonateRank",PlayerInfo[playerid][pVIP]);
DOF2_SetInt(Arquivo,"NivelProcurado", WantedPoints[playerid]);
DOF2_SetInt(Arquivo,"Crimes",PlayerInfo[playerid][pCrimes]);
DOF2_SetString(Arquivo,"cCrime",PlayerCrime[playerid][pAccusedof]);
DOF2_SetString(Arquivo,"cRelato",PlayerCrime[playerid][pVictim]);
DOF2_SetInt(Arquivo,"Kills",PlayerInfo[playerid][pKills]);
DOF2_SetInt(Arquivo,"Deaths",PlayerInfo[playerid][pDeaths]);
DOF2_SetInt(Arquivo,"Jailed",PlayerInfo[playerid][pJailed]);
DOF2_SetInt(Arquivo,"JailTime",PlayerInfo[playerid][pJailTime]);
DOF2_SetBool(Arquivo,"Ajustado",PlayerInfo[playerid][pAjustado]);
DOF2_SetInt(Arquivo,"BlockNoob",PlayerInfo[playerid][pBloqNoob]);
DOF2_SetInt(Arquivo,"Lider",PlayerInfo[playerid][pLider]);
DOF2_SetInt(Arquivo,"Member",PlayerInfo[playerid][pMembro]);
GetPlayerPos(playerid, puPosX[playerid], puPosY[playerid], puPosZ[playerid]);
GetPlayerFacingAngle(playerid, puPosA[playerid]);
pInterior[playerid] = GetPlayerInterior(playerid);
DOF2_SetFloat(Arquivo, "PosX", puPosX[playerid]);
DOF2_SetFloat(Arquivo, "PosY", puPosY[playerid]);
DOF2_SetFloat(Arquivo, "PosZ", puPosZ[playerid]);
DOF2_SetFloat(Arquivo, "PosA", puPosA[playerid]);
DOF2_SetInt(Arquivo, "Interior", pInterior[playerid]);
DOF2_SaveFile();
}
return 1;
}
stock CarregarPlayer(playerid)
{
new Arquivo[100];
format(Arquivo, sizeof(Arquivo), "Contas/%s.ini", NomePlayer(playerid));
if(DOF2_FileExists(Arquivo))
{
strmid(PlayerInfo[playerid][pEmail],DOF2_GetString(Arquivo,"Email"),0,strlen(DOF2_GetString(Arquivo,"Email")),255);
strmid(PlayerInfo[playerid][pLaastLogin],DOF2_GetString(Arquivo,"LU"),0,strlen(DOF2_GetString(Arquivo,"LU")),255);
PlayerInfo[playerid][pLevel] = DOF2_GetInt(Arquivo, "Level");
PlayerInfo[playerid][pAdmin] = DOF2_GetInt(Arquivo, "AdminLevel");
PlayerInfo[playerid][pAvaliacoes] = DOF2_GetInt(Arquivo, "Avaliacoes");
PlayerInfo[playerid][pHelper] = DOF2_GetInt(Arquivo, "HelperLevel");
PlayerInfo[playerid][pReg] = DOF2_GetInt(Arquivo, "Registered");
PlayerInfo[playerid][pSkin] = DOF2_GetInt(Arquivo, "Char");
PlayerInfo[playerid][pSex] = DOF2_GetInt(Arquivo, "Sex");
PlayerInfo[playerid][pAge] = DOF2_GetInt(Arquivo, "Age");
PlayerInfo[playerid][pMuted] = DOF2_GetInt(Arquivo, "Muted");
PlayerInfo[playerid][pExp] = DOF2_GetInt(Arquivo, "Respect");
PlayerInfo[playerid][pConnectTime] = DOF2_GetInt(Arquivo, "ConnectedTime");
PlayerInfo[playerid][pMoney] = DOF2_GetInt(Arquivo, "Money");
PlayerInfo[playerid][pConta] = DOF2_GetInt(Arquivo, "Bank");
PlayerInfo[playerid][pSalario] = DOF2_GetInt(Arquivo, "Salario");
PlayerInfo[playerid][pOuros] = DOF2_GetInt(Arquivo, "Ouros");
PlayerInfo[playerid][pEmprego] = DOF2_GetInt(Arquivo, "Emprego");
PlayerInfo[playerid][pPayDay] = DOF2_GetInt(Arquivo, "PayDay");
PlayerInfo[playerid][pFome] = DOF2_GetInt(Arquivo, "Fome");
PlayerInfo[playerid][pSede] = DOF2_GetInt(Arquivo, "Sede");
PlayerInfo[playerid][pDetSkill] = DOF2_GetInt(Arquivo,"DetSkill");
PlayerInfo[playerid][pLawSkill] = DOF2_GetInt(Arquivo,"LawSkill");
PlayerInfo[playerid][pPnumber] = DOF2_GetInt(Arquivo, "PhoneNr");
PlayerInfo[playerid][pPhoneBook] = DOF2_GetInt(Arquivo, "Phonebook");
PlayerInfo[playerid][pDice] = DOF2_GetInt(Arquivo, "Dado");
PlayerInfo[playerid][pCreditos] = DOF2_GetInt(Arquivo, "Creditos");
PlayerInfo[playerid][pVIP] = DOF2_GetInt(Arquivo, "DonateRank");
PlayerInfo[playerid][pDiaVIP] = DOF2_GetInt(Arquivo, "DiasVIP");
PlayerInfo[playerid][pMesVIP] = DOF2_GetInt(Arquivo, "MesVIP");
PlayerInfo[playerid][pAnoVIP] = DOF2_GetInt(Arquivo, "AnoVIP");
PlayerInfo[playerid][pWantedPoints] = DOF2_GetInt(Arquivo, "NivelProcurado");
PlayerInfo[playerid][pCrimes] = DOF2_GetInt(Arquivo, "Crimes");
strmid(PlayerCrime[playerid][pAccusedof],DOF2_GetString(Arquivo,"cCrime"),0,strlen(DOF2_GetString(Arquivo,"cCrime")),255);
strmid(PlayerCrime[playerid][pVictim],DOF2_GetString(Arquivo,"cRelato"),0,strlen(DOF2_GetString(Arquivo,"cRelato")),255);
PlayerInfo[playerid][pKills] = DOF2_GetInt(Arquivo, "Kills");
PlayerInfo[playerid][pDeaths] = DOF2_GetInt(Arquivo, "Deaths");
PlayerInfo[playerid][pJailed] = DOF2_GetInt(Arquivo, "Jailed");
PlayerInfo[playerid][pJailTime] = DOF2_GetInt(Arquivo, "JailTime");
PlayerInfo[playerid][pAjustado] = DOF2_GetBool(Arquivo, "Ajustado");
PlayerInfo[playerid][pBloqNoob] = DOF2_GetInt(Arquivo, "BlockNoob");
PlayerInfo[playerid][pLider] = DOF2_GetInt(Arquivo, "Lider");
PlayerInfo[playerid][pMembro] = DOF2_GetInt(Arquivo, "Member");
puPosX[playerid] = DOF2_GetFloat(Arquivo, "PosX");
puPosY[playerid] = DOF2_GetFloat(Arquivo, "PosY");
puPosZ[playerid] = DOF2_GetFloat(Arquivo, "PosZ");
puPosA[playerid] = DOF2_GetFloat(Arquivo, "PosA");
pInterior[playerid] = DOF2_GetInt(Arquivo, "Interior");
DOF2_SaveFile();
}
return 1;
}