Could someone explain how to do a concommand and execute it with a / command?

Hello.

As the title says, could someone explain how to do a concommand and then execute it with a / command?

I THINK I got the code to spawn zombies but I got to do a command to make them spawn…

But if you could, could you explain then how to make zombies spawn to?
Just one zombie at the spawn point of gm_construct… would help me developing some stuff in my gamemode…

I know this is like asking to be spoonfeeded but I don’t really know how to do this and the wiki is outdated.

erm if you mean like DarkRP or something, they use a custom function to create those /commands, they dont use concommands for that. You’d have to get the chat text and do shit with it, sorry but i dont know this in lua just e2 (cuz am awesome). Luckily for you i am coding a zombie spawning function right now too D: try this for a basic spawning



function spawnZombie(pos)
	
	local zombie = ents.Create("npc_zombie")
	zombie:SetPos(pos)
	zombie:SetAngles(Angle(0, math.random(0,360), 0))
	zombie:Spawn()

end


Thanks, but will it spawn automaticly or do I have to do something…? Because I guess it can’t just spawn because a code is there and you don’t do anything else?

[editline]8th February 2013[/editline]

Wouldn’t this work?
[lua]
function spawnZombie(pos)

local zombie = ents.Create("npc_zombie")
zombie:SetPos(pos)
zombie:SetAngles(Angle(0, math.random(0,360), 0))
zombie:Spawn()

end

function SpawnZombies(ply, text)
if string.find(string.lower(text), “/spawnzombies”) then
spawnZombie(pos)
end
return “”
end
hook.Add(“PlayerSay”, “ChatCommandSay”, SpawnZombies)
[/lua]

From a quick look, you arent giving it any position.

Oh lol