[Ajuda] Error Salvamento de Dados
#1

Estou com um problema no salvamento do meus dados.. quando reconecta o player nasce com a skin 0 na posiзгo 0 do GTA (x=0,y=0,z=0,a=0)

Meu codigo

Quote:

stock SalvarPlayer(playerid)
{
GetPlayerName(playerid, Nome, sizeof(Nome));
GetPlayerPos(playerid,CoordX[playerid],CoordY[playerid],CoordZ[playerid]);
GetPlayerFacingAngle(playerid,CoordA[playerid]);
format(String, sizeof(String), CONTAS, Nome);
DOF2_SetInt(String, "Dinheiro", GetPlayerMoney(playerid));
DOF2_SetInt(String, "Skin", GetPlayerSkin(playerid));
DOF2_SetInt(String, "Procurado", GetPlayerWantedLevel(playerid));
DOF2_SetInt(String, "CoordInt", GetPlayerInterior(playerid));
DOF2_SetFloat(String, "CoordX", CoordX[playerid]);
DOF2_SetFloat(String, "CoordY", CoordY[playerid]);
DOF2_SetFloat(String, "CoordZ", CoordZ[playerid]);
DOF2_SetFloat(String, "CoordA", CoordA[playerid]);
DOF2_SetInt(String, "Segundos", PlayerInfo[playerid][pSegundos]);
DOF2_SetInt(String, "Score", PlayerInfo[playerid][pScore]);

DOF2::SaveFile();
return true;
}

stock CarregarPlayer(playerid)
{
GetPlayerName(playerid, Nome, sizeof(Nome));
format(String, sizeof(String), CONTAS, Nome);
GivePlayerMoney(playerid, DOF2_GetInt(String, "Dinheiro"));
SetPlayerWantedLevel(playerid, DOF2_GetInt(String, "Procurado"));
SetPlayerSkin(playerid, DOF2_GetInt(String, "Skin"));
PlayerInfo[playerid][pSegundos] = DOF2_GetInt(String, "Segundos");
SetPlayerScore(playerid, DOF2_GetInt(String,"Score"));
SetPlayerPos(playerid, DOF2_GetFloat(String, "CoordX"), DOF2_GetFloat(String, "CoordY"), DOF2_GetFloat(String, "CoordZ"));
SetPlayerFacingAngle(playerid, DOF2_GetFloat(String, "CoordA"));
SetPlayerInterior(playerid, DOF2_GetInt(String, "CoordInt"));

DOF2::SaveFile();
return true;
}

public OnPlayerRequestClass(playerid, classid)
{
SetSpawnInfo( playerid, 0, DOF2_GetInt(String, "Skin"), DOF2_GetFloat(String, "CoordX"), DOF2_GetFloat(String, "CoordY"), DOF2_GetFloat(String, "CoordZ"), DOF2_GetFloat(String, "CoordA"), 0, 0, 0, 0, 0, 0 );
SpawnPlayer(playerid);
return 1;
}

public OnPlayerRequestSpawn(playerid)
{
Kick(playerid);
return 0;
}

Reply
#2

Nгo tenho certeza que vб funcionar, mas vocк pode tentar salvar o id da skin como string.
Код:
DOF2_SetString(String, "Skin", GetPlayerSkin(playerid));
E pra carregar a skin
Код:
DOF2_GetInt(String, "Skin");
Eu tive um problema meio parecido no meu sistema de emprйstimo, eu fiz isso e funcionou.
Reply
#3

nгo deu
Reply
#4

Pelo cуdigo que vocк postou aqui, vocк nгo formatou String em OnPlayerRequestClass
Reply
#5

"String" й uma variбvel global?
Tem certeza que essa variбvel salva o diretуrio da conta do player?
Reply
#6

como eu faria isso? SaDan?

Nгo sei... sou novo nisso Ever_SH como seria melhor?
Reply
#7

Eu faзo dessa forma:
Код:
Conta(playerid)
{
	new arquivo[40];
	new Name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, Name, sizeof(Name));
	format(arquivo, 40, "Contas/%s.ini", Name);
	return arquivo;
}
Ai para Carregar algo:
Код:
DOF2_GetInt(Conta(playerid), "Dinheiro");
EDIT:

Alias, percebi que vocк jб carregou as coordenadas e rotaзгo na hora do login, na hora de spawnar nгo precisa carregar novamente.
Reply
#8

Код:
new nome[MAX_PLAYER_NAME;
GetPlayerName(playerid, nome, sizeof(nome));
format(String, sizeof(String), CONTAS, nome);
OnPlayerRequestClass ficaria assim:

Код:
public OnPlayerRequestClass(playerid, classid)
{
new nome[MAX_PLAYER_NAME;
GetPlayerName(playerid, nome, sizeof(nome));
format(String, sizeof(String), CONTAS, nome);
SetSpawnInfo( playerid, 0, DOF2_GetInt(String, "Skin"), DOF2_GetFloat(String, "CoordX"), DOF2_GetFloat(String, "CoordY"), DOF2_GetFloat(String, "CoordZ"), DOF2_GetFloat(String, "CoordA"), 0, 0, 0, 0, 0, 0 );
SpawnPlayer(playerid);
return 1;
}
Reply
#9

Pelo o que eu vi ali, seu cуdigo estб bem desorganizado.
Como:
Код:
GivePlayerMoney(playerid, DOF2_GetInt(String, "Dinheiro"));
e
Код:
DOF2_SetInt(String, "Dinheiro", GetPlayerMoney(playerid));
Dessa forma, o money Hack serб possivel. Crie variбveis para armazenas os dados do player.
Assim tambйm nгo sera necessбrio carregar novamente na hora de spawnar.
Reply
#10

pode crer!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)