Jump to content

[HELP] How to make setElementPosition only for local player?


Tokio

Recommended Posts

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 by Tails
  • Thanks 2
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...