Jump to content

Vehicle reload does not work


Einheit-101

Recommended Posts

Hello again!

I have made a script which should prevent the rhino from firing so fast (reload-script) but whats wrong? No error messages, nothing happens:

CLIENT:

  
fired = false 
  
function toggle1() 
local Player = getLocalPlayer() 
if fired == false then 
    if isPedInVehicle ( Player ) then 
        local theVehicle = getPedOccupiedVehicle ( Player ) 
        if ( getElementModel ( theVehicle ) == 432 ) then 
            if (getControlState ( vehicle_fire )) then 
                setTimer (function() 
                toggleControl ( "vehicle_fire", false ) 
                toggleControl ( "vehicle_secondary_fire", false ) 
                end, 500, 1) 
                fired = true 
                setTimer (toggle2, 8000, 1) 
            end 
        end 
    end 
end 
end 
addEventHandler ( "onClientRender", getRootElement(), toggle1 ) 
  
function toggle2() 
    toggleControl ( "vehicle_fire", true ) 
    toggleControl ( "vehicle_secondary_fire", true ) 
    fired = false 
end 
  
-no server.lua 
  

Link to comment

Ohhh i hate those n00b errors... thanks. I look after it.

EDIT:::

It works now. But how can i make an "or" because the script doesnt trigger vehicle_secondary_fire. so:

if (getControlState ( "vehicle_fire" )) OR (getControlState ( "vehicle_secondary_fire" ))  then 

...

how to make an or?

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