zombienation Posted January 26, 2012 Share Posted January 26, 2012 hello, i'm using a vehicle panel, but i'd like to know how to fix it so that when the car is destroyed, that the car will be deleted, not respawn but deleted, at this moment the wreckage of the car stays where the car is destroyed is there anybody who can help me with this? thx Link to comment
zombienation Posted January 26, 2012 Author Share Posted January 26, 2012 client http://pastebin.com/Vkn1JRfH server http://pastebin.com/AYqfN68r thx Link to comment
Castillo Posted January 26, 2012 Share Posted January 26, 2012 I don't want to sound rude, but the client side could be done with just some lines using a table instead of adding manually each vehicle. --vehicle spawning vehicles = {} function spawnv ( id ) if getElementDimension (source) == 10 then outputChatBox ( "You can't use vehicle here", source, 255, 0, 0 ) else if vehicles[source] and isElement(vehicles[source]) then destroyElement(vehicles[source]) end local x, y, z = getElementPosition ( source ) local xr, yr, zr = getElementRotation ( source ) vehicles[source] = createVehicle ( id, x, y, z + 0.5, xr, yr, zr ) warpPedIntoVehicle(source, vehicles[source]) addEventHandler("onVehicleExplode",vehicles[source],function () destroyElement(source) end) end end addEvent ( "spawn", true ) addEventHandler ( "spawn", root, spawnv ) function destroyveh () if vehicles[source] and isElement(vehicles[source]) then destroyElement(vehicles[source]) else outputChatBox( "There is no old car.", source ) end end addEvent ( "destroy", true ) addEventHandler ( "destroy", root, destroyveh ) It should destroy the vehicle just after explode. Link to comment
zombienation Posted January 26, 2012 Author Share Posted January 26, 2012 no problem about it, thx for telling me, its idd a lot shorter now i have this vehicle from https://community.multitheftauto.com/index.php?p= ... ls&id=2134 i have changed the spawn button location in the panel, cuz players with low screen resolution dont see the spawn button in their screen, thx for fixing this destroying script Link to comment
zombienation Posted January 28, 2012 Author Share Posted January 28, 2012 still other vehicles bounded to maps or spawned with admin panel dont spawn away after destroying, how do i create a script with addEvent ( "destroy", true ) addEventHandler ( "destroy", root, destroyveh ) that will spawn away all vehicles that gets destroyed no mather how they spawned? Link to comment
Castillo Posted January 28, 2012 Share Posted January 28, 2012 addEventHandler("onVehicleExplode",root,function () destroyElement(source) end) Link to comment
zombienation Posted January 28, 2012 Author Share Posted January 28, 2012 thanks solidsnake, so i just make a new server side lua with that line in it? Link to comment
Castillo Posted January 28, 2012 Share Posted January 28, 2012 Yes, or you can put it into another resource, do what you want, but keep it server side, else it'll not work. Link to comment
zombienation Posted January 28, 2012 Author Share Posted January 28, 2012 thanks solidsnake, so i just make a new server side lua with that line in it? it works 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