Jump to content

Fixing help


Timiimit

Recommended Posts

Posted

Hi!

i'm making today yet another topic.

This one is about Fixing vehicles.

So this is what i have:

  
 function vehFix ( source ) 
    theVehicle = getVehicleOccupant ( source ) 
    fixVehicle ( theVehicle ) 
end 
  
setTimer ( vehFix, 3000, 0 ) 
  

its not working!

it should fix vehicle player is in every 3 sec(if you know how to make it when vehicle gets damaged please tell me).

in game nickname: [GFL]TimiimiT

Posted
function vehFix ( loss ) 
    theVehicle = getPedOccupiedVehicle ( source ) 
    thePlayer = getVehicleOccupant( source ) 
    setElementHealth(theVehicle,getElementHealth(theVehicle)+tonumber(loss)) 
end 
addEventHandler("onVehicleDamage",getRootElement(),vehFix) 
  

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%
Posted

not working.

errors:

  
[2012-01-27 16:43:32] WARNING: myscripts\vehFix.lua:2: Bad 'ped' pointer @ 'getPedOccupiedVehicle'(1) 
[2012-01-27 16:43:32] WARNING: myscripts\vehFix.lua:4: Bad argument @ 'getElementHealth' 
[2012-01-27 16:43:32] ERROR: myscripts\vehFix.lua:4: attempt to perform arithmetic on a boolean value 
  

in game nickname: [GFL]TimiimiT

Posted
function vehFix ( loss ) 
thePlayer = getVehicleOccupant( source ) 
    theVehicle = getPedOccupiedVehicle ( thePlayer ) 
     
    setElementHealth(theVehicle,getElementHealth(theVehicle)+tonumber(loss)) 
end 
addEventHandler("onVehicleDamage",getRootElement(),vehFix) 

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%
Posted
    function vehFix ( thePlayer) 
    theVehicle = getPedOccupiedVehicle ( thePlayer )--Checks if the player is in the vehicle. 
    if (theVehicle) then --If it is in the vehicle fix it 
        fixVehicle(theVehicle) 
    end  
    end 
    addEventHandler("onVehicleDamage",getRootElement(),vehFix)-- Turining on vehFix when vehicle crash 
    setTimer(vehFix, 1000, 1) -- Will be fix the vehicle every second. 

Posted

Klesh, wont work :D (again)

vehFix needs arguments. You cant just use thePlayer without declaring it

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%
Posted

Like that ?

  
function vehFix(thePlayer) 
    if thePlayer then 
        theVehicle = getPedOccupiedVehicle(thePlayer) 
        if theVehicle then 
            local domage = getElementHealth ( theVehicle ) 
            if domage < 100 then 
                fixVehicle(theVehicle) 
            end 
        end 
    end 
end 
  
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), 
function() 
    for i, player in ipairs(getElementsByType("player"))do 
        setTimer(vehFix, 1000, 0, player) 
    end 
end) 
  

Paid developer. Twitter: @willia_am -

http://www.williamdasilva.fr

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