Jump to content

Vehicles Bug


stefutz101

Recommended Posts

I disable hud for cars the same problem . :(

function onPlayerEnterDayzVehicle(veh,seat) 
local col = getElementData(veh,"parent") 
local id = getElementModel(veh) 
if not seat == 1 then return end 
local tires,engine = getVehicleAddonInfos (id) 
setVehicleEngineState ( veh, false ) 
setElementData(veh,"maxfuel",getVehicleMaxFuel(col)) 
setElementData(veh,"needtires",tires) 
setElementData(veh,"needengines",engine) 
if ((getElementData(col,"Tire_inVehicle") or 0) < tonumber(tires)) then 
    setVehicleEngineState ( veh, false ) 
    return   
end 
if ((getElementData(col,"Engine_inVehicle") or 0) < tonumber(engine)) then 
    setVehicleEngineState ( veh, false ) 
    return 
end 
if (getElementData(col,"fuel") or 0) <= 1 then 
    if not getElementModel(veh) == 509 then 
        triggerClientEvent (source, "displayClientInfo", source,"Vehicle","No tank left in this vehicle!",22,255,0) 
        setVehicleEngineState ( veh, false ) 
        return 
    end 
end 
setVehicleEngineState ( veh, true ) 
bindKey(source,"k","down",setEngineStateByPlayer) 
outputChatBox("Press 'K' to turn the engine on/off!",source) 
end 
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onPlayerEnterDayzVehicle ) 

Now i have error only for "setElementData(veh,"maxfuel",getVehicleMaxFuel(col))" .

Link to comment

You need to add these lines;

  
vehicleFuelTable = { 
-- {MODEL ID, MAX. FUEL}, 
{422,80}, 
{470,100}, 
{468,30}, 
{433,140}, 
{437,140}, 
{509,0}, 
{487,60}, 
{497,60}, 
{453,60}, 
} 
  
function getVehicleMaxFuel(loot) 
    local modelID = getElementModel(getElementData(loot,"parent")) 
    for i,vehicle in ipairs(vehicleFuelTable) do 
        if modelID == vehicle[1] then 
             return vehicle[2] 
        end 
    end 
    return false 
end 
  

Link to comment
  • Moderators
So much work on a gamemode like that and such a crappy quality.

quality crappy if because he uses low resolution, but that effects if u make/or add crappy looking resources, too.

I am talking about the code(dayz), not his screenshot. I am not that stupid...

Quality code doesn't show errors or warnings.

Link to comment
So much work on a gamemode like that and such a crappy quality.

quality crappy if because he uses low resolution, but that effects if u make/or add crappy looking resources, too.

I am talking about the code(dayz), not his screenshot. I am not that stupid...

Quality code doesn't show errors or warnings.

That's beasause this gamemode was compiled and who decompiled made his own edits and as you can see didn't do a good job, also the original code made by Marwin is messed up (I know that cause I have it).

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