My friends and I are brand new to FiveM and even more so to running our own server. Our hope is to add a lot of the GTAO experience into the server. One thing we miss is the leveling of the stats. I’ve done quite a bit of searching and it seems according to this thread that an update to the game server allows for this mechanic.
I haven’t been able to find a resource that adds the GTAO style stats that increase as you shoot, headshot, swim underwater, run, etc. Maybe I am just missing it?
Does such a resource exist and if it doesn’t, how hard would it be to write something like this? The server we would be running this on is rented from Zap and has ES, ESX, MySQL Async installed.
Hi there Vespura and thanks very much for taking the time to help me out. I intend on trying my hand at making a resource for this(I can’t find anything similar) and not knowing a thing about creating one, I’m going to do it in baby steps.
I imagine that I also would have to update the database periodically during gameplay. For instance if someone were to get 15 headshots and 20 kills within a time period, it would be best if they were saved during gameplay so that progress wouldn’t be lost if the client disconnected unexpectedly.
To keep the overhead down, it might be best to tackle it in a manner that every 30 or 60 seconds, if the numbers stored have changed, update the database.
Does that sound like the way to tackle this? I don’t know how to do any of this yet but it will give me a direction in which to work.
yes, even better: save a few changes on the client, and if there are either too many changes or some time has passed, send it to the server. Then the server will keep it saved in run-time, and only once every minute or so will it update the actual database to prevent a lot of database changes when a lot of players are online.
I have been doing some searching hoping to learn how the system works. My intention is to convert the example [ESX]Boilerplate to write the addon.
First, I figured I should have the sql to base it off of. This is what I ended up with, thanks to your paste above:
CREATE TABLE `playerstats` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`owner` varchar(255) NOT NULL,
`stamina` int(3) NOT NULL,
`strength` int(3) NOT NULL,
`lung_capacity` int(3) NOT NULL,
`wheel_ability` int(3) NOT NULL,
`flying_ability` int(3) NOT NULL,
`shooting_ability` int(3) NOT NULL,
`stealth_ability` int(3) NOT NULL,
PRIMARY KEY (`id`)
);
My intention is to bind the tables to the Steam ID.
I think my next step is to write the code that checks for the existence of a table relating to the user’s steamID and if it exists, load the data or creating a new table with the starter stat data if it doesn’t.
I’ve been browsing my server resource files to see if I can take something from them to kickstart this but I’m not smart enough to recognize the relevant code.
Can you(or anyone for that matter) help me in getting this part of the code started? I can post the boiler plate resource’s code if that’s something that can be built off of.
I see but maybe I can ask you this. I was leaning toward esx because it looked like it was handling syncing and remembering character data well. Would it be as easy to do this without relying on that framework? I’ve seen a lot of your resources so I know it can be done but haven’t come across a resource that I could use to learn from or fork to modify. A lot of them use compiled eleme ts that I can’t work with.
Sorry if this is too broad but I appreciate your help thus far.
I’ve made almost no progress on it, unfortunately. I’m not good enough at lua yet to make it on my own and there was no assistance to be had in the channels I asked for help in.
I still plan on tackling it when I"m better prepared but that’s a ways down the road, I figure.