How to run a console command once a player joins? (client side)

Basically what the title says.
“How to run a console command once a player joins? (client side)”

What i mean is…
When a player joins your server, how do you get a player to run a console command automatically like… “kill”, “quit” once their in game?

[lua]
AddCSLuaFile( “command.lua” )
local function onspawn()
RunConsoleCommand(“kill”)
end
timer.Simple( 0.1, onspawn )
hook.Add( “PlayerInitialSpawn”, “playerInitialSpawn”, onspawn )
[/lua]

You can’t run quit on the client, but:

Gamz, PlayerInitialSpawn is a serverside hook, and why are you creating a global function for it? “kill” is not a valid command serverside, and you’re not making the player send it, just the server.

[lua]
hook.Add( “PlayerInitialSpawn”, “Command on Join”, function( ply )

ply:ConCommand( "my_command" )

end )[/lua]

Though, the player might not be able to run a command right when PlayerInitialSpawn is called, so you might want to put it in a timer.

Hello All Coding Prodigy Tyler Wearing Here

What A Bunch Of Dumb Code I Would Just Block This With My Critically Acclaimed Command Blocker In The Devestating And Critically Acclaimed Gayry Mod Hack Hera So Ya Nice Try The Real Way To Do Is It To First Detour The __MetaTable Functions Then OverWrite Hook Library With Your Own Library Then ReBuild The Old Library Using Only Floating Point Unit Registries And InJect It Into The Game While SimulTaneously Detouring Garbage Collection Ok Hope That Helps

Tyler Wearing Out

I was just using those commands as a example. (Couldn’t think of other commands at the time)