Ents not spawning with my script?


I have created 2 ents suit_dispender and health_dispender.
The suit gives ammo and the health health.

But it seems that my spawnents.lua in the autorun/server folder fails.
Cause the ents are not spawning.
Here are the ents : http://www.2shared.com/file/b9qkVRT7/ents.html


	local Spawn = { }
	Spawn[ 1 ] = { }
	Spawn[ 1 ].Entity = "suit_dispenser"
	Spawn[ 1 ].Vector = Vector( -1783.7188, -36.1563, -147.2500 )
	Spawn[ 1 ].Angle = Angle( 0, 0, 0 )
	Spawn[ 2 ] = { }
	Spawn[ 2 ].Entity = "health_dispenser"
	Spawn[ 2 ].Vector = Vector( -1783.6250, -67.6250, -146.4375 )
	Spawn[ 2 ].Angle = Angle( 0, 0, 0 )

function SpawnEnts( )
	for k, v in pairs( Spawn ) do
		local ent = ents.Create( Spawn[ k ].Entity )
		ent:SetPos( Spawn[ k ].Vector )
		ent:SetAngles( Spawn[ k ].Angle )
		ent:Spawn( )
hook.Add( "InitPostEntity", "SpawnEntities", SpawnEnts )

Can somebody help me ?

With kind regards,

you have both Ents called dispenser instead of dispender…

Thats Correct so the names are correct i use in the spawn script.
So that is not the problem

Anyone ? :frowning:

Dont get mad if i’m wrong because im very new to lua coding. But dont you need the name in the hook to be the same as the one you have at the top? you have local Spawn but in the hook you dont.


hook.Add( “InitPostEntity”, “SpawnEntities”, Spawn)

like I said I remember doing something like this and the name in your function needs to be in the hook, but I cant say for certain.

Uh, why did you bump this? It was made in August 2011, and by now he probably solved it out.