TheMaysTRo Posted July 30, 2014 Share Posted July 30, 2014 Hello. i created a marker and i called it "paymarker" then i created another marker at the whole place and i wanted to kill all player that are in the "killmarker" when someone hit the "paymarker" and this is the code :(i don't know why its not working , no error on console.) paymarker = createMarker ( 2620.49609375,-1750.9696044922,1464.6059570313 ,"cylinder",2,255,2,0,180) local killmarker = createMarker (2614.2666015625,-1754.1813964844,1442.5999755859, "cylinder", 290, 2500, 0, 0, 100, getRootElement()) setElementVisibleTo (killmarker,root,false ) function kill(player) if isElementWithinMarker(player, killmarker) then killPed (player) end end addEventHandler( "onMarkerHit", paymarker,kill ) Help Please. Link to comment
Mr_Moose Posted July 30, 2014 Share Posted July 30, 2014 First argument of function kill is "Player" but it's not necessary a player element, it's the element that hit's your pay marker and due to that this element can't be in the kill marker. This part is correct: if isElementWithinMarker(player, killmarker) then killPed (player) end but you have to replace player to the players inside the kill maker in order to make it work, the easiest way is probably to loop through all players and check who's in the kill maker like this: for i, p in ipairs(getElementsByType("player")) do if isElementWithinMarker(p, killmarker) then killPed (p) end end Link to comment
TheMaysTRo Posted July 30, 2014 Author Share Posted July 30, 2014 First argument of function kill is "Player" but it's not necessary a player element, it's the element that hit's your pay marker and due to that this element can't be in the kill marker. This part is correct: if isElementWithinMarker(player, killmarker) then killPed (player) end but you have to replace player to the players inside the kill maker in order to make it work, the easiest way is probably to loop through all players and check who's in the kill maker like this: for i, p in ipairs(getElementsByType("player")) do if isElementWithinMarker(p, killmarker) then killPed (p) end end Thanks Alot 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