Saving help! [Edited]
#1

Problem - Saving, the cash,kills,deaths,adminlevel and VIP won't save (only if it's done through scriptfiles it saves).


Code - Click here

This is also under OnPlayerDisconnect


pawn Код:
new userfile[132];
    format(userfile, sizeof (userfile), "users/%s.ini", pname);
    new INI:file = INI_Open(userfile);
    INI_SetTag(INI:file, "data");
    INI_WriteInt(file,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(file,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(file,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(file,"Adminlevel",PlayerInfo[playerid][pAdminlevel]);
    INI_WriteInt(file,"VIP",PlayerInfo[playerid][pVIP]);
    INI_Close(file);
Thanks in advanced.
Reply
#2

pawn Код:
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname,sizeof(pname));
and you need create users folder in your scriptfiles folder
Reply
#3

Quote:
Originally Posted by timaoux
Посмотреть сообщение
pawn Код:
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname,sizeof(pname));
and you need create users folder in your scriptfiles folder
I know you're trying to help, but I ain't that retarded to know that I need to know how to create a folder in my scriptfiles (I don't want this to sound cheeky heh so apologies if it does).
Reply
#4

use dini its better for save the users info
Reply
#5

pawn Код:
new userfile[132];
    format(userfile, sizeof (userfile), "users/%s.ini", pname);
print("1");
    new INI:file = INI_Open(userfile);
print("2");
    INI_SetTag(INI:file, "data");
print("3");
    INI_WriteInt(file,"Cash",GetPlayerMoney(playerid));
print("4");
    INI_WriteInt(file,"Kills",PlayerInfo[playerid][pKills]);
print("5");
    INI_WriteInt(file,"Deaths",PlayerInfo[playerid][pDeaths]);
print("6");
    INI_WriteInt(file,"Adminlevel",PlayerInfo[playerid][pAdminlevel]);
print("7");
    INI_WriteInt(file,"VIP",PlayerInfo[playerid][pVIP]);
print("8");
    INI_Close(file);
print("9");
Check where it stops, and post that here; if it prints them all check the file if it actually creates a line 'VIP' in the file.

Edit:
Quote:
Originally Posted by timaoux
Посмотреть сообщение
use dini its better for save the users info
Dini sucks compared to y_ini, well actually for everything else
Reply
#6

i hate y_ini , thats too complicated
Reply
#7

Mby you do this.

pawn Код:
// Forward
forward SaveAccount(playerid);
// Public
public SaveAccount(playerid)
{
    new
                userfile[ 132 ],
        INI:File = INI_Open(userfile)
    ;
    format(userfile, sizeof (userfile), "users/%s.ini", pname);
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Adminlevel",PlayerInfo[playerid][pAdminlevel]);
    INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]);
    INI_Close(File);
    return 1;
}

// And add line to OnPlayerDisconnect
SaveAccount(playerid);
EDIT:
Quote:
Originally Posted by timaoux
Посмотреть сообщение
i hate y_ini , thats too complicated
Mby you are so noob to use this ?

OUCH Sorry i forgot. I update my post you got userfile sorry my mistake.
Reply
#8

Sorry I forgot to post, I fixed it before hand.


But thanks for the help and reputation points will be giving.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)