SA-MP Forums Archive
Score problem.. - 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: Score problem.. (/showthread.php?tid=131660)



Score problem.. - [DDC]Delight - 04.03.2010

Hello guys,

Iґm having a problem with score update in the server.
Im using Dini, for register etc.

It saves this for score
Код:
dini_IntSet(udb_encode(playername), "Frags", Frags[playerid]);
This is under command register.
Код:
tmps1 = dini_Get(udb_encode(playername), "Frags");
Frags[playerid] = strval( tmps1 );
This is under command login
Код:
tmps1 = dini_Get(udb_encode(playername), "Frags");
if (strval(tmps1) == 1){
 SetPlayerScore(playerid, dini_Int(udb_encode(playername),"Frags"));
}
Under OnPlayerSpawn
Код:
SetPlayerScore(killerid, GetPlayerScore (killerid)+1);
Under OnPlayerDeath

Now this is the problem, it saves when registering to frags = 0
When I kill someone and alt+tab out of the game and open my file, it says I have frags = 1 (And that's good)
But when I leave the server it puts frags = 0 back.

Question is how could this happen and could someone explain me what is wrong..

Thanks in advance


Re: Score problem.. - [DDC]Delight - 05.03.2010

*BUMP, please I need help on this


Re: Score problem.. - rothhear - 05.03.2010

when the player disconnects whats your code there?


Re: Score problem.. - [DDC]Delight - 05.03.2010

Quote:
Originally Posted by rothhear
when the player disconnects whats your code there?
Код:
public OnPlayerDisconnect(playerid, reason)
{
SendDeathMessage(INVALID_PLAYER_ID, playerid, 201);
SaveFile(playerid);
return 1;
}
forward SaveFile(playerid);
public SaveFile(playerid)
{
	GetPlayerName(playerid, playername, sizeof(playername));

	if (dini_Exists(udb_encode(playername)) && logged[playerid] == 1) {
		dini_IntSet(udb_encode(playername), "money", GetPlayerMoney(playerid));
    	dini_IntSet(udb_encode(playername), "bank", bank[playerid]);
   	dini_IntSet(udb_encode(playername), "bounty", bounty[playerid]);
   	dini_IntSet(udb_encode(playername), "jailed", jailed[playerid]);
   	dini_IntSet(udb_encode(playername), "jailtime", jailtime[playerid]);
   	dini_IntSet(udb_encode(playername), "Frags", Frags[playerid]); //Used for score
		dini_IntSet(udb_encode(playername), "Ranking", Rank[playerid]);
		dini_IntSet(udb_encode(playername), "Total Warnings", TotalWarned[playerid]);
		dini_IntSet(udb_encode(playername), "skin", GetPlayerSkin(playerid)); // read below
	}
	return 1;
}
No warnings when compile so it's rly weird I have no clue what is wrong


Re: Score problem.. - [DDC]Delight - 06.03.2010

*SIGH* anyone knows why this is happening.

Help please..


Re: Score problem.. - [DDC]Delight - 07.03.2010

nvm, nobody seems to know this

I guess ill re-make the register and login