Pivity

Overriding Gamemode functions from workshop addons

Last read Never
#1

I am running a fork of Cinema on a dedicated server. It is included in a workshop collection that the server loads on startup.

I would like to enable player-versus-player damage. This is turned off in the Cinema gamemode's gamemode/shared.lua file via this function on line 35:

function GM:PlayerShouldTakeDamage( ply, attacker )
   return false
end

I would like to override PlayerShouldTakeDamage and have it return true. I have tried re-declaring the function in the map's Cinema config file (where the screens and locations are defined), but the changes do not seem to stick.

Is it possible to redefine this without installing the gamemode directly to the server and editing the source files directly? I am trying to avoid manually installing gamemodes to the server.

Agree x 1
#2
local function yes() return true end
if GAMEMODE then
GAMEMODE.PlayerShouldTakeDamage = yes
end
hook.Add("Initialize", "Enable Damage", function()
GAMEMODE.PlayerShouldTakeDamage = yes
end)
Agree x 1Funny x 1Winner x 1Dumb x 1
Users viewing this thread
Nobody