How would I save my money using tmysql4

So how would I exactly save my money using tmysql4.

Are you using DarkRP? If so, it already has built-in tmysql4 support. All you have to do is make sure you do not have the MySQLoo module installed as well, and of course update the config to match your database’s credentials.

Something like this

function SetMoney(pl, amount, callback)
	db:Query('UPDATE player_data SET Money=' .. amount .. ' WHERE SteamID=' .. pl:SteamID64(), callback)

Here’s an example currency system that’s only missing the load / save feature:

The reason I’m providing this is to serve as an example because it calls the load / save in appropriate places. StonedPenguin is correct in terms of the query although I’d use SQLStr to ensure the amount value isn’t a string to delete the database ( although if someone got to things like that assuming you don’t trust user input, then it wouldn’t matter anyways )…

I’d recommend loading on join, and saving on DC or map change with an intermittent save ( 5 minutes if the data has changed ) to ensure the data is saved even in the event of a crash…

Example queries / structures: