knightscript Posted January 18, 2016 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. My Scripts: Custom vehicle by ACL Custom vehicle by Account
Army@1 Posted January 18, 2016 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)
knightscript Posted January 18, 2016 Author 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. My Scripts: Custom vehicle by ACL Custom vehicle by Account
WhoAmI Posted January 18, 2016 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
knightscript Posted January 18, 2016 Author Posted January 18, 2016 Thanks WhoAmI, it worked perfectly!. My Scripts: Custom vehicle by ACL Custom vehicle by Account
knightscript Posted January 18, 2016 Author Posted January 18, 2016 Hey WhoAmI, when i disconnect, my car stays there, how can i fix this? My Scripts: Custom vehicle by ACL Custom vehicle by Account
knightscript Posted January 18, 2016 Author 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) My Scripts: Custom vehicle by ACL Custom vehicle by Account
ViRuZGamiing Posted January 18, 2016 Posted January 18, 2016 Add this, addEventHandler("onPlayerQuit", getRootElement(), function() destroyElement(getElementData(source, "spawnedCar")) end) EDIT nvm you found it. "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
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