koragg Posted February 14, 2017 Share Posted February 14, 2017 (edited) Hello people. So recently i started the single player mod i made years back called GTA Mysterious Mod (available on piratebay) and noticed one awesome feature that I've put in it. Indeed - the ability for some vehicles to do a wheelie. I'm asking here if anybody knows of such resource or has an idea or code or whatever on how to make such a thing for MTA. Today i installed a cockpit view in my race server and i think a wheelie option for cars like phoenix, buffalo, clover would be awesome. Here's a link to the single player cleo mod which does it for GTA SA: https://www.gtaall.com/gta-san-andreas/cleo/60010-car-wheelie.html Also handling or speed of cars shouldn't change at all while doing a wheelie (aka to be default ones). I don't know if using setElementPosition would work. Also i don't know how to get just the vehicle's front part as an element (not the whole vehicle). But if bikes can do it why not cars too? Method should be the same ... hopefully we can make this. Edited February 14, 2017 by koragg Link to comment
nikitafloy Posted February 15, 2017 Share Posted February 15, 2017 (edited) U should to check handling function. I do it in handling editor;) Edited February 15, 2017 by nikitafloy Link to comment
koragg Posted February 15, 2017 Author Share Posted February 15, 2017 16 hours ago, nikitafloy said: U should to check handling function. I do it in handling editor;) Can you explain some more? How did you do it? Link to comment
nikitafloy Posted February 16, 2017 Share Posted February 16, 2017 10 hours ago, koragg said: Can you explain some more? How did you do it? for simplicity i use resource handling editor and edit: centerOfMass, suspension (and level) Link to comment
koragg Posted February 16, 2017 Author Share Posted February 16, 2017 I'll give it a try later but won't that kind of ruin the car's handling during a race? I mean it won't be default and since my server is a race one that's a big problem. Link to comment
nikitafloy Posted February 16, 2017 Share Posted February 16, 2017 (edited) 8 minutes ago, koragg said: I'll give it a try later but won't that kind of ruin the car's handling during a race? I mean it won't be default and since my server is a race one that's a big problem. u need to "play" with suspension or use setTimer and keep up it: https://wiki.multitheftauto.com/wiki/SetVehicleTurnVelocity Edited February 16, 2017 by nikitafloy 1 Link to comment
koragg Posted February 17, 2017 Author Share Posted February 17, 2017 @nikitafloy I did it but for some reason when I set a timer to restore the handling to the car's default one after one second nothing happens, Here's the code: function wheelie(player) local car = getPedOccupiedVehicle(player) if car then --Sabre if getElementModel(car) == 475 then setVehicleHandling(car, "centerOfMass", { 0.0, -0.65, 0.1 }) setVehicleHandling(car, "tractionLoss", 5.90) setVehicleHandling(car, "engineAcceleration", 22.0) setVehicleHandling(car, "engineInertia", 1.0) setVehicleHandling(car, "suspensionAntiDiveMultiplier", 0.0000000000001) end end end function bindKeyOnJoin() bindKey(source, "M", "down", wheelie) end addEventHandler("onPlayerJoin", root, bindKeyOnJoin) function bindKeyOnResStart() for i, player in ipairs(getElementsByType('player')) do bindKey(player, "M", "down", wheelie) end end addEventHandler("onResourceStart", resourceRoot, bindKeyOnResStart) Can you make a timer which restores all changed handling lines to the car's default ones one second after the player has pressed the key? Link to comment
nikitafloy Posted February 17, 2017 Share Posted February 17, 2017 local default_handling = {} function wheelie(player) local car = getPedOccupiedVehicle(player) if car then --Sabre if getElementModel(car) == 475 then if default_handling[car] ~= true then setVehicleHandling(car, "centerOfMass", { 0.0, -0.65, 0.1 }) setVehicleHandling(car, "tractionLoss", 5.90) setVehicleHandling(car, "engineAcceleration", 22.0) setVehicleHandling(car, "engineInertia", 1.0) setVehicleHandling(car, "suspensionAntiDiveMultiplier", 0.0000000000001) default_handling[car] = true else -- there default handling default_handling[car] = nil end end end end function bindKeyOnJoin() bindKey(source, "M", "down", wheelie) end addEventHandler("onPlayerJoin", root, bindKeyOnJoin) function bindKeyOnResStart() for i, player in ipairs(getElementsByType('player')) do bindKey(player, "M", "down", wheelie) end end addEventHandler("onResourceStart", resourceRoot, bindKeyOnResStart) if you want timer: function wheelie(player) local car = getPedOccupiedVehicle(player) if car then --Sabre if getElementModel(car) == 475 then setVehicleHandling(car, "centerOfMass", { 0.0, -0.65, 0.1 }) setVehicleHandling(car, "tractionLoss", 5.90) setVehicleHandling(car, "engineAcceleration", 22.0) setVehicleHandling(car, "engineInertia", 1.0) setVehicleHandling(car, "suspensionAntiDiveMultiplier", 0.0000000000001) setTimer(function(car) -- there default handling end, 1000, 1, car) end end end function bindKeyOnJoin() bindKey(source, "M", "down", wheelie) end addEventHandler("onPlayerJoin", root, bindKeyOnJoin) function bindKeyOnResStart() for i, player in ipairs(getElementsByType('player')) do bindKey(player, "M", "down", wheelie) end end addEventHandler("onResourceStart", resourceRoot, bindKeyOnResStart) 1 Link to comment
koragg Posted February 17, 2017 Author Share Posted February 17, 2017 I did exactly the same setTimer thing and it didn't work, but when I copy yours it works lol Anyway, thanks. 1 Link to comment
koragg Posted February 18, 2017 Author Share Posted February 18, 2017 Released, enjoy! https://community.multitheftauto.com/index.php?p=resources&s=details&id=14177 Link to comment
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