Server Sided Money and MoneyBar desync problem
#1

Okay so my server is now on v2.4.5, prior to this update our money bar & money server sided have been synced together, I use playerinfo[playerid][pCash] as my enum, now the money gets saved via mysql, which is all fine
when I go /stats, the money is there, but in the money bar at the top right, its 0, i've been fiddling with it and at the moment ive got it so when you login, it shows your money in the bar, but any changes after that are not accounted for, I know I have options such as textdraws, but that means a hell of alot of timers/checks, so if anyone has any ideas id love to hear it, i'm looking for a way for it to always stay actively the same.
Reply
#2

Well, Try doing this OnPlayerUpdate(playerid)
pawn Код:
If(playerinfo[playerid][pCash]!=GetPlayerMoney(playerid))
{
    GivePlayerMoney(playerid, -GetPlayerMoney(playerid));
    GivePlayerMoney(playerid, playerinfo[playerid][pCash]);
}
Edit: Or setup a timer checking for it every 1 second
Reply
#3

Without your code there could be a million issues causing this problem...
We can just take some guesses now, so if you want some real educated help, then share your code with us.

What I'm guessing here:
Whenever the money of a player changes and is updated to the mysql DB, you do not get the new money value from the DB correctly and therefor set the money to "0" instead of the amount in the DB.
That will not require any timer or whatever
Reply
#4

interesting, will test SystemX's, if failed.. by the looks of it, I doubt it will fail, but if it does, ill paste code, see if others can figure it out XD
Reply
#5

I feel so stupid right now, wasted everyone's time, I have all my timers inside an included .pwn
Код:
if(CGRPLOGGEDIN[i] == 1)
{
Meaning if they are logged in > it would continue, which futher down has my 1 second timer for the money update

but it was set to this by accident.
if(CGRPLOGGEDIN[i] == 0)
{
meaning if they aint logged in XD -facepalm- 
but atleast I realize the fault, still was helpful, and now I dont need to clog OnPlayerUpdate :P
Reply
#6

I feel so stupid right now, wasted everyone's time, I have all my timers inside an included .pwn
Код:
if(CGRPLOGGEDIN[i] == 1)
{
Meaning if they are logged in > it would continue, which further down has my 1 second timer for the money update
but it was set to this by accident.
Код:
if(CGRPLOGGEDIN[i] == 0)
{
meaning if they aint logged in XD -facepalm-
but atleast I realize the fault, still was helpful, and now I dont need to clog OnPlayerUpdate :P
Reply
#7

R.I.P, You just bumped 3 times.
Reply
#8

Oh shit, rip imma get infractions >_< oh well, ill fix it if I do
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)