Jump to content

HELP toggleControl[not solved]


#RooTs

Recommended Posts

Hello guys I'm trying to set this function to the player does not fire in overhead the bike.

What is wrong?

function disableFireForHydra ( theVehicle, seat ) 
local Vehicle = getPedOccupiedVehicle(getLocalPlayer()) 
    if Vehicle then 
        local Type = getVehicleType(Vehicle) 
        if Type == "Motorbikes" or Type == "Bicycles" then 
            toggleControl ( "vehicle_secondary_fire", false ) 
        else 
            toggleControl ( "vehicle_secondary_fire", true ) 
        end 
    end 
end 
addEventHandler ( "onClientPlayerVehicleEnter", getRootElement(), disableFireForHydra ) 

other controls to set

toggleControl ( "aim_weapon", false) 
toggleControl ( "vehicle_fire", false) 
toggleControl ( "fire", false) 

Edited by Guest
Link to comment
Hello ? :o

be patient bro , anyways try this

local vehicleType = {["BMX"] = true, ["Bike"] = true} 
local controls = {"vehicle_secondary_fire","vehicle_secondary_fire","aim_weapon","vehicle_fire", "fire"} 
  
function disableFire ( theVehicle, seat ) 
    if theVehicle then  
        local Type = getVehicleType(theVehicle) 
        if vehicleType[Type] then 
             for i, v in pairs(controls) do 
                toggleControl(tostring(v), false) 
            end 
        else 
             for i, v in pairs(controls) do 
                toggleControl(tostring(v), true) 
            end 
        end 
    end 
end 
addEventHandler ( "onClientPlayerVehicleEnter", getRootElement(), disableFire ) 

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