Jump to content

Vehicle reload does not work


Einheit-101

Recommended Posts

Posted

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 
  

n-560x95_FFFFFF_FFFFFF_000000_000000.png

Posted
if (getControlState ( "vehicle_fire" )) then 

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

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?

n-560x95_FFFFFF_FFFFFF_000000_000000.png

Posted
if (getControlState("vehicle_fire") or getControlState("vehicle_secondary_fire")) then 

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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