Hi guys!
I’m fairly new to FiveM development, so any suggestions are welcome!
Right now my script loads user variables from a mysql database when the player is connecting. However, I can’t find a way to store them. Should I store them client-side (but how would I then communicate player variables across clients?)?
As the server is ‘centralized’ I thought that would be a common place to store server-wide variables, even if it is for players only. Later on I will need to add factions. So perhaps I’d need to save faction-information in a server scope aswell?
Right now my script retrieves the mysql user row and adds it to a list of players (custom list). I can’t find a way to retrieve the ID of the player, as it obviously is a client ID. So therefore it makes no sense to add the player in a server-side list without a player ID. I guess there is no way to trigger a client event and send the client player ID to the server in the same scope?
I’m sorry if this sounds vague, I’m desperately trying to find methods/constructs on how things work. I hope you can give me some direction. I’m writing my client and server code in C# by the way.
Thanks in advance!