TorNix~|nR Posted October 27, 2016 Posted October 27, 2016 hi everyone, I have script of anti veh zone it works, but when the vehicle destroyed, it never respawn, anyone help? local positions = { {xxx, xxx, xxx, xxx}, } local aRadarAreaPlaces = { { xxx, xxx, xxx, xxx, xxx, xxx, xxx, xxx }, } function pos() for k, v in ipairs(positions) do local mycol = createColRectangle (v[1], v[2], v[3], v[4]) for _, a in ipairs( aRadarAreaPlaces ) do local pRadarArea = createRadarArea ( unpack( a ) ) addEventHandler ("onColShapeHit", mycol, destroyTheVehicles) addEventHandler ("onColShapeHit", pRadarArea, destroyTheVehicles) end end end addEventHandler("onResourceStart", resourceRoot, pos) function destroyTheVehicles (hitElement, dimension) if (getElementType(hitElement) ~= "vehicle" or not dimension) then return end local player = getVehicleController(hitElement) if (isElement(player)) then end destroyElement(hitElement) setTimer(respawnVehicle,5000,0)(hitElement) end
Storm-Hanma Posted October 27, 2016 Posted October 27, 2016 There is a script in community already see name like antispawn.. Something
TorNix~|nR Posted October 27, 2016 Author Posted October 27, 2016 No there is not, I just need help in this script.
Mr.Loki Posted October 27, 2016 Posted October 27, 2016 At line 31 and 32 you are deleting then respawning. How can you respawn something that does not exist? Instead of deleting the vehicle how about just: Eject player from the vehicle. Set the vehicle position to somewhere off the map like (9999,9999,0). Then set the timer to respawn it. function destroyTheVehicles (hitElement, dimension) if (getElementType(hitElement) ~= "vehicle" or not dimension) then return end local player = getVehicleController(hitElement) if (isElement(player)) then removePedFromVehicle ( player ) end setElementPosition(hitElement,696969,696969,0) setTimer(respawnVehicle,5000,0)(hitElement) end
Walid Posted October 27, 2016 Posted October 27, 2016 3 hours ago, TorNix~|nR said: setTimer(respawnVehicle,5000,0)(hitElement) should be setTimer(respawnVehicle, 5000, 1, hitElement)
TorNix~|nR Posted November 1, 2016 Author Posted November 1, 2016 (edited) I make it without setposition, just with removeped, but I need when removeped and when you are in the base (position), when you enter the car, you will remove automatically local positions = { {1560, -1137.41, 165, 165}, -- {2372.29, 1823.58, 158, 158}, -- {-2145.80, 118.67, 200, 200}, -- } local aRadarAreaPlaces = { { 1560, -1137.41, 165, 165, 0, 255, 0, 0 }, -- { 2372.29, 1823.58, 155, 158, 0, 255, 0, 0 }, -- { -2145.80, 118.67, 200, 200, 0, 255, 0, 0 }, -- } function pos() for k, v in ipairs(positions) do local mycol = createColRectangle (v[1], v[2], v[3], v[4]) for _, a in ipairs( aRadarAreaPlaces ) do local pRadarArea = createRadarArea ( unpack( a ) ) addEventHandler ("onColShapeHit", mycol, destroyTheVehicles) addEventHandler ("onColShapeHit", pRadarArea, destroyTheVehicles) end end end addEventHandler("onResourceStart", resourceRoot, pos) function destroyTheVehicles (hitElement, dimension) if (getElementType(hitElement) ~= "vehicle" or not dimension) then return end local player = getVehicleController(hitElement) if (isElement(player)) then outputChatBox ("#FFFF00[LS] #FF0000You can not drive vehicles in boss zone! #00FF00Only you can spawn them!" ,player, 255, 0, 0, true) removePedFromVehicle ( player ) end setTimer(respawnVehicle, 1000, 1, hitElement) end Edited November 1, 2016 by TorNix~|nR
Abdul KariM Posted November 1, 2016 Posted November 1, 2016 from line 32 to line 40 all this code is error hitElement = nil and Please interpret what want do
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