SA-MP Forums Archive
Y_INI 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Y_INI Help (/showthread.php?tid=272897)



Y_INI Help - Runedog48 - 30.07.2011

I'm trying to create a system to save stats and stuff but it won't work. It does absolutely nothing.

On player connect
pawn Код:
new stringy[254];
format(stringy, sizeof(stringy), "Accounts\%s.ini", pname);
INI_ParseFile(stringy, "load_user_data_playerinfo_%s", .bExtra = true, .extra = playerid);
PlayerInfo[playerid][adminlvl] = lv;
GivePlayerMoney(playerid, mn);
SetPlayerScore(playerid, sc);
On player disconnect
pawn Код:
new stringy[254];
    format(stringy, sizeof(stringy), "%s.ini", pname);
    new
    INI:ini = INI_Open(stringy);
    //INI_SetTag("playerinfo");
    INI_WriteString(ini, "NAME", pname);
    INI_WriteInt(ini, "MONEY", GetPlayerMoney(playerid));
    INI_WriteInt(ini, "SCORE", GetPlayerScore(playerid));
    INI_WriteInt(ini, "ADMINLVL", PlayerInfo[playerid][adminlvl]);
    INI_Close(ini);
INI shit
pawn Код:
public load_user_data(playerid, name[], value[])
{
    INI_Int("MONEY", mn);
    INI_Int("SCORE", sc);
    INI_Int("ADMINLVL", lv);
    return 1;
}
Copy of player stats
Код:
NAME = Runedog48
MONEY = 100
SCORE = 3
ADMINLVL = 5



Re: Y_INI Help - Lorenc_ - 30.07.2011

replace 'load_user_data_playerinfo_%s' with 'load_user_data_playerinfo'

Then create a public callback for that...


Re: Y_INI Help - Runedog48 - 30.07.2011

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
replace 'load_user_data_playerinfo_%s' with 'load_user_data_playerinfo'

Then create a public callback for that...
ty, would it be like this?

pawn Код:
public load_user_data(playerid, name[], value[])
{
    INI_Int("MONEY", mn);
    INI_Int("SCORE", sc);
    INI_Int("ADMINLVL", lv);
    load_user_data_playerinfo(mn, sc, lv);
    return 1;
}

public load_user_data_playerinfo(mn, sc, lv)
{
GivePlayerMoney(playerid, mn);
SetPlayerScore(playerid, sc);
return 1;
}



Re: Y_INI Help - Runedog48 - 30.07.2011

Bump?