iChris Posted May 29, 2009 Share Posted May 29, 2009 (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 May 29, 2009 by Guest Link to comment
robhol Posted May 29, 2009 Share Posted May 29, 2009 getElementModel, I think the warning message you get says that? Link to comment
iChris Posted May 29, 2009 Author Share Posted May 29, 2009 (edited) I didn't even tried that depracated function, but thanks you for fast reply and that function. Edited May 29, 2009 by Guest Link to comment
iChris Posted May 29, 2009 Author Share Posted May 29, 2009 (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 May 29, 2009 by Guest Link to comment
robhol Posted May 29, 2009 Share Posted May 29, 2009 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
iChris Posted May 29, 2009 Author Share Posted May 29, 2009 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.. Link to comment
robhol Posted May 29, 2009 Share Posted May 29, 2009 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. Link to comment
iChris Posted May 29, 2009 Author Share Posted May 29, 2009 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
robhol Posted May 29, 2009 Share Posted May 29, 2009 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. Link to comment
iChris Posted May 29, 2009 Author Share Posted May 29, 2009 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
Recommended Posts