mirror of
https://github.com/ChronosX88/mta-ptp.git
synced 2024-11-22 02:12:21 +00:00
Add respawning drown vehicles
This commit is contained in:
parent
c4572734fa
commit
36ad4f11f6
18
server.lua
18
server.lua
@ -46,11 +46,14 @@ addEvent("onPlayerTeamSelected", true)
|
||||
addEventHandler("onPlayerTeamSelected", root, mainOnPlayerTeamSelected)
|
||||
addEventHandler("onPlayerJoin", root, mainOnPlayerJoin)
|
||||
|
||||
-- respawn exploded vehicle
|
||||
function respawnExplodedVehicle()
|
||||
setTimer(respawnVehicle, 9000, 1, source)
|
||||
end
|
||||
addEventHandler("onVehicleExplode", root, respawnExplodedVehicle)
|
||||
--
|
||||
|
||||
-- respawn wasted player
|
||||
addEventHandler("onPlayerWasted", root,
|
||||
function()
|
||||
local team = getPlayerTeam(source)
|
||||
@ -60,6 +63,21 @@ addEventHandler("onPlayerWasted", root,
|
||||
end
|
||||
end
|
||||
)
|
||||
--
|
||||
|
||||
-- respawn drown vehicle
|
||||
function respawnDrownVehicle()
|
||||
for _, vehicle in ipairs(getElementsByType("vehicle")) do
|
||||
if isElementInWater(vehicle) then
|
||||
local isOccupied, _ = next(getVehicleOccupants(vehicle))
|
||||
if not isOccupied then
|
||||
respawnVehicle(vehicle)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
setTimer(respawnDrownVehicle, 20000, 0)
|
||||
--
|
||||
|
||||
addEventHandler("onResourceStart", root,
|
||||
function ()
|
||||
|
Loading…
Reference in New Issue
Block a user