I’ve seen many cases of people registering commands within the client-side using the RegisterCommand function. This made me wonder why no one does this on the server-side. Is it because it’s not possible? Or is it just inconvenient? Or does it only make sense in my imagination?
Example of the logic I think is ideal (ONLY a logic representation, not the way to write the code):
server.lua:
RegisterCommand("getmyposition"....)
local coords = GetEntityCoords(MyPlayerId)
SendDataToClientFunction(coords)
end
client.lua:
ReceiveServerDataFunction(coords)
SendPlayerNotification("Your actual Pos:" coords)
Just to make it clear, this is only a logic demonstration. I’m learning the technical side from scratch, and since I don’t know anything about Lua/FiveM yet, I’m just trying to understand why the logic isn’t done this way. At least from what I’ve seen, it’s not done the way I presented above. The way people do it here is like this:
client.lua:
RegisterCommand("getmyposition"....)
local coords = GetEntityCoords(MyPlayerId)
SendPlayerNotification("Your actual Pos:" coords)
end
If anyone could explain this to me, I would greatly appreciate it!!!