Score problem..
#1

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

*BUMP, please I need help on this
Reply
#3

when the player disconnects whats your code there?
Reply
#4

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

*SIGH* anyone knows why this is happening.

Help please..
Reply
#6

nvm, nobody seems to know this

I guess ill re-make the register and login
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)