-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpermadeath.lua
More file actions
31 lines (25 loc) · 984 Bytes
/
permadeath.lua
File metadata and controls
31 lines (25 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
local PermaDeath = {}
function PermaDeath.OnPlayerDeath(eventStatus, pid)
if eventStatus.validDefaultHandler then
local player = Players[pid]
player.data.customVariables.dead = true
PlayerLobby.teleportToLobby(pid)
tes3mp.Resurrect(pid, 5)
return customEventHooks.makeEventStatus(false, false)
end
end
function PermaDeath.LeaveAttempt(eventStatus, pid)
tes3mp.LogMessage(enumerations.log.INFO, "PlayerLobby_Leave")
if eventStatus.validDefaultHandler then
if Players[pid].data.customVariables.dead then
PlayerLobby.teleportToLobby(pid)
return customEventHooks.makeEventStatus(false, false)
end
end
end
function PermaDeath.resurrect(eventStatus, pid)
Players[pid].data.customVariables.dead = nil
end
customEventHooks.registerValidator("OnPlayerDeath", PermaDeath.OnPlayerDeath)
customEventHooks.registerValidator("PlayerLobby_Leave", PermaDeath.LeaveAttempt)
return PermaDeath