Jump to content

My problems


Recommended Posts

Posted (edited)

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
Posted (edited)

I didn't even tried that depracated function, but thanks you for fast reply and that function.

Edited by Guest
Posted (edited)

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
Posted

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

Posted

Sorry, translated.

I don't have those two functions both in my script, just when I use first function everything works fine, but when I use second function instead nothing happens..

Posted

They will screw up if you have them in the same script or resource. And even if they don't, the local variable with the same name will. Change them, they should have more descriptive names anyways.

Posted

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)!

Posted

We're not psychic; if you give us pseudo-code and want us to debug it, you're in for a nasty surprise.. post your real code.

Posted

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?

  • Recently Browsing   0 members

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