FlorjanMTARP Posted August 13, 2014 Share Posted August 13, 2014 Client; local gate = createObject(17951, 1556.36, -2348.79, 13.54, 0, 0, 180) local marker = createMarker(1554, -2348.79, 12.54, "cylinder", 2, 255, 255, 255, 255) local garage = createObject(17950, 1560.36, -2348.79, 13.54, 0, 0, 90) function moveGate() if getAccountName(getPlayerAccount(player)) == "Florjan22" then moveObject(gate, 5000, 1556.36, -2348.79, 16.54) end end addEventHandler("onMarkerHit", marker, moveGate) function moveBack() moveObject(gate, 5000, 1556.36, -2348.79, 13.54) end addEventHandler("onMarkerLeave", marker, moveBack) It doesn't move when I enter the marker Link to comment
Et-win Posted August 13, 2014 Share Posted August 13, 2014 function moveGate() if getAccountName(getPlayerAccount(source)) == "Florjan22" then moveObject(gate, 5000, 1556.36, -2348.79, 16.54) end end addEventHandler("onPlayerMarkerHit", marker, moveGate) EDIT: Changed 'onPlayerMarkerHit' so it only activates when a player enters. In your function you forgot to define 'player' in the function. Link to comment
FlorjanMTARP Posted August 13, 2014 Author Share Posted August 13, 2014 (edited) EDIT) It still does nothing Edited August 13, 2014 by Guest Link to comment
FlorjanMTARP Posted August 13, 2014 Author Share Posted August 13, 2014 It does nothing doesn't work, I go in marker and I'm logged in and won't work. local gate = createObject(17951, 1556.36, -2348.79, 13.54, 0, 0, 180) local marker = createMarker(1554, -2348.79, 12.54, "cylinder", 2, 255, 255, 255, 255) local garage = createObject(17950, 1560.36, -2348.79, 13.54, 0, 0, 90) function moveGate() if getAccountName(getPlayerAccount(source)) == "Florjan22" then moveObject(gate, 5000, 1556.36, -2348.79, 16.54) end end addEventHandler("onPlayerMarkerHit", marker, moveGate) function moveBack() if getAccountName(getPlayerAccount(source)) == "Florjan22" then moveObject(gate, 5000, 1556.36, -2348.79, 13.54) end end addEventHandler("onPlayerMarkerHit", marker, moveBack) Link to comment
Et-win Posted August 13, 2014 Share Posted August 13, 2014 Because you are starting both 'moveGate' and 'moveBack' functions when you hit the marker. Link to comment
Max+ Posted August 13, 2014 Share Posted August 13, 2014 (edited) --serverSide , local gate = createObject(17951, 1556.36, -2348.79, 13.54, 0, 0, 180) local marker = createMarker(1554, -2348.79, 12.54, "cylinder", 2, 255, 255, 255, 255) local garage = createObject(17950, 1560.36, -2348.79, 13.54, 0, 0, 90) addEventHandler ( 'onMarkerHit', marker, function ( hitElement ) if ( getElementType ( hitElement ) == 'player' and not isPedInVehicle ( hitElement )) then if ( getAccountName(getPlayerAccount(hitElement)) == 'Florjan22') then moveObject(gate, 5000, 1556.36, -2348.79, 16.54) end end end ) addEventHandler ( 'onMarkerLeave', marker, function ( LeaveElement ) if ( getElementType ( LeaveElement ) == 'player' and not isPedInVehicle ( LeaveElement )) then if ( getAccountName(getPlayerAccount(LeaveElement)) == 'Florjan22') then moveObject(gate, 5000, 1556.36, -2348.79, 13.54) end end end ) Edited , Edited August 14, 2014 by Guest Link to comment
FlorjanMTARP Posted August 14, 2014 Author Share Posted August 14, 2014 It still doesn't go up, neither down. I get in the marker and nothing happens. No errors and stuff. server: local gate = createObject(17951, 1556.36, -2348.79, 13.54, 0, 0, 180) local marker = createMarker(1554, -2348.79, 12.54, "cylinder", 2, 255, 255, 255, 255) local garage = createObject(17950, 1560.36, -2348.79, 13.54, 0, 0, 90) addEventHandler ( 'onPlayerMarkerHit', marker, function ( ) if ( getAccountName(getPlayerAccount(source)) == 'Florjan22') then moveObject(gate, 5000, 1556.36, -2348.79, 16.54) end end ) addEventHandler ( 'onPlayerMarkerLeave', marker, function ( ) if ( getAccountName(getPlayerAccount(source)) == 'Florjan22') then moveObject(gate, 5000, 1556.36, -2348.79, 13.54) end end ) Link to comment
Max+ Posted August 14, 2014 Share Posted August 14, 2014 It still doesn't go up, neither down. I get in the marker and nothing happens. No errors and stuff.server: local gate = createObject(17951, 1556.36, -2348.79, 13.54, 0, 0, 180) local marker = createMarker(1554, -2348.79, 12.54, "cylinder", 2, 255, 255, 255, 255) local garage = createObject(17950, 1560.36, -2348.79, 13.54, 0, 0, 90) addEventHandler ( 'onPlayerMarkerHit', marker, function ( ) if ( getAccountName(getPlayerAccount(source)) == 'Florjan22') then moveObject(gate, 5000, 1556.36, -2348.79, 16.54) end end ) addEventHandler ( 'onPlayerMarkerLeave', marker, function ( ) if ( getAccountName(getPlayerAccount(source)) == 'Florjan22') then moveObject(gate, 5000, 1556.36, -2348.79, 13.54) end end ) I have Edited My Post , Copy it again , 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