Salvamento do player:
PHP код:
stock SalvarPlayer(playerid)
{
new Arquivodesave[128];
format(Arquivodesave, sizeof(Arquivodesave), "Contas/%s.ini", Nome(playerid));
if(DOF2_FileExists(Arquivodesave))
{
new Float:Pos[3],Float:A;
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
GetPlayerFacingAngle(playerid, A);
DOF2_SetInt(Arquivodesave, "pInterior", GetPlayerInterior(playerid));
DOF2_SetFloat(Arquivodesave, "pPosX", Pos[0]);
DOF2_SetFloat(Arquivodesave, "pPosY", Pos[1]);
DOF2_SetFloat(Arquivodesave, "pPosZ", Pos[2]);
DOF2_SetFloat(Arquivodesave, "pPosA", A);
DOF2_SetInt(Arquivodesave, "Administrador", PlayerInfo[playerid][pAdmin]);
DOF2_SetInt(Arquivodesave, "Moderador", PlayerInfo[playerid][pMod]);
DOF2_SetInt(Arquivodesave, "Ajudante", PlayerInfo[playerid][pAju]);
DOF2_SetInt(Arquivodesave, "Dono", PlayerInfo[playerid][pDono]);
DOF2_SetInt(Arquivodesave, "Level", GetPlayerScore(playerid));
DOF2_SetInt(Arquivodesave,"EXP",PlayerInfo[playerid][pRespeito]);
DOF2_SetInt(Arquivodesave, "Skin", GetPlayerSkin(playerid));
DOF2_SetInt(Arquivodesave, "Matou", PlayerInfo[playerid][pMatou]);
DOF2_SetInt(Arquivodesave, "Morreu", PlayerInfo[playerid][pMorreu]);
DOF2_SetInt(Arquivodesave, "Dinheiro", GetPlayerMoney(playerid));
DOF2_SetInt(Arquivodesave, "LitrosGalao",PlayerInfo[playerid][pGalaoGasolina]);
DOF2_SetInt(Arquivodesave, "TemGalao",PlayerInfo[playerid][pTemGalao]);
DOF2_SetInt(Arquivodesave, "Local",PlayerInfo[playerid][pLocal]);
DOF2_SetInt(Arquivodesave, "Interior",GetPlayerInterior(playerid));
DOF2_SetInt(Arquivodesave,"AgendaTel",PlayerInfo[playerid][pPhoneBook]);
DOF2_SetInt(Arquivodesave, "CelNumero",PlayerInfo[playerid][pPnumber]);
DOF2_SetInt(Arquivodesave, "Creditos",PlayerInfo[playerid][pCreditos]);
DOF2_SetInt(Arquivodesave,"EstiloLuta",PlayerInfo[playerid][pFightingStyle]);
DOF2_SetInt(Arquivodesave,"LicencaCarro",PlayerInfo[playerid][pCarLic]);
DOF2_SetInt(Arquivodesave,"LicencaBarco",PlayerInfo[playerid][pBarcoLic]);
DOF2_SetInt(Arquivodesave,"LicencaAviao",PlayerInfo[playerid][pAviaoLic]);
DOF2_SetInt(Arquivodesave,"LicencaArma",PlayerInfo[playerid][pLicArma]);
DOF2_SetInt(Arquivodesave,"Preso",PlayerInfo[playerid][pCadeia]);
DOF2_SetInt(Arquivodesave,"Capacete",PlayerInfo[playerid][pCapacete]);
DOF2_SetInt(Arquivodesave,"Profissao",PlayerInfo[playerid][pProfissao]);
DOF2_SetInt(Arquivodesave,"Casa",PlayerInfo[ playerid ][ pTCasa ] );
DOF2_SetInt(Arquivodesave,"Abuser",PlayerInfo[playerid][pAbuser]);
DOF2_SetInt(Arquivodesave,"Boombox",PlayerInfo[playerid][pBoombox]);
DOF2_SetBool(Arquivodesave, "pCongelado", PlayerInfo[playerid][pCongelado]);
DOF2_SetBool(Arquivodesave, "pCalado", PlayerInfo[playerid][pCalado]);
DOF2_SetInt(Arquivodesave,"MinUP",PlayerInfo[playerid][pMinUP]);
DOF2_SetInt(Arquivodesave,"SegUP",PlayerInfo[playerid][pSegUP]);
DOF2_SetInt(Arquivodesave,"Cor_Relogio",PlayerInfo[playerid][pRelogioCor]);
DOF2_SetInt(Arquivodesave,"KitFavela",PlayerInfo[playerid][pTem_Kit]);
DOF2_SaveFile();
}
return 1;
}
Carregamento do player:
PHP код:
stock CarregarPlayer(playerid)
{
new Arquivodelogin[128];
format(Arquivodelogin, sizeof(Arquivodelogin), "Contas/%s.ini", Nome(playerid));
if(DOF2_FileExists(Arquivodelogin))
{
PlayerInfo[playerid][pAdmin] = DOF2_GetInt(Arquivodelogin, "Administrador");
PlayerInfo[playerid][pMod] = DOF2_GetInt(Arquivodelogin, "Moderador");
PlayerInfo[playerid][pAju] = DOF2_GetInt(Arquivodelogin, "Ajudante");
PlayerInfo[playerid][pDono] = DOF2_GetInt(Arquivodelogin, "Dono");
SetPlayerScore(playerid, DOF2_GetInt(Arquivodelogin, "Level"));
PlayerInfo[playerid][pRespeito] = DOF2_GetInt(Arquivodelogin, "EXP");
SetPlayerSkin(playerid, DOF2_GetInt(Arquivodelogin, "Skin"));
PlayerInfo[playerid][pMatou] = DOF2_GetInt(Arquivodelogin, "Matou");
PlayerInfo[playerid][pMorreu] = DOF2_GetInt(Arquivodelogin, "Morreu");
GivePlayerMoney(playerid, DOF2_GetInt(Arquivodelogin, "Dinheiro"));
PlayerInfo[playerid][pGalaoGasolina] = DOF2_GetInt(Arquivodelogin,"LitrosGalao");
PlayerInfo[playerid][pTemGalao] = DOF2_GetInt(Arquivodelogin,"TemGalao");
PlayerInfo[playerid][pLocal] = DOF2_GetInt(Arquivodelogin, "Local");
PlayerInfo[playerid][pInterior] = DOF2_GetInt(Arquivodelogin, "Interior");
PlayerInfo[playerid][pPhoneBook] = DOF2_GetInt(Arquivodelogin,"AgendaTel");
PlayerInfo[playerid][pPnumber] = DOF2_GetInt(Arquivodelogin,"CelNumero");
PlayerInfo[playerid][pCreditos] = DOF2_GetInt(Arquivodelogin,"Creditos");
PlayerInfo[playerid][pFightingStyle] = DOF2_GetInt(Arquivodelogin,"EstiloLuta");
PlayerInfo[playerid][pCarLic] = DOF2_GetInt(Arquivodelogin,"LicencaCarro");
PlayerInfo[playerid][pBarcoLic] = DOF2_GetInt(Arquivodelogin,"LicencaBarco");
PlayerInfo[playerid][pAviaoLic] = DOF2_GetInt(Arquivodelogin,"LicencaAviao");
PlayerInfo[playerid][pLicArma] = DOF2_GetInt(Arquivodelogin,"LicencaArma");
PlayerInfo[playerid][pCadeia] = DOF2_GetInt(Arquivodelogin,"Preso");
PlayerInfo[ playerid ][ pTCasa ] = DOF2_GetInt(Arquivodelogin,"Casa" );
PlayerInfo[playerid][pProfissao] = DOF2_GetInt(Arquivodelogin,"Profissao");
PlayerInfo[playerid][pCapacete] = DOF2_GetInt(Arquivodelogin,"Capacete");
PlayerInfo[playerid][pAbuser] = DOF2_GetInt(Arquivodelogin,"Abuser");
PlayerInfo[playerid][pBoombox] = DOF2_GetInt(Arquivodelogin,"Boombox");
PlayerInfo[playerid][pCongelado] = DOF2_GetBool(Arquivodelogin, "pCongelado");
PlayerInfo[playerid][pCalado] = DOF2_GetBool(Arquivodelogin, "pCalado");
PlayerInfo[playerid][pMinUP] = DOF2_GetInt(Arquivodelogin,"MinUP");
PlayerInfo[playerid][pSegUP] = DOF2_GetInt(Arquivodelogin,"SegUP");
PlayerInfo[playerid][pRelogioCor] = DOF2_GetInt(Arquivodelogin,"Cor_Relogio");
PlayerInfo[playerid][pTem_Kit] = DOF2_GetInt(Arquivodelogin,"KitFavela");
for(new i = 0; i < sizeof(Registro); i++) { TextDrawHideForPlayer(playerid, Registro[i]);}
CancelSelectTextDraw(playerid);
SetSpawnInfo(playerid, 0, DOF2_GetInt(Arquivodelogin, "Skin"), DOF2_GetFloat(Arquivodelogin, "pPosX"), DOF2_GetFloat(Arquivodelogin, "pPosY"), DOF2_GetFloat(Arquivodelogin, "pPosZ"), DOF2_GetFloat(Arquivodelogin, "pPosA"),0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
return 1;
}
Ai estб o salvamento do player, quando adiciono algo novo neste dois, a conta ja criada, ao invйs de adicionar o item, reseta os demais itens e adiciona o item novo