[Ajuda] Salvar coordenadas
#1

Olб to aprocura de um sistema de salvar coordenadas/armas/vida,colete...
mas por enquanto to apenas procurando coordenadas.

Achei um aq rapidгo e nгo salva n sei pq :/

// Sistema de voltar coordenadas
forward Salvarcoo(playerid);
#define PASTA_CONTAS "/Contas/%s.ini" /*--- Definindo em uma vбriavel o local da pasta das contas dos players ---*/

PHP код:
public OnPlayerDisconnect(playerid, reason)
{
       
DeletePVar(playerid, "PlayerMorto");
    
PlayerInfo[playerid][pOnline] = 0;
    
SalvarPlayer(playerid);
    new 
caller = Mobile[playerid];
    new 
nome[24], str[50];
    
GetPlayerName(playerid, nome, 24);
    
format(str, sizeof str, "%s - Arara", nome);
    
dini_BoolSet("Araras.ini", str, Infoa[playerid][Arara]);
    
format(str, sizeof str, "%s - Racao", nome);
    
dini_BoolSet("Araras.ini", str, Infoa[playerid][Racao]);
    
format(str, sizeof str, "%s - Grande", nome);
    
dini_IntSet("Araras.ini", str, Infoa[playerid][Grande]);
    
Salvarcoo(playerid); // AQ й o SAlvar coordenadas mas n salva parзa 
Agora veja a Forward Salvarcoo


PHP код:
//Sistema de salvar coordenadas
public Salvarcoo(playerid)
{
    new 
Float:x, Float:y, Float:z, Float:angle, file[30], aname[MAX_PLAYER_NAME];
    
GetPlayerName(playerid, aname,sizeof(aname));
    
format(file, sizeof(file), PASTA_CONTAS, aname);
    
GetPlayerPos(playerid, x, y, z);
    
GetPlayerFacingAngle(playerid, angle);
    
dini_FloatSet(file, "UltimaPosicaoX", x);
    
dini_FloatSet(file, "UltimaPosicaoY", y);
    
dini_FloatSet(file, "UltimaPosicaoZ", z);
    
dini_FloatSet(file, "UltimoAngulo", angle);
    return 
1;
} 
Reply
#2

Estб faltando as funзхes:
PHP код:
 dini_Exists, dini_Create 
Reply
#3

Boa noite, zGuigui2068!

Dк uma olhada nesse filterscript que escrevi a um tempo atrбs. Podes utiliza-lo como base.

Recomendo tambйm, que utilize um gerenciador de arquivos mais atualizado como DOF2 ou Y_INI.

Por ъltimo, tente elaborar tнtulos para o tуpico resumindo o teu problema. Isto pode facilitar a busca de soluзхes para pessoas que estгo tendo o mesmo problema que vocк.

Verifique tambйm a possнvel soluзгo do membro acima.

Quote:
Originally Posted by Coreia
Посмотреть сообщение
Estб faltando as funзхes:
PHP код:
 dini_Exists, dini_Create 
Reply
#4

PHP код:
//Sistema de salvar coordenadas
public Salvarcoo(playerid)
{
    new 
Float:x, Float:y, Float:z, Float:angle, file[30], aname[MAX_PLAYER_NAME];
    
GetPlayerName(playerid, aname,sizeof(aname));
    
GetPlayerPos(playerid, x, y, z);
    
GetPlayerFacingAngle(playerid, angle);
    
format(file, sizeof(file), PASTA_CONTAS, aname);
    if(!
dini_Exists(file)) dini_Create(file);
    
dini_FloatSet(file, "UltimaPosicaoX", x);
    
dini_FloatSet(file, "UltimaPosicaoY", y);
    
dini_FloatSet(file, "UltimaPosicaoZ", z);
    
dini_FloatSet(file, "UltimoAngulo", angle);
    return 
1;
} 
Reply
#5

Lуs posso converter a Dof2 para dini ?
Reply
#6

Quote:
Originally Posted by zGuigui2068
Посмотреть сообщение
Lуs posso converter a Dof2 para dini ?
Sim, pode, nгo hб nada que lhe impeзa. Й bem simples, por sinal.
Reply
#7

Qria agradecer a ajuda de todos, principalmente do 1sbedx e do Lуs Vlw vcs dois
Reply
#8

Fiz esse cуdigo simples e rбpido para vocк ter uma minima noзгo de como funciona o DOF2.

Recomendo que crie as variбveis que armazena tanto as posiзхes e os вngulos de modo global, assim nгo terбs dificuldade de armazenar dados do sistema em outras ocasiхes.

PHP код:
public Salvarcoo(playerid)
{
    new 
Float:x, Float:y, Float:z, Float:angle, file[30], aname[MAX_PLAYER_NAME];
    
GetPlayerName(playerid, aname,sizeof(aname));
    
GetPlayerPos(playerid, x, y, z);
    
GetPlayerFacingAngle(playerid, angle);
    
format(file, sizeof(file), PASTA_CONTAS, aname);
    if(!
DOF2_FileExists(file)){
        
DOF2_CreateFile(file);
        
DOF2_SetFloat(file, "UltimaPosicaoX", x);
        
DOF2_SetFloat(file, "UltimaPosicaoY", y);
        
DOF2_SetFloat(file, "UltimaPosicaoZ", z);
        
DOF2_SetFloat(file, "UltimoAngulo", angle);
        
DOF2_SaveFile();
    }
    return 
1;
}
public 
CarregarCoo(playerid){
    if(
DOF2_FileExists(file)){
        
DOF2_GetFloat(file, "UltimaPosiзгoX");
        
//...//
    
}
    return 
1;
} 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)