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
[lua]
local function FirstPlayerSpawn()
RunConsoleCommand(“dm_about” )
surface.PlaySound( “content/sound/StartRound.wav” )
end
hook.Add( “InitPostEntity”, “FirstPlayerSpawn”, FirstPlayerSpawn)
[/lua]

[lua]function GM:PlayerInitialSpawn( ply )

ply:RunConsoleCommand( "dm_about" )

end[/lua]

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

Deathmatch/content/sound/StartRound.wav
content/sound/StartRound.wav
sound/StartRound.wav

Still no luck.

[lua]function GM:PlayerInitialSpawn( ply )

    ply:ConCommand( "dm_about" )

end

[/lua]

in init.lua

[lua]

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

    GAMEMODE:PlayerInitialSpawn( ply )

end
[/lua]

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

Oh no, no, no.

“StartRound.wav”

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: