Page 1 of 1

[Plugin] Godmode

Posted: Sun Feb 18, 2024 10:00 pm
by STAR_Founder
i made a tiny lil plugin that makes it so u dont die to falls and explosions and stuff!!!! pretty cool right?
still pushues u around so i wonder if there's a way to fix that :?: :?: :?:

Code: Select all

---@type Plugin
local plugin = ...
plugin.name = 'godmoder'
plugin.author = 'starfounder:333333'
plugin.description = 'tf'

plugin.commands['/godmoder'] = {
  info = 'become super silly',
  canCall = function (ply) return ply.isAdmin end,
  ---@param ply Player
  call = function (ply)
        if ply.human.data.invin ~= 1 then 
            ply:sendMessage("noDie enabled")
			ply.human.data.invin = 1
		elseif ply.human.data.invin == 1 then
            ply:sendMessage("noDie disabled")
			ply.human.data.invin = 0
        end 

  end
}

-- You'll still get pushed, but falls, cars, and explosions won't kill you. Bullets too!
plugin:addHook('Logic', function()
	for i, ply in ipairs(players.getAll()) do
    	if ply.human and ply.human.data.invin == 1 then
			ply.human.isAlive = true
			ply.human.isBleeding = false
			ply.human.health = 100
			ply.human.chestHP = 100
			ply.human.leftArmHP = 100
			ply.human.rightArmHP = 100
			ply.human.leftLegHP = 100
			ply.human.rightLegHP = 100
			ply.human.bloodLevel = 100
		end
	end
end)	

Re: [Plugin] Godmode

Posted: Sun Feb 18, 2024 10:08 pm
by STAR_Founder
STAR_Founder wrote: Sun Feb 18, 2024 10:00 pm i made a tiny lil plugin that makes it so u dont die to falls and explosions and stuff!!!! pretty cool right?
still pushues u around so i wonder if there's a way to fix that :?: :?: :?:

[code
ply.human.health = 100
ply.human.chestHP = 100
ply.human.leftArmHP = 100
ply.human.rightArmHP = 100
ply.human.leftLegHP = 100
ply.human.rightLegHP = 100
ply.human.bloodLevel = 100
[/code]
just realized i could replace a bunch of this with isImmortal cant i :lol: