mirror of
https://github.com/ChronosX88/mta-ptp.git
synced 2024-11-22 10:22:22 +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("onPlayerTeamSelected", root, mainOnPlayerTeamSelected)
|
||||||
addEventHandler("onPlayerJoin", root, mainOnPlayerJoin)
|
addEventHandler("onPlayerJoin", root, mainOnPlayerJoin)
|
||||||
|
|
||||||
|
-- respawn exploded vehicle
|
||||||
function respawnExplodedVehicle()
|
function respawnExplodedVehicle()
|
||||||
setTimer(respawnVehicle, 9000, 1, source)
|
setTimer(respawnVehicle, 9000, 1, source)
|
||||||
end
|
end
|
||||||
addEventHandler("onVehicleExplode", root, respawnExplodedVehicle)
|
addEventHandler("onVehicleExplode", root, respawnExplodedVehicle)
|
||||||
|
--
|
||||||
|
|
||||||
|
-- respawn wasted player
|
||||||
addEventHandler("onPlayerWasted", root,
|
addEventHandler("onPlayerWasted", root,
|
||||||
function()
|
function()
|
||||||
local team = getPlayerTeam(source)
|
local team = getPlayerTeam(source)
|
||||||
@ -60,6 +63,21 @@ addEventHandler("onPlayerWasted", root,
|
|||||||
end
|
end
|
||||||
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,
|
addEventHandler("onResourceStart", root,
|
||||||
function ()
|
function ()
|
||||||
|
Loading…
Reference in New Issue
Block a user