SA-MP Forums Archive
Score won't load - 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: Score won't load (/showthread.php?tid=606796)



Score won't load - Micko123 - 09.05.2016

Can somene tell me why whole score won't load. If i had 70 score when i left game it will load 10.
This is my OnPlayerDisconnect
Код:
new INI:File = INI_Open(UserPath(playerid));
	INI_SetTag(File,"data");
	INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
	INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
	INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
	INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
	INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]);
	INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]);
	INI_Close(File);
And thisis OnPlayerConnect
Код:
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
And this is OnPlayerSpawn
Код:
GivePlayerScore(playerid, PlayerInfo[playerid][pScore]);
This is enum
Код:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths,
	pScore,
	pVIP
}



Re: Score won't load - TheSimpleGuy - 09.05.2016

Код:
new INI:File = INI_Open(UserPath(playerid));
	INI_SetTag(File,"data");
	INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
	INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
	INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
	INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
	INI_WriteInt(File,"Score",GetPlayerScore(playerid)); //change to GetPlayerScore(playerid)
	INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]);
	INI_Close(File);



Re: Score won't load - Micko123 - 09.05.2016

No errors there. Now i am going to check is it working


Re: Score won't load - Micko123 - 09.05.2016

Nope. Still loading only 10


Re: Score won't load - xTURBOx - 09.05.2016

use SetPlayerScore
instead of GivePlayerScore


Re: Score won't load - iKevin - 09.05.2016

Use SetPlayerScore.


Re: Score won't load - Micko123 - 09.05.2016

Nope. Still won't work. Now it wont load score at all


Re: Score won't load - Dayrion - 09.05.2016

PHP код:
    INI_Int("Score",PlayerInfo[playerid][pScore]);
    
SetPlayerScore(playeridPlayerInfo[playerid][pScore]); 
That's not working ? Show us your LoadUser_data please.


Re: Score won't load - Micko123 - 09.05.2016

Now it wont save it at all. WTF!


Re: Score won't load - Micko123 - 09.05.2016

Here you go
Код:
forward LoadUser_Data(playerid,name[],value[]);
public LoadUser_Data(playerid,name[],value[])
{
	INI_Int("Password",PlayerInfo[playerid][pPass]);
	INI_Int("Cash",PlayerInfo[playerid][pCash]);
	INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
	INI_Int("Kills",PlayerInfo[playerid][pKills]);
        INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
        INI_Int("Score",PlayerInfo[playerid][pScore]);
        INI_Int("VIP",PlayerInfo[playerid][pVIP]);
 	return 1;
}