Jump to content

My problems


Recommended Posts

Since getVehicleID function is deprecated, is there any alternative function? Because I couldn't find it and the only way to get the vehicle id is by using combination of two functions getVehicleName and getVehicleModelFromName..

Edited by Guest
Link to comment

Now I have problem with setVehicleEngineState function, the first one works good, but second for some wierd reason dosen't:

1.

  
function engine (player) 
    local veh = getPedOccupiedVehicle(player) 
    if(veh ) then 
        local engine = getVehicleEngineState(veh ) 
        setVehicleEngineState(veh, false) 
    end     
end  
  

2.

  
function engine (player) 
    local veh = getPedOccupiedVehicle(player) 
    if(veh ) then 
        local engine = getVehicleEngineState(veh ) 
        if(engine == true) then 
            setVehicleEngineState(veh, false) 
        end  
    end       
end  
  

Edited by Guest
Link to comment

First of all, if you want people to help you, code in English. It's not such a big deal here since it's like 20 lines of code, but a lot of people HATE looking at "foreign language code."

Second, you have 2 functions with the same name (whichever appears last in the script with overwrite the previous) and appear to overwrite your function with a local variable... I suggest reading some more basics.

Also, this should be in the scripting forum...

Link to comment

Those variable names are just for testing propouses and don't appear anywhere in my script or resource. Also as I mentioned, my problem is that if I check if engine is already on [if(engine == true)] then the engine just won't go off and stays on (2. function), but when I don't make that check, then everything works just fine and engine goes off (1. function)!

Link to comment

Cmon, my real code has nothing to do with this function, let me explain again:

This function works and turns vehicle engine off:

  
function engine (player) 
    local veh = getPedOccupiedVehicle(player) 
    if(veh ) then 
        local engine = getVehicleEngineState(veh ) 
        setVehicleEngineState(veh, false) 
    end     
end 
  

This function dosen't work and vehicle engine stays on:

  
function engine (player) 
    local veh = getPedOccupiedVehicle(player) 
    if(veh ) then 
        local engine = getVehicleEngineState(veh ) 
        if(engine == true) then 
            setVehicleEngineState(veh, false) 
        end 
    end       
end 
  

Got it?

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...