blurryshadow1 Posted October 10, 2011 Share Posted October 10, 2011 well, i got this vehicle respawner from the mta resources website ( https://community.multitheftauto.com/index.php?p= ... ils&id=699 ) and im running a freeroam server, so when a player creates a vehicle and then the vehicle they created blows up. The vehicle they just created respawns at the creation point. How would i make it so when they create a vehicle and it blows up the vehicle gets removed. Also, whenever a player modifies the handling of a pre spawned vehicle on the map and then it explodes the vehicle stays exactly the same way the player left it last. How do i make it so the modded handling line of the vehicle doesnt still save even after the vehicle has exploded? i want it so the handling line goes back to default right after the vehicle has exploded but i honestly have no idea how to do this. Link to comment
qaisjp Posted October 10, 2011 Share Posted October 10, 2011 Use getOriginalHandling and setVehicleHandling. This is NOT a handling editor issue and therefore the resource will not be modified to suit this need. Please post any problems with handling editor on the official topic, which you can find on the RESOURCES section. There may be a setting in the future to reset handling on blow. Link to comment
blurryshadow1 Posted October 10, 2011 Author Share Posted October 10, 2011 im a noob scripter so i dont know what to do.. and i searched for getoriginalhandling and setvehiclehandling on the wiki but i cant find it. Link to comment
qaisjp Posted October 10, 2011 Share Posted October 10, 2011 setVehicleHandling getOriginalHandling(modelID) returns a table Link to comment
blurryshadow1 Posted October 11, 2011 Author Share Posted October 11, 2011 i still dont understand . I wish i could but im no where near to real scripting. All i am really doing is downloading resources from people and like delete, copy, and pasting. So basically i just do alot of minor editing.... the only script i was ever able to do sucessfully on my own is a script where a sound or song plays when you join the server then it stops when you spawn. although i did get some help from the wiki. Link to comment
qaisjp Posted October 11, 2011 Share Posted October 11, 2011 Wiki = good. function resetVehicleHandling(v) local h = getOriginalHandling(getElementModel(v)) for k,val in pairs(h) do setVehicleHandling(v, k, val) end end Link to comment
blurryshadow1 Posted October 12, 2011 Author Share Posted October 12, 2011 lol i did this, but i get a error function resetVehicleHandling(v) local h = getOriginalHandling(getElementModel(v)) for k,val in pairs(h) do setVehicleHandling(v, k, val) end addEventHandler("OnClientVehicleRespawn", getRootElement() Link to comment
Castillo Posted October 12, 2011 Share Posted October 12, 2011 That's because setVehicleHandling is a SERVER ONLY function and onClientVehicleRespawn is CLIENT SIDE. function resetVehicleHandling() local h = getOriginalHandling(getElementModel(source)) for k,val in pairs(h) do setVehicleHandling(source, k, val) end end addEventHandler("onVehicleRespawn", getRootElement(), resetVehicleHandling) Link to comment
blurryshadow1 Posted October 12, 2011 Author Share Posted October 12, 2011 thanks snake, now how would i go about making a script that would make it so when players create a vehicle and leave it for awhile, it gets removed and also doesnt respawn like the mapped vehicles on the server? Link to comment
qaisjp Posted October 12, 2011 Share Posted October 12, 2011 timers = {} function onLeave() if isTimer(timers[source]) then killTimer(timers[source]) end timers[source] = setTimer(destroyVehicle, 10*1000, 1, source) end function destroyVehicle(veh) if veh then destroyElement(veh) end end function onEnter() if isTimer(timers[source]) then killTimer(timers[source]) end end addEventHandler("onVehicleEnter",root, onEnter) addEventHandler("onVehicleLeave", root, onLeave) not tested wait ten seconds for it to delete Link to comment
blurryshadow1 Posted October 13, 2011 Author Share Posted October 13, 2011 it doesnt work Link to comment
blurryshadow1 Posted October 14, 2011 Author Share Posted October 14, 2011 like the car doesnt delete. i want it so anytime you create a vehicle and the vehicle you created is idle for a certain amount of time the vehicle deletes. (even if you havent even entered your created vehicle at all ) edit: nvm i actually found out theres settings in the freeroam script for this... lol sorry.. 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