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
20
server.lua
20
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 ()
|
||||||
@ -70,4 +88,4 @@ addEventHandler("onResourceStart", root,
|
|||||||
teamSpawns[Teams.POLICE] = { 1532.6, -1677.3, 5.9, 270 }
|
teamSpawns[Teams.POLICE] = { 1532.6, -1677.3, 5.9, 270 }
|
||||||
teamSpawns[Teams.TERRORISTS] = { 1774.0, -1926.5, 13.5, 270 }
|
teamSpawns[Teams.TERRORISTS] = { 1774.0, -1926.5, 13.5, 270 }
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user