SA-MP Forums Archive
Can't save player's score and money when he quit the game - 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: Can't save player's score and money when he quit the game (/showthread.php?tid=520137)



Can't save player's score and money when he quit the game - bijela - 17.06.2014

Can't save player's score and money when he quit the game


Код:
    pCash,
    pScore,
Код:
	dini_IntSet(file, "Score", PlayerInfo[playerid][pScore]); 
	dini_IntSet(file, "Money", GetPlayerMoney(playerid));
onplayerregister

Код:
	dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 3000);
	dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0);
Код:
PlayerInfo[playerid][pScore] = dini_Int(file, "Score");
PlayerInfo[playerid][pCash] = dini_Int(file, "Money");
What is here problem

on registration new player don't get 3000$ and on login if he had some money, on login his money stay 0 ....

sory for bad english


Re: Can't save player's score and money when he quit the game - Kimossab - 17.06.2014

Have you used GivePlayerMoney in any part of that? If yes does the files really save?


Re: Can't save player's score and money when he quit the game - bijela - 17.06.2014

GetPlayerScore(playerid); and GivePlayerMoney


Re: Can't save player's score and money when he quit the game - Kimossab - 17.06.2014

Does the file save? Or does it save the right values?

Also show the full code where you use dini_IntSet and dini_Int without it we can't help you.


Re: Can't save player's score and money when he quit the game - bijela - 17.06.2014

Код:
public OnPlayerDisconnect(playerid, reason)
{
	dini_IntSet(file, "Score", PlayerInfo[playerid][pScore]);
	dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]); 
	dini_IntSet(file, "RobLevel",PlayerInfo[playerid][pRobRank]);
	dini_IntSet(file, "Money", GetPlayerMoney(playerid));
return 1;
}
admin and rob pinfo work good

and for playerrigester

Код:
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0); 
dini_IntSet(file, "RobLevel",PlayerInfo[playerid][pRobRank] = 0);
dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 3000);
dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0);
and on login

Код:
	PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel"); 
PlayerInfo[playerid][pScore] = dini_Int(file, "Score");
PlayerInfo[playerid][pCash] = dini_Int(file, "Money");
did you mean this? And where is problem...


Re: Can't save player's score and money when he quit the game - Kimossab - 17.06.2014

on login are you sure you use the GivePlayerMoney? show the full code of the login


Re: Can't save player's score and money when he quit the game - bijela - 17.06.2014

gPlayerLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
PlayerInfo[playerid][pScore] = dini_Int(file, "Score");
PlayerInfo[playerid][pCash] = dini_Int(file, "Money");


Re: Can't save player's score and money when he quit the game - bijela - 17.06.2014

bump!!!


Re: Can't save player's score and money when he quit the game - jueix - 17.06.2014

dini_IntSet(file, "Money", Playerinfo[playerid][pCash]);

instead of

dini_IntSet(file, "Money", GetPlayerMoney(playerid));

under

Код:
public OnPlayerDisconnect(playerid, reason)
{
	dini_IntSet(file, "Score", PlayerInfo[playerid][pScore]);
	dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]); 
	dini_IntSet(file, "RobLevel",PlayerInfo[playerid][pRobRank]);
	dini_IntSet(file, "Money", GetPlayerMoney(playerid));
return 1;
}



Re: Can't save player's score and money when he quit the game - bijela - 17.06.2014

the same problem....