knightscript Posted January 18, 2016 Share Posted January 18, 2016 Hello, i would like to change the handling for only 1 vehicle, i saw on the wiki the function is "setModelHandling", but I don´t have idea on how to change the handling of a single vehicle. Thank you. Link to comment
Army@1 Posted January 18, 2016 Share Posted January 18, 2016 This script will add a command which when executed will change player's vehicle mass to 300. function setVehicleMass(thePlayer) local pVehicle = getPedOccupiedVehicle(thePlayer) if pVehicle then setVehicleHandling (pVehicle, "mass", 300.0) end end addCommandHandler("mass",setVehicleMass) Link to comment
knightscript Posted January 18, 2016 Author Share Posted January 18, 2016 Wow, it works, thank you so much, one last thing, i have the following code: function OwnerCar(player) local account = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup("user." .. account, aclGetGroup("Owners")) then x,y,z = getElementPosition(player) veh = createVehicle("602",x,y,z) end end and its CommandHandler addCommandHandler("MyCar",OwnerCar) I would like to know how can i despawn my old car? because if i put /MyCar twice it will spawn a new one, and i just want to spawn 1. i know it is with DestroyElement, but i do not know exactly how, thank you. Link to comment
WhoAmI Posted January 18, 2016 Share Posted January 18, 2016 function OwnerCar(player) local account = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup("user." .. account, aclGetGroup("Owners")) then if (isElement(getElementData(player, "spawnedCar"))) then destroyElement(getElementData(player, "spawnedCar")) end local x,y,z = getElementPosition(player) local veh = createVehicle("602",x,y,z) setElementData(player, "spawnedCar", veh) end end Link to comment
knightscript Posted January 18, 2016 Author Share Posted January 18, 2016 Thanks WhoAmI, it worked perfectly!. Link to comment
knightscript Posted January 18, 2016 Author Share Posted January 18, 2016 Hey WhoAmI, when i disconnect, my car stays there, how can i fix this? Link to comment
knightscript Posted January 18, 2016 Author Share Posted January 18, 2016 Solved with the following code: addEventHandler( "onPlayerQuit", getRootElement( ),function() if (isElement(getElementData(source, "knightcar1"))) then destroyElement(getElementData(source, "knightcar1")) outputDebugString ( "1 car by Knight Destroyed." ) end end) Link to comment
ViRuZGamiing Posted January 18, 2016 Share Posted January 18, 2016 Add this, addEventHandler("onPlayerQuit", getRootElement(), function() destroyElement(getElementData(source, "spawnedCar")) end) EDIT nvm you found it. 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