Local server but I’m told that still matters
My init file contains the following:
function GM:InitPostEntity() end hook.Add( "InitPostEntity", "some_unique_name", function() print( "Initialization hook called" ) end )
I have no idea if I’m using that correctly. My searches contained semi-contradictory information, ents.Create was removed in gmod 13 and so on. Pretty fragmented so I’m not sure if my syntax is even right.
This next one is part of a Doclick function that is working correctly for the other parts of it. (play a sound)
local spawnff = ents.Create('npc_citizen') if ( !IsValid( spawnff ) ) then return end // Check whether we successfully made an entity, if not - bail spawnff:SetModel( "models/npc/cdc_soldier_npc.mdl") spawnff:SetPos( Vector( 0, 0, 100 ) ) spawnff:Spawn() end
but I am getting a NIL field value error in console. I tried copying this exact block to the init but it never worked either. Some direction would be awesome.