Start a command on startup

I fixed this thanks for all your help

Isnt it

[lua]RunConsoleCommand( “dm_about” )[/lua]?

I will try it.

Wrong section isnt it?

Nope, It’s still not showing up on spawn.

PlayerInitialSpawn is a serverside hook, I think you need to use InitPostEntity which gets called on the client once they are fully spawned.

So you would place this in cl_init.lua
local function FirstPlayerSpawn()
RunConsoleCommand(“dm_about” )
surface.PlaySound( “content/sound/StartRound.wav” )
hook.Add( “InitPostEntity”, “FirstPlayerSpawn”, FirstPlayerSpawn)

[lua]function GM:PlayerInitialSpawn( ply )

ply:RunConsoleCommand( "dm_about" )


That should work.

Ok it worked the menu came up but no sound it said this :

Failed to load sound “content\sound\startround.wav”, file probably missing from disk/repository

This is a folder structure : Deathmatch/content/sound/StartRound.wav
The deathmatch folder is the main gamemode folder should i add it ?

Well experiment with it, I think it should be “sound/StartRound.wav”.

Oh and no don’t add the gamemode’s folder, in this case content is the base and shouldn’t be in the script.

Right ok i will test it now.

Edit : Omg it’s still not working. I did


Still no luck.

[lua]function GM:PlayerInitialSpawn( ply )

    ply:ConCommand( "dm_about" )



in init.lua


for k, v in pairs( player.GetAll() ) do

    GAMEMODE:PlayerInitialSpawn( ply )


I’m sure that should work. However, surface. PlaySound is a clientside hook

Oh no, no, no.


gamemode/content/sound/mysound.wav is virtually shifted to the sound folder.

This means that if your sound had the path “gamemode/content/sound/abc/mysound.wav”, the path you would call it by is “abc/mysound.wav”

Thanks for your help that fixed it :smiley: