Saving Pos.
#1

PHP код:
enum pInfo
{
    
Float:PositsionX,
    
Float:PositsionY,
    
Float:PositsionZ,
}
new 
KasutajaInfo[MAX_PLAYERS][pInfo]; 
PHP код:
LoadUser(playerid)
{
    new 
nimi[MAX_PLAYER_NAME], file[256];
    
GetPlayerName(playeridnimisizeof(nimi));
    
format(filesizeof(file), KASUTAJADnimi);
    
dini_FloatSet(file"PositsionX",KasutajaInfo[playerid][PositsionX]);
    
dini_FloatSet(file"PositsionY",KasutajaInfo[playerid][PositsionY]);
    
dini_FloatSet(file"PositsionZ",KasutajaInfo[playerid][PositsionZ]);

PHP код:
SaveUser(playerid)
{
    new 
nimi[MAX_PLAYER_NAME], file[256];
    
GetPlayerName(playeridnimisizeof(nimi));
    
format(filesizeof(file), KASUTAJADnimi);
       
dini_IntSet(file"T88koht",KasutajaInfo[playerid][T88koht]);
       
dini_FloatSet(file"PositsionX",KasutajaInfo[playerid][PositsionX]);
    
dini_FloatSet(file"PositsionY",KasutajaInfo[playerid][PositsionY]);
    
dini_FloatSet(file"PositsionZ",KasutajaInfo[playerid][PositsionZ]);

PHP код:
public OnPlayerDisconnect(playeridreason)
{
    
SaveUser(playerid);
    return 
1;

PHP код:
public OnPlayerConnect(playerid)
{
    if(
strfind(RPNU(playerid), "_"true) == -1)
    {
          
Kick(playerid);
          
SCM(playeridCOLOR_RED"Su nimi peab olema formaadis Eesnimi_Perekonnanimi");
        return 
1;
    }
    
SetTimer("ToiduTimer"180000true);
    
SisseLogitud[playerid] = 0;
    new 
nimi[MAX_PLAYER_NAME], file[256];
    
GetPlayerName(playeridnimisizeof(nimi));
    
format(filesizeof(file), KASUTAJADnimi);
    if (!
dini_Exists(file))
    {
        
ShowPlayerDialog(playerid1DIALOG_STYLE_INPUT"Registeerimine""Sisesta enda parool, et registeerida""Valmis""Katkesta");
    }
    if(
fexist(file))
    {
        
ShowPlayerDialog(playerid2DIALOG_STYLE_INPUT"Logimine""Sisesta enda parool, et logida""Logi sisse""Katkesta");
    }
    [
B]LoadUser(playerid);[/B]
    return 
1;

What i miss? 'cause this dont save and load character pos.
Reply
#2

To be honest with you, I'm not quite sure what's wrong but I'll tell you the correct thing. Don't use Dini. It's outdated and not effective as newer loading/saving systems like SQLite/MYSQL or y_ini.
Reply
#3

i changed it to iini, but still not saving
Reply
#4

change it back to dini... lolz

and make it when player spawn

public OnPlayerSpawn(playerid)
{
new Float: x ,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
KasutajaInfo[playerid][PositsionX] = x;
KasutajaInfo[playerid][PositsionY] = y;
KasutajaInfo[playerid][PositsionZ] = z; //HERE IT SAVE THE POSITION WHEN PLAY SPAWN IF YOU WANT TO SAVE WHEN DO SOMETHING ELSE JUST COPY AND PASTE THIS CODE WHERE YOU WANT
return 1;
}
Reply
#5

Quote:
Originally Posted by kyriakos587
Посмотреть сообщение
change it back to dini... lolz

and make it when player spawn

public OnPlayerSpawn(playerid)
{
new Float: x ,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
KasutajaInfo[playerid][PositsionX] = x;
KasutajaInfo[playerid][PositsionY] = y;
KasutajaInfo[playerid][PositsionZ] = z; //HERE IT SAVE THE POSITION WHEN PLAY SPAWN IF YOU WANT TO SAVE WHEN DO SOMETHING ELSE JUST COPY AND PASTE THIS CODE WHERE YOU WANT
return 1;
}
Change it back to dini? Search some posts where people explain why dini is bad to use. ASAP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)