point_servercommand, any way to copy inputs?

So I’m creating a gamemode where maps depend heavily on point_servercommand, but Garry’s Mod just won’t run that entity (don’t come in saying it will, yes it does create, no it doesn’t output stuff)

lua_run Entity(500):Fire("Command", 'sv_cheats 1', 0)
> Entity(500):Fire("Command", 'sv_cheats 1', 0)...
"sv_cheats" = "0"

(sv_cheats is just an example, other commands don’t run either)

Question would be if there is any way to copy inputs from an entity and pass them on to another entity, or just to get point_servercommand working?


Fixed, here’s how I did it:

First, I got the ent’s targetname (How other entities call it), and stored it on the entity.

[lua]function GM:EntityKeyValue(e, k, v)
if e:GetClass() == “point_servercommand” then
if k == “targetname” then
e.targetname = v

Then, I overrode all of the entities with my own, and restored the targetname.

(in InitPostEntity)
[lua] for k,v in pairs(ents.FindByClass(“point_servercommand”)) do
local nm = v.targetname
local ent = ents.Create(“point_servercommand_new”)
ent:SetKeyValue(“targetname”, nm)

Then, I quickly made an entity, which is basically this:

[lua]function ENT:AcceptInput(name, act, caller, data)
if caller:IsPlayer() then return end
if name == “Command” then


Can you upload this so I can use it please?

Never mind, rate me boxes.

Sorry i know this is an old thread and all but can some one explain this in a little more detail?

Do i put this code in the gamemode folder’s init.lua?
Also at the bit where you put “(in InitPostEntity)” is there some other code that’s missing that i have to enter?

And what do i name the actual point_servercommand in hammer, do i name it “k” or “targetname” or what?

Sorry for the noob questions

I don’t think this is what you want my friend

The implementation described in the OP can actually be simplified more. You can just override the entity entirely. Here’s the implementation I used for Zombie Escape.


You’ll obviously have to change the code to fit your needs. I rerouted the ‘say’ command and ran most other commands (some are filtered).

Just override the entity like I mentioned above.

targetname’ should be the key that you use in Hammer, and the value is whatever unique name you want to address the entity as.

Thanks for the quick replies so this code is meant to go in:
instead of just <gamemodename>\gamemode\init.lua ?

You sure there is no other coding needed? Because gmod is still not letting point_servercommand work
on my gamemode (running latest update of gmod 12 btw)

Never mind I fixed it. I think it was because i had an extra point_servercommand in my map but it’s fixed now so thanks samm5506 i click your LUA king button :smiley: