Tokio Posted January 14, 2018 Share Posted January 14, 2018 function test() setElementPosition ( mark, pos.x,pos.y,pos.z ) end addEventHandler("onMarkerHit", mark, test) this is the code. if i hit the marker, the element position change for all players.. how to fix this? sorry for my bad english. Link to comment
3aGl3 Posted January 14, 2018 Share Posted January 14, 2018 Just execute the code on the clients side only. You probably want to create the marker on the client, and send the touch event off to the server so the server can check if the player isn't cheating or similar. Link to comment
Tails Posted January 14, 2018 Share Posted January 14, 2018 (edited) 1 hour ago, 3aGl3 said: Just execute the code on the clients side only. You probably want to create the marker on the client, and send the touch event off to the server so the server can check if the player isn't cheating or similar. The client event is triggered for all clients you'd have to add a check as well then. Put the code on the client side as well as the marker and use the onClientMarkerHit event. The event's callback returns 2 arguments, the element that hit the marker and the matching dimension. Ignore the latter for now. Example: local mark = createMarker(0, 0, 4, "arrow", 1) function onHit(element) if (element == localPlayer) then -- check if the element is the localPlayer (you) outputChatBox("hit") end end addEventHandler("onClientMarkerHit", mark, onHit) Hope this helps Edited January 14, 2018 by Tails 2 Link to comment
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