mockba.the.borg Posted May 6, 2016 Share Posted May 6, 2016 Hi everyone, I ran into an interesting thing today which maybe someone can help me with: I was trying to fix/recover an exploded vehicle, and I noticed that I can't make it driveable again. I can fix it, extinguish its fire, set it on ground properly, everything. But it stays undriveable. I have noticed then that VEHICLE::SET_VEHICLE_UNDRIVEABLE doesn't seem to be working at all (?!?!?!?!) So I did the following test from my mod's command line: (vehicle's ID was 80987) natives.VEHICLE.SET_VEHICLE_IS_STOLEN(80987, true) ---- the vehicle became "Stolen" natives.VEHICLE.SET_VEHICLE_IS_STOLEN(80987, false) ---- the vehicle went back to "Not Stolen" natives.VEHICLE.SET_VEHICLE_UNDRIVEABLE(80987, false) ---- nothing happens natives.VEHICLE.SET_VEHICLE_UNDRIVEABLE(80987, true) ---- nothing happens I do have network control of the entity, so I am not sure what to do to be able to flip the "UNDRIVEABLE" flag on a vehicle. I tried also both with the vehicle being mission entity and not. Maybe someone ran into this issue before? Any help is appreciated. Link to comment Share on other sites More sharing options...
ZUKMAN Posted May 6, 2016 Share Posted May 6, 2016 VEHICLE::SET_VEHICLE_FIXED(vehicle); VEHICLE::SET_VEHICLE_DEFORMATION_FIXED(vehicle); VEHICLE::SET_VEHICLE_PETROL_TANK_HEALTH(vehicle, 1000.0f); VEHICLE::SET_VEHICLE_BODY_HEALTH(vehicle, 1000.0f); VEHICLE::SET_VEHICLE_ENGINE_HEALTH(vehicle, 1000.0f); Link to comment Share on other sites More sharing options...
mockba.the.borg Posted May 6, 2016 Author Share Posted May 6, 2016 Hi Zukman, Thanks for the answer but I don't think setting the vehicle as fixed and setting its deformation and health (which SET_VEHICLE_FIXED already does btw) would help. Did you test this before answering? I have just tested your proposal and the vehicle stays "Dead" (IS_ENTITY_DEAD still returns true) and "Undriveable" (IS_VEHICLE_UNDRIVEABLE still returns true) after applying these. Maybe there's something else I am missing, or maybe once an entity becomes "Dead" it is for good. Still trying to figure out. Thanks, Mockba. Link to comment Share on other sites More sharing options...
ZUKMAN Posted May 6, 2016 Share Posted May 6, 2016 (edited) Obviously I've tested this code. It's from my gta menu.With this I was able to drive car which was exploded earlier. BTW u need to put your ped in the driver seat. Edited May 6, 2016 by ZUKMAN Link to comment Share on other sites More sharing options...
Jitnaught Posted May 6, 2016 Share Posted May 6, 2016 Obviously I've tested this code. ... Well it wasn't obvious because you didn't tell him you tested it in your first post. Link to comment Share on other sites More sharing options...
mockba.the.borg Posted May 6, 2016 Author Share Posted May 6, 2016 Hi Zukman, I did those exact calls in sequence and they didn't seem to have any effect. The car stayed "Dead" and "Undriveable" as I stated before ... I couldn't get to the driver's seat because the vehicle doesn't react to pressing "F". Even if I "Warp" myself into the driver's seat I can move the steering wheel, I see the wheels turn, but the car won't move. So either I am missing something else, or the behavior may have changed lately? One thing I noticed also is that I can't seem to switch the car back and forth (any car, not only exploded ones) from the "Undriveable" state. Thanks, Mockba. Link to comment Share on other sites More sharing options...
Skorpro Posted May 7, 2016 Share Posted May 7, 2016 Taken from my trainer... After an explosion: SET_VEHICLE_FIXED(vehicle);SET_ENTITY_PROOFS(vehicle, 1, 1, 1, 1, 1, 1, 1, 1);SET_ENTITY_INVINCIBLE(vehicle, 1);SET_ENTITY_CAN_BE_DAMAGED(vehicle, 0);if (IS_ENTITY_ON_FIRE(vehicle)) STOP_ENTITY_FIRE(vehicle);if (IS_ENTITY_UPSIDEDOWN(vehicle)) SET_VEHICLE_ON_GROUND_PROPERLY(vehicle);// Important!SET_VEHICLE_ENGINE_ON(vehicle, 1, 1);// Just for the optic WASH_DECALS_FROM_VEHICLE(vehicle, 0.001f);SET_VEHICLE_DIRT_LEVEL(vehicle, 0.0f);SET_VEHICLE_CAN_BE_VISIBLY_DAMAGED(vehicle, 0); Note: You can use your car, but if you get out of it it's impossible to get in again! Work around: Respawn the car or 'warp' into it -> SET_PED_INTO_VEHICLE(player_ped, vehicle, -1). GRAX 1 Link to comment Share on other sites More sharing options...
mockba.the.borg Posted May 8, 2016 Author Share Posted May 8, 2016 Hi Skorpro, Interestingly enough, just doing: VEHICLE.SET_VEHICLE_FIXED(veh.ID) VEHICLE.SET_VEHICLE_DIRT_LEVEL(veh.ID,0) FIRE.STOP_ENTITY_FIRE(veh.ID) VEHICLE.SET_VEHICLE_ON_GROUND_PROPERLY(veh.ID) Worked fine for online vehicles. The vehicle is fixed, recovered, and can be driven (and even exploded) again. However, it doesn't work for offline. And adding: ENTITY.SET_ENTITY_PROOFS(veh.ID, true, true, true, true, true, true, true, true) ENTITY.SET_ENTITY_INVINCIBLE(veh.ID, true) ENTITY.SET_ENTITY_CAN_BE_DAMAGED(veh.ID, false) VEHICLE.SET_VEHICLE_ENGINE_ON(veh.ID, true, true, true) Didn't help either. The health of the vehicle is recovered, but it stays "Dead" and "Undriveable". So, whatever it is, it works for online but not for offline. So it has to be some difference on the way offline game handles a vehicle. I am at a loss right now. Can't figure out what offline expects that online doesn't. Cheers, Mockba. Link to comment Share on other sites More sharing options...
GRAX Posted May 9, 2016 Share Posted May 9, 2016 thank you skorpro! for me your code works fine. after an explosion i can drive around again BUT i cant tune my car and the lights are off i found this native SET_VEHICLE_UNDRIVEABLE maybe it works (cant test it atm). Link to comment Share on other sites More sharing options...
mockba.the.borg Posted May 9, 2016 Author Share Posted May 9, 2016 Hi GRAX, Does it work for you in offline mode as well? Or only online? I am using the same exact code for online and offline and it seems to have effect only online. Offline the car is repaired but stays "Dead" and "Undriveable". If it works for you offline, can you please share the list of commands you are using on the vehicle? Thanks, Mockba. Link to comment Share on other sites More sharing options...
Skorpro Posted May 10, 2016 Share Posted May 10, 2016 @mockba.the.borg Here is my code: while (true){ /* ... */ if (IS_PED_IN_ANY_VEHICLE(PLAYER_PED_ID(), 0)) vehicle = GET_VEHICLE_PED_IS_USING(PLAYER_PED_ID()); if (vehicle != 0) { if (IS_ENTITY_DEAD(vehicle)) print("~r~Car is DEAD!"); if (!IS_VEHICLE_DRIVEABLE(vehicle, 1)) print("~r~Car is NOT DRIVEABLE!"); } if ((/*key 1 blabla...*/) && (vehicle != 0)) { SET_VEHICLE_FIXED(vehicle); SET_ENTITY_PROOFS(vehicle, 1, 1, 1, 1, 1, 1, 1, 1); SET_ENTITY_INVINCIBLE(vehicle, 1); SET_ENTITY_CAN_BE_DAMAGED(vehicle, 0); if (IS_ENTITY_ON_FIRE(vehicle)) STOP_ENTITY_FIRE(vehicle); if (IS_ENTITY_UPSIDEDOWN(vehicle)) SET_VEHICLE_ON_GROUND_PROPERLY(vehicle); // Important! SET_VEHICLE_ENGINE_ON(vehicle, 1, 1); // Just for the optic WASH_DECALS_FROM_VEHICLE(vehicle, 0.001f); SET_VEHICLE_DIRT_LEVEL(vehicle, 0.0f); SET_VEHICLE_CAN_BE_VISIBLY_DAMAGED(vehicle, 0); // Does not work... car is still NOT 'DRIVEABLE' //SET_VEHICLE_UNDRIVEABLE(vehicle, 0); } /* ... */ if ((/*key 2 blabla...*/) && (vehicle != 0)) { TASK_WARP_PED_INTO_VEHICLE(PLAYER_PED_ID(), vehicle, -1); SET_VEHICLE_ENGINE_ON(vehicle, 1, 1); // Does not work... car is still NOT 'DRIVEABLE' //SET_VEHICLE_UNDRIVEABLE(vehicle, 0); } /* ... */ WAIT(0);} Yeah, the car is still 'dead' and 'undriveable' but you can drive it. After you get out of this car it's impossible to enter it again, so you must warp into it (key 2). @GRAX Thanx for the hint... you're right: no tuning possible after the car is 'dead'. It seems as if the car-ID is on a 'black-list'... mockba.the.borg 1 Link to comment Share on other sites More sharing options...
mockba.the.borg Posted May 10, 2016 Author Share Posted May 10, 2016 Cool ... I understand now. The car stays "Dead" but if you warp in you can still drive it. I wonder what is the difference between online/offline, but anyways ... this seems to do the trick. Thanks a lot. If I find any more about it, I will definitely share here. Cheers, Mockba. Link to comment Share on other sites More sharing options...
mockba.the.borg Posted May 11, 2016 Author Share Posted May 11, 2016 Hi Skorpro, Indeed I can drive the car if I a warp into it and set the engine on. It becomes a very "interesting" car, as it won't leave skid marks, won't trigger "stunt jumps" or garage doors. It can be visibly damaged, however won't catch fire or be exploded again. I think it became a "zombie" vehicle ... Cheers, Mockba. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now