I’m probably not going to explain this very well, but I will try my best!
The client and server as two completely separate things. The server code is well… the server. The client code is the code that is running on each and every client. The server has no idea about the game. The server only relays internet traffic between the clients. The server can tell clients what to do by triggering events on the client(s).
You can only use native GTA functions on the client side (because the server doesn’t know anything about the game). What you would need to do is create an event handler in the client code for setting the health. Then, you will need to trigger it from the server on what client you want it to trigger on. You are already triggering the event ‘chatMessage’ on the specific client. You just need another event for setting health and put that native (SetEntityHealth) there.
If that doesn’t make any sense, think of the server as a traffic light and think of the clients as all of the cars on the road. The cars can do different things like accelerate, brake, turn, etc. The traffic light can send a message to the cars for them to do these things.
If I can explain this a little better, let me know.
4 Likes