MySQL auto update or something.
#1

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

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

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.
Reply
#4

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

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

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

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

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!
Reply
#9

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)