Vercetti1010 Posted January 13, 2009 Share Posted January 13, 2009 Hi guys, I have a slight problem. I am editing our vehicle spawning script to allow the spawn of potentially harmful vehicles to be safe by disabling the weaponry. The only problem is, it does not work. The script does not give me any errors or warnings when I do this. Can you guys help me out? Here is a snippet of the code. function disableGuns(thePlayer,seat,jacked) gunVehicle = getPlayerOccupiedVehicle(thePlayer) setVehicleGunsEnabled(gunVehicle,false) end addEventHandler("onVehicleEnter",getRootElement(),disableGuns) Link to comment
darkdreamingdan Posted January 13, 2009 Share Posted January 13, 2009 You're code looks fine, though you've added some unnecessary code. Try this: function disableGuns(thePlayer,seat,jacked) setVehicleGunsEnabled(source,false) end addEventHandler("onVehicleEnter",getRootElement(),disableGuns) I have not tried using the setVehicleGunsEnabled function myself. Anyone else care to test this function? If you still cannot get it to work, you may want to try using the toggleControl function instead - disabling the vehicle_fire and vehicle_secondary_fire should do the trick (however, these may interfere with Nitro, which also use the fire button). Link to comment
[DKR]silverfang Posted January 13, 2009 Share Posted January 13, 2009 You're code looks fine, though you've added some unnecessary code. Try this: function disableGuns(thePlayer,seat,jacked) setVehicleGunsEnabled(source,false) end addEventHandler("onVehicleEnter",getRootElement(),disableGuns) I have not tried using the setVehicleGunsEnabled function myself. Anyone else care to test this function? If you still cannot get it to work, you may want to try using the toggleControl function instead - disabling the vehicle_fire and vehicle_secondary_fire should do the trick (however, these may interfere with Nitro, which also use the fire button). But if you set up a table with all of the vehicles you want the buttons disabled for then only those vehicles will be unable to use nitro, and besides none of the vehicles really benefits from nos anyway. Also you wouldn't be able to use the hoses on the firetruck or swat truck... Link to comment
Vercetti1010 Posted January 13, 2009 Author Share Posted January 13, 2009 I ended up toggling the controls. Out of curiosity though, can someone verify that setVehicleGunsEnabled works? 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