SA-MP Forums Archive
MySQL auto update or something. - 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: MySQL auto update or something. (/showthread.php?tid=255834)



MySQL auto update or something. - KaleOtter - 17.05.2011

Hello.

I'm currently scripting a roleplay gamemode with SQL.
On my website you can for example buy or sell vehicles.
But the problem is that you should be out of game when you login at the website.
Because if I take $1000 away from a user on the website, and he is at that moment ingame, then when he logs off the money will be overwriten.

So I'm asking is there something to send a message to the server that his money has been go up or down?
And yea I can use a timer that checks every second if the user data has been changed, but that will fuckup my server traffic.
So maybe somebody know another way?

Greets KaleOtter


Re: MySQL auto update or something. - iGamer - 17.05.2011

No other way, just set the timer to a bigger amount of time.


Re: MySQL auto update or something. - KaleOtter - 17.05.2011

Yea but if players know that, they can logoff fast before the timer checks it. And I cannot check it when they logoff because if they have changed there ingame amount of money then that will be overwriten. Why isn't there a plugin or something that will send a message to the server when something changes lol.
Well I gues I have to do it without loggin in on website and server.


Re: MySQL auto update or something. - Raimis_R - 17.05.2011

Or you can when player connected set in the DB Logged:1 and check with php: if Logged:1 you cant use this function. or something like.


Re: MySQL auto update or something. - KaleOtter - 17.05.2011

I already did that, but thats what I dont want , because then you can not login on both. But I think there is no other way then that


Re: MySQL auto update or something. - __ - 17.05.2011

Yes you can.

Detect if they're in-game with the logged variable and just prevent them from executing the buy/sell car action until they disconnect from the game.


Re: MySQL auto update or something. - KaleOtter - 18.05.2011

you dont get my point, I already did that.
But i want to avoid that, but it's not possible so forget my question.


Re: MySQL auto update or something. - KaleOtter - 18.05.2011

Thanks ******.
I was thinking about the storing twice option before but the way you tell it to me looks good working.
So I will update the money data of the person every time his money amount changes. This wont cause to much traffic I gues.
What I also can do is using something like: CheckPlayerMoney(playerid); every time the player attemps to spend some money, and if it seems the money has been changed in the database (on the website) then his money will get updated.
So I wont use the dubble arrays in the database.
I'm going to think about this solution, Thanks!


Re: MySQL auto update or something. - __ - 18.05.2011

Quote:
Originally Posted by KaleOtter
Посмотреть сообщение
I already did that, but thats what I dont want , because then you can not login on both. But I think there is no other way then that
You said you wanted it so you can login on both, but you never said you wanted it so both values could be simeltanously updated.