Admin console command only

How can I make a console command that only the admin can execute??

[editline]09:52PM[/editline]

Also i tried to do that when we spawn, it does a console command, but it dont works…

[lua]function GM:PlayerInitialSpawn( ply )
ply:ConCommand( “sb_start” )
end
end[/lua]

[lua]local function adminonly(ply, cmd, args)
if ply:IsAdmin() then
–code here
end
end
concommand.Add(“AdminOnly”, adminonly)[/lua]

Very basic example.

[editline]09:54PM[/editline]

[lua]function GM:PlayerInitialSpawn( ply )
ply:ConCommand( “sb_start” )
end[/lua]

You had too many ends.

Ok, and how can I make a function that makes WHEN the player dies it write a sentance, I tried:

[lua]if ply:IsDead then
ply:PrintMessage( HUD_PRINTTALK, “[City Roleplay] You died, you will now respawn as a citizen…”
end[/lua]

But its not working, whats the good function instead of ply:IsDead??

Probably best to do it in the PlayerDeath gamemode function.

How can I do it??

[editline]10:00PM[/editline]

Im not very good with hooks…

[lua]function GM:PlayerDeath(ply, inflictor, killer)
ply:PrintMessage(HUD_PRINTTALK, “[City Roleplay] You died, you will now respawn as a citizen…”)
end[/lua]

In init.lua???

yes

By the way, the function you were looking for is Player.Alive.

Oh and I want to make a spawn delay, how can I do it??