Y_INI Help
#1

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
Reply
#2

replace 'load_user_data_playerinfo_%s' with 'load_user_data_playerinfo'

Then create a public callback for that...
Reply
#3

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;
}
Reply
#4

Bump?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)