03.10.2011, 23:11
bom galera meu gm tava salvando as contas normalmente e agora nao ta mais, olha aki as linha de salvamento
no OnPlayerDisconnect:
e as public que salvam e carregam as contas:
no OnPlayerDisconnect:
pawn Код:
SavePlayerConfig(playerid);
pawn Код:
forward SavePlayerConfig(playerid);
public SavePlayerConfig(playerid)
{
new FilePath[256];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(FilePath, sizeof(FilePath), "%s%s.ini",UserFiles,pname);
if(!dini_Exists(FilePath))
{
}
else if(PlayerInfo[playerid][Loged] == 1)
{
PlayerInfo[playerid][pMoney] = GetPlayerMoneyEx(playerid);
dini_Set(FilePath, "Name", PlayerInfo[playerid][pName]);
dini_IntSet(FilePath, "Level", PlayerInfo[playerid][pLevel]);
dini_IntSet(FilePath, "Money", GetPlayerMoneyEx(playerid));
dini_IntSet(FilePath, "Skin", PlayerInfo[playerid][pSkin]);
dini_IntSet(FilePath, "Respeito", PlayerInfo[playerid][pExp]);
dini_IntSet(FilePath, "Org", PlayerInfo[playerid][pOrg]);
dini_IntSet(FilePath, "Lider", PlayerInfo[playerid][pLider]);
dini_IntSet(FilePath, "Cargo", PlayerInfo[playerid][pCargo]);
dini_IntSet(FilePath, "Admin", PlayerInfo[playerid][pAdmin]);
dini_IntSet(FilePath, "Telefone", PlayerInfo[playerid][pPnumber]);
dini_IntSet(FilePath, "Mutado", PlayerInfo[playerid][pMuted]);
dini_IntSet(FilePath, "Banco", PlayerInfo[playerid][pBanco]);
dini_IntSet(FilePath, "HouseKey", PlayerInfo[playerid][HouseKey]);
dini_IntSet(FilePath, "VHouseKey", PlayerInfo[playerid][VHouseKey]);
dini_IntSet(FilePath, "SpawnAtHome", PlayerInfo[playerid][SpawnAtHome]);
dini_IntSet(FilePath, "StoreKey", PlayerInfo[playerid][StoreKey]);
printf("Conta de %s salva com sucesso.",PlayerInfo[playerid][pName]);
}
}
forward LoadPlayerConfig(playerid);
public LoadPlayerConfig(playerid)
{
new FilePath[256];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(FilePath, sizeof(FilePath), "%s%s.ini",UserFiles,pname);
if(!dini_Exists(FilePath))
{
PlayerInfo[playerid][pMoney] = GetPlayerMoneyEx(playerid);
dini_Create(FilePath);
dini_Set(FilePath, "Name", PlayerInfo[playerid][pName]);
dini_IntSet(FilePath, "Level",1);
dini_IntSet(FilePath, "Money",0);
dini_IntSet(FilePath, "Skin", 23);
dini_IntSet(FilePath, "Respeito", 0);
dini_IntSet(FilePath, "Org", 0);
dini_IntSet(FilePath, "Lider", 0);
dini_IntSet(FilePath, "Cargo", 0);
dini_IntSet(FilePath, "Admin", 0);
dini_IntSet(FilePath, "Telefone", 0);
dini_IntSet(FilePath, "Mutado", 0);
dini_IntSet(FilePath, "Banco", 0);
dini_IntSet(FilePath, "HouseKey", 255);
dini_IntSet(FilePath, "VHouseKey", 255);
dini_IntSet(FilePath, "SpawnAtHome", 0);
dini_IntSet(FilePath, "StoreKey", 255);
GivePlayerMoneyEx(playerid,4000);
SetPlayerScore(playerid,1);
printf("Conta de %s criada com sucesso.",PlayerInfo[playerid][pName]);
}
else
{
ResetPlayerMoneyEx(playerid);
SetPlayerScore(playerid, dini_Int(FilePath, "Level"));
PlayerInfo[playerid][pLevel] = dini_Int(FilePath, "Level");
GivePlayerMoneyEx(playerid,dini_Int(FilePath, "Money"));
PlayerInfo[playerid][pSkin] = dini_Int(FilePath, "Skin");
PlayerInfo[playerid][pExp] = dini_Int(FilePath, "Respeito");
PlayerInfo[playerid][pOrg] = dini_Int(FilePath, "Org");
PlayerInfo[playerid][pLider] = dini_Int(FilePath, "Lider");
PlayerInfo[playerid][pCargo] = dini_Int(FilePath, "Cargo");
PlayerInfo[playerid][pAdmin] = dini_Int(FilePath, "Admin");
PlayerInfo[playerid][pPnumber] = dini_Int(FilePath, "Telefone");
PlayerInfo[playerid][pMuted] = dini_Int(FilePath, "Mutado");
PlayerInfo[playerid][pBanco] = dini_Int(FilePath, "Banco");
PlayerInfo[playerid][HouseKey] = dini_Int(FilePath, "HouseKey");
PlayerInfo[playerid][VHouseKey] = dini_Int(FilePath, "VHouseKey");
PlayerInfo[playerid][SpawnAtHome] = dini_Int(FilePath, "SpawnAtHome");
PlayerInfo[playerid][StoreKey] = dini_Int(FilePath, "StoreKey");
}
return 1;
}