01-09-2018, 02:43 AM
Why explosion damages players in creative mode?
I even made a plugin what fixes it, because it's wery annoying. This plugin fixes knockback too. Here the code:
I even made a plugin what fixes it, because it's wery annoying. This plugin fixes knockback too. Here the code:
Code:
local hooks={}
local TDItable={"Attacker","DamageType","FinalDamage","Knockback","RawDamage"}
function hooks.take_damage(e,d)
if e:IsPlayer() and e and e:isGamemodeCreative() then
return true
else
--LOG("Damage!")
--for k,v in pairs(TDItable) do
-- LOG("\t"..v.."="..tostring(d[v]))
--end
if d.DamageType==dtAttack or d.DamageType==dtArrowAttack then
e:SetSpeed(0,0,0)
d.Knockback.y=5
--d.Knockback=d.Knockback*5
end
return false
end
end
function Initialize(Plugin)
Plugin:SetName("LogicFix")
Plugin:SetVersion(1)
-- Hooks
if hooks then
for k,v in pairs(hooks) do
cPluginManager.AddHook(cPluginManager["HOOK_"..string.upper(k)], v)
end
end
PLUGIN = Plugin -- NOTE: only needed if you want OnDisable() to use GetName() or something like that
-- Command Bindings
if commands then
for k,v in pairs(commands) do
cPluginManager.BindCommand(unpack(v))
end
end
LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
return true
end
function OnDisable()
LOG(PLUGIN:GetName() .. " is shutting down...")
end