Concommand help


concommand.Add( “killyourself”,function( ply )
print( “You killed yourself!” )
end )

Location:tried all 3 (cl_init,Init and shared)

[ERROR] gamemodes/war/gamemode/shared.lua:34: attempt to call method ‘kill’ (a nil value)

  1. unknown - gamemodes/war/gamemode/shared.lua:34 <---- disregard that I’ve tried all 3 files
  2. unknown - lua/includes/modules/concommand.lua:69

It must be ran serverside.

local _ply = LocalPlayer()

concommand.Add( "killyourself", "arte", function(_ply)
end )

you missed the name of the concommand, print(“you killed yourself”) is clientside, ply:Kill() is serverside

From what I see, your code and your error message does not match. Its saying ‘kill’ is a nil value when your calling “Kill()” in your code. Are you sure you posted the right code/error message?

Also too, if you wanna leave it in shared, which is silly, wrap it in

if SERVER then end


he probably just wrote it out, instead of just copying it entirely.

What is the point of making _ply = LocalPlayer()? That’s just redundant.

cus yo i wanna look c00l

Ok thanks guys

if SERVER then 
     concommand.Add( "killyourself",function( ply )
          ply:PrintMessage( "HUD_PRINTTALK", "You killed yourself!" )
     end )