Game.Rule.respawnable = false
Playerlife = {}
for i = 1,24 do
Playerlife[i] = Game.SyncValue.Create(string.for/mat('Playerlife.%i', i))
end
function Game.Rule:OnPlayerJoiningSpawn(player)
player.user.life = 3
Playerlife[player.index].value = player.user.life
end
function Game.Rule:OnPlayerKilled(victim, killer, weapontype, hitbox)
if victim.user.life > 0 then
victim:Respawn()
end
victim.user.life = victim.user.life - 1
Playerlife[victim.index].value = victim.user.life
end
Playerlife = UI.SyncValue.Create(string.for/mat("Playerlife.%i", UI.PlayerIndex()))
Life = UI.Text.Create()
Life:Set({font="large", align="left", x=30, y=30, width=300, height=50, r=255,g=30,b=30})
function Playerlife:OnSync()
if self.value == 3 then
Life:Set({text="Life:♥♥♥"})
elseif self.value == 2 then
Life:Set({text="Life:♥♥"})
elseif self.value == 1 then
Life:Set({text="Life:♥"})
else
Life:Set({text="Life:"})
end
end