Doing an action when a console command is ran

For example, when gm_spawn is ran, i want to execute a function i have made, any ideas?

[lua] concommand.Add( string commandName, func commandFunction, func:table:string autoCompleteFunc )[/lua]

on that way you wil override the command to spawn if im correct,

You should use hooks anyway,

Hook functions
Hooks list
scroll down to the sandbox hooks on the second link, there you can hook to as example PlayerSpawnedProp, so you can do your actions in there