Skraund Posted March 28, 2018 Posted March 28, 2018 Hello, I created a function that changes the color of the square from white to black on command. But I had a problem, the color should change only for the player who entered it, and it changes for all players on the server, how can I fix it? Event handler: addEventHandler( "onClientHUDRender", getRootElement(), d )
myonlake Posted April 1, 2018 Posted April 1, 2018 I need to see more code in order to be able to point out the problem.
Gaborboy95 Posted April 15, 2018 Posted April 15, 2018 addCommandHandler("commandname", function(player, cmd) --trigger some event to client with player variable end ) You can get the player who entered it by using this
Gaborboy95 Posted April 16, 2018 Posted April 16, 2018 Or you can add the command handler on the client side.
Skully Posted April 17, 2018 Posted April 17, 2018 You're probably running the event for all clients, make sure you only forward the client that issues the command using the example provided above.
JeViCo Posted April 17, 2018 Posted April 17, 2018 I think you trigger events with getRootElement() server-side. If you use triggerServerEvent("someEvent",root,args) your local player here is source. BUT if you trigger client use this: triggerClientEvent("some_client_event", root, args). If you use getRootElement() instead of root , it will trigger for ALL player. Make sure u read wiki properly
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now