SA-MP Forums Archive
Timer to check database - 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)
+--- Thread: Timer to check database (/showthread.php?tid=648509)



Timer to check database - NLDBrian - 23.01.2018

Hi there!

As I'm working on a webshop system I am trying to figure out if it's possible to make the GM check certain values in the SQL database every 5/10 minutes..

For example:

Player buys 4 gold coins

DB player account:
"gold" was 0 is now 4

Timer checks and notices "coins" is 4

Gamemessage for player if value changed (if unchanged, no matter what number)
You have bought 4 gold coins!

Or is there a better way to do this?

Thanks


Re: Timer to check database - InfiniTy. - 23.01.2018

The best way IMO is to use sockets (plugin), but you could also do it your way, that would work too, but if you are doing a query for each player at the same time for example, that could be bad in the long-run when you are probable to have lots of players. If you are not limited by your samp host then i'd suggest you use sockets