Im fairly new to using mysql, i’ve used it in php but its been a bit of time so i wanted to explore it with lua. I wanted to make a client side script where the user runs a commands, it connects to the database, they get a reward in money based on a value in the database and then it sets another value to 1 making it unusable.
function Retrieve() require('tmysql') tmysql.initialize(localhost, root, password, 3306) --not real info... end concommand.Add( "retrieve", Retrieve )
I know i would need to run a check in the database to see if the used == 1 or 0 and if it equals 0 then it allows the user to get the reward.
So basically all i need is a little info on tmysql.
An example of how the database looks
CODE | VIP | USED 1234 | 5 | 0
Once they run the command retrieve in the console like this
The database would now look like this
CODE | VIP | USED 1234 | 5 | 1
And since the used column == 1, when they run
they wouldnt get a reward
For now instead of it giving a reward could we just make it Msg( “you ran the command successfully” ) if the used column == 0 and Msg( “you ran the command and failed” ) if the used column == 1
Sorry that im terrible at explaining and my code is usually always messy, ask question if you need more info
I don’t even know if im allowed to put the tmysql there or if it has to be Initialize function