-Doc- Posted March 19, 2016 Share Posted March 19, 2016 Hey, i made this script which toggles vehicle_fire when a projectile created and then restores it using timer but doesn't work. timer = {} addEventHandler("onClientProjectileCreation", localPlayer, function() if getElementModel(getPedOccupiedVehicle(getLocalPlayer())) == 520 then setElementData(localPlayer, "anti repeater", true); if ( getElementData(localPlayer, "anti repeater") == true ) then toggleControl("vehicle_fire", false); timer[source] = setTimer( function() toggleControl("vehicle_fire", true); setElementData(localPlayer, "anti repeater", false); end, 5000, 1 ) end end end) Link to comment
undefined Posted March 20, 2016 Share Posted March 20, 2016 Client: The source of this event is the projectile that was created. timer = {} addEventHandler("onClientProjectileCreation", root, function(creator) local vehicle = getPedOccupiedVehicle(creator) if vehicle and getElementModel(vehicle) == 520 then if setElementData(creator, "anti repeater", true) then triggerServerEvent("toggle_control", creator, false) timer[creator] = setTimer( function() triggerServerEvent("toggle_control", creator, true) setElementData(creator, "anti repeater", false) end, 5000, 1 ) end end end) Server addEvent("toggle_control", true) addEventHandler("toggle_control", root, function(enabled) toggleControl(source, "vehicle_fire", enabled) end) 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