SA-MP Forums Archive
Little help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Little help (/showthread.php?tid=369042)



Little help - jotan. - 15.08.2012

Hello.
I am using zcmd,sscanf to make some commands...
I have some questions

1.I have enum PInfo with
pDeaths,
pKills
pCash,
How do I make it load on player LOGIN? I want it to load values from enums


Re: Little help - detter - 15.08.2012

First you need to save stuff ,then load.
There is multiple ways of saving/loading variables ,but if you are a beginner i recommend dini.
****** it...


Re: Little help - [MM]RoXoR[FS] - 15.08.2012

Using
Код:
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
pawn Код:
enum PInfo
{
pDeaths,
pKills
pCash,
}
new PlayerInfo[MAX_PLAYERS][PInfo];

forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
 
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    return 1;
}
stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),"/YOURPATH/%s.ini",playername);
    return string;
}
public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))//Login
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);

//And all other code



Re: Little help - jotan. - 15.08.2012

[MM]RoXoR[FS],Thanks Helped me REP ++