Jump to content

vehicle weapons problem


Vercetti1010

Recommended Posts

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

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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...