Dzsozi (h03) Posted June 9, 2014 Author Share Posted June 9, 2014 Okay, thanks! I have an idea how to do this. I'm going to freeze the player after five seconds when be hit the marker, after five seconds if he's still in the marker it will be succes, else if he's outside it will be a failure. I Think it's gonna work, thank you! Will try jt or something like that. You Can Try with this , https://wiki.multitheftauto.com/wiki/Is ... thinMarker That's what I wanted to try, but thanks! Link to comment
Dzsozi (h03) Posted June 9, 2014 Author Share Posted June 9, 2014 Okay, I've done something, but I can't find a better way. Does someone know something better? The problem is that it only triggers when you hit the marker, so there will be only a failure if someone leaves the marker. function landingMarker() parachuteLandMarker = createMarker(1948.9521484375, -2273.642578125, 13, "cylinder", 5, 255, 0, 0, 125) parachuteLandMarkerBlip = createBlipAttachedTo(parachuteLandMarker, 0, 3, 255, 255, 255, 255) if isPlayerOnGround (localPlayer) then --elseif isPlayerOnGround (localPlayer) and not isElementWithinMarker(localPlayer, parachuteLandMarker) then --outputChatBox("failure") addEventHandler("onClientMarkerHit", parachuteLandMarker, function() check = setTimer ( function() setElementFrozen(localPlayer, true) if isElementWithinMarker(localPlayer, parachuteLandMarker) then fadeCamera(false, 2) outputChatBox("succes") setElementFrozen(localPlayer, false) resetPosition() else fadeCamera(false, 2) killTimer(check) outputChatBox("failure") setElementFrozen(localPlayer, false) resetPosition() end end, 5000, 1 ) end ) end end The reason why I made the marker inside the function because I'm triggering it with the yesBtn. Link to comment
Dzsozi (h03) Posted June 10, 2014 Author Share Posted June 10, 2014 I made it in other way. Now my only problem is that when I write localPlayer and not source it will be always a failure, and everyone gets a message. But if I write source the script is not working. How can I check "name" the player who clicked on the yes button? So the script would react only with this player who clicked on the gui element. function landingMarker() parachuteLandMarker = createMarker(1753.0849609375, -2544.6044921875, 13, "cylinder", 5, 255, 0, 0, 125) parachuteLandMarkerBlip = createBlipAttachedTo(parachuteLandMarker, 0, 3, 255, 255, 0, 255) --elseif isPlayerOnGround (localPlayer) and not isElementWithinMarker(localPlayer, parachuteLandMarker) then --outputChatBox("failure") check = setTimer ( function() if isElementWithinMarker(source, parachuteLandMarker) and isPlayerOnGround (source) then outputChatBox("succes") triggerServerEvent('takeParachuteFromPlayer', source) setElementPosition(source, 1953.3623046875, -2219.1474609375, 13.546875) destroyElement(parachuteLandMarkerBlip) destroyElement(parachuteLandMarker) setElementFrozen(source, false) elseif isPlayerOnGround (source) and not isElementWithinMarker(source, parachuteLandMarker) then outputChatBox("failure") triggerServerEvent('takeParachuteFromPlayer', source) setElementPosition(source, 1953.3623046875, -2219.1474609375, 13.546875) destroyElement(parachuteLandMarkerBlip) destroyElement(parachuteLandMarker) setElementFrozen(source, false) end end, 2000, 0 ) end Please help me! I would appreciate it! Link to comment
Den. Posted June 10, 2014 Share Posted June 10, 2014 If landingMarker is called by the event onClientGUIClick, source is the GUI element clicked. The player who clicks it is always going to be localPlayer. Link to comment
Dzsozi (h03) Posted June 10, 2014 Author Share Posted June 10, 2014 But how can I fix this function? If I write source the script is not working, my position is not changing, there's no text in the chatbox, etc. How can I fix this, so only the player who clicks yes can be triggered with the marker, set a new position, take the parachute, etc. Could you help me please? Link to comment
Dzsozi (h03) Posted June 10, 2014 Author Share Posted June 10, 2014 Oh, nevermind, I fixed it! Thank you for your help guys! 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