PezFenix2016 Posted April 4, 2017 Share Posted April 4, 2017 Hello, this is just a little question, how can I know if a player already hit a marker? I mean, I created a marker, then executed certain functions once the player hit the marker, but it's executing those functions again when the player hit the marker again. How can I make a restriction for that? I just want it works only once (only when the player hit the marker for the first time). Someone told me to use tables so I can get the players' names on it, then make a restriction with those names, but I don't know how to start. can someone give me a hand with useful functions that I can use to make it works? thanks for taking your time on reviewing my topic. Link to comment
AE. Posted April 4, 2017 Share Posted April 4, 2017 you don't have to make tables :L just setElementData for the player who enter the marker and when he hit it if getElementData if its true then retrurn end and if its false continue the function Link to comment
Thrzu Posted April 4, 2017 Share Posted April 4, 2017 local enteredPlayers = {} local myMarker = createMarker(0, 0, 2.5, "cylinder", 2.0, 255, 0, 0, 150) function MarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == "player" and matchingDimension then if (not enteredPlayers[hitElement]) then enteredPlayers[hitElement] = true outputChatBox(getPlayerName(hitElement).." entered the marker for the first time.", hitElement, 0, 255, 0) else outputChatBox(getPlayerName(hitElement).." entered the marker before.", hitElement, 255, 0, 0) end end end addEventHandler( "onMarkerHit", myMarker, MarkerHit ) 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