Apo Posted May 3, 2016 Posted May 3, 2016 hi guys please help me for fix script in need help for make Hoot by car for open and close gate only open and close by Beeping checkGateMarker = createMarker (1588.53125, -1637.988, 7.630457115173, "corona", 10.0, 0, 0, 255, 0 ) function createGate (thePlayer) gatePolice = createObject ( 3055, 1588.53125, -1637.988, 13.630457115173 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createGate ) function gateCheckingTeam ( thePlayer,seat ) local seat = getPedOccupiedVehicleSeat(thePlayer) if seat == 0 then moveObject ( gatePolice, 976, 1588.53125, -1637.988, 7.630457115173 ) end end addEventHandler ( "onMarkerHit", checkGateMarker, gateCheckingTeam ) function onLeave ( thePlayer ) setTimer ( movingBackPolice, 3000, 1, thePlayer ) end addEventHandler ( "onMarkerLeave", checkGateMarker, onLeave ) function movingBackPolice () moveObject ( gatePolice, 3000, 1588.53125, -1637.988, 13.630457115173 ) end
mint3d Posted May 3, 2016 Posted May 3, 2016 (edited) Try this it might work.. checkGateMarker = createMarker (1588.53125, -1637.988, 7.630457115173, "corona", 10.0, 0, 0, 255, 0 ) function createGate (thePlayer) gatePolice = createObject ( 3055, 1588.53125, -1637.988, 13.630457115173 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createGate ) function gateCheckingTeam ( thePlayer,seat ) local seat = getPedOccupiedVehicleSeat(thePlayer) if seat == 0 then moveObject ( gatePolice, 976, 1588.53125, -1637.988, 7.630457115173 ) end end addEventHandler ( "onMarkerHit", checkGateMarker, gateCheckingTeam ) function onLeave ( thePlayer ) setTimer ( movingBackPolice, 3000, 1, thePlayer ) end addEventHandler ( "onMarkerLeave", checkGateMarker, onLeave ) function movingBackPolice () moveObject ( gatePolice, 3000, 1588.53125, -1637.988, 13.630457115173 ) end function horn (player, commandName) bindKey ( player, "H", "down", gateCheckingTeam ) end addEventHandler ("onResourceStart", horn) Edited May 3, 2016 by Guest
#|_oskar_|# Posted May 3, 2016 Posted May 3, 2016 @mint3d this client side event onClientResourceStart use event onResourceStart on server side
Apo Posted May 4, 2016 Author Posted May 4, 2016 not work please test and help me checkGateMarker1 = createMarker (1544.6999511719, -1630.8000488281, 13.199999809265, "corona", 10.0, 0, 0, 255, 0 ) function createGate1 (thePlayer) gatePolice1 = createObject ( 968, 1544.6999511719, -1630.8000488281, 13.199999809265, 0, 90, 89.999938964844 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createGate1 ) function openbase_area69gates(thePlayer) moveObject (gatePolice1, 1000, 1544.69921875, -1630.7998046875, 13.199999809265, 0, -90, 0 ) end function onLeave1 ( thePlayer ) setTimer ( closebase_area69gates, 3000, 1, thePlayer ) end addEventHandler ( "onMarkerLeave", checkGateMarker1, onLeave1 ) function closebase_area69gates(thePlayer) moveObject (gatePolice1, 1000, 1544.6999511719, -1630.8000488281, 13.199999809265, 0, 90, 0 ) end addEventHandler ("onResourceStart",getRootElement(), horn) function horn (thePlayer, commandName) bindKey ( thePlayer, "H", "down", closebase_area69gates ) end addEventHandler ("onResourceStart",getRootElement(), horn)
#|_oskar_|# Posted May 5, 2016 Posted May 5, 2016 local x,y,z = 1544.6999511719, -1630.8000488281, 13.199999809265 local gatePolice1 = createObject ( 968,x,y,z, 0, 90, 89.999938964844 ) function onLeave1(player) setTimer(function(player) if isElement(player) then bindKey (player, "H", "down",openbase_area69gates) end end,6100,1,player) moveObject (gatePolice1,6000,x,y,z, 0, 90, 0) end --------- function openbase_area69gates(player) if(getDistanceBetweenPoints3D(x, y, z, getElementPosition(player)) < 15) then setTimer (onLeave1,6100, 1,player) unbindKey (player, "H", "down",openbase_area69gates) moveObject (gatePolice1,6000,x,y,z, 0,-90, 0 ) end end --------- addEventHandler ( "onResourceStart",resourceRoot,function () for theKey, thePlayer in ipairs (getElementsByType ( "player" )) do bindKey (thePlayer, "H", "down",openbase_area69gates) end end) addEventHandler ( "onPlayerJoin",root,function () bindKey (source, "H", "down",openbase_area69gates) end)
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