concommand autocomplete 2 things?

I got it.

But can someone still please tell me how to tell if the player running a console command is the rcon user? Thanks

If it’s serverside then strictly speaking only people with rcon access and the host himself have access to the console. I don’t think there’s any direct way of finding out if a player is using rcon.

Oh wai…

[lua]if ply == Entity(0) then[/lua]

I prefer:

[lua]if ply == NULL then[/lua]

(Just incase an entity does the impossible and gets an index of 0)


18:31:33 lua_run concommand.Add("A" , function(p) if !p then print("A") end end )
18:31:33 L 12/15/2009 - 18:31:32: rcon from ":58688": command "lua_run concommand.Add("A" , function(p) if !p then print("A") end end )"
18:31:33 > concommand.Add("A" , function(p) if !p then print("A") end end )...
18:31:51 lua_run concommand.Add("B" , function(p) if p == Entity(0) then print("B") end end )
18:31:51 L 12/15/2009 - 18:31:50: rcon from "78.145.142.221:58688": command "lua_run concommand.Add("B" , function(p) if p == Entity(0) then print("B") end end )"
18:31:51 > concommand.Add("B" , function(p) if p == Entity(0) then print("B") end end )...
18:31:52 a
18:31:52 L 12/15/2009 - 18:31:51: rcon from "78.145.142.221:58688": command "a"
18:31:55 b
18:31:55 L 12/15/2009 - 18:31:53: rcon from "78.145.142.221:58688": command "b"
18:31:55 B

Damn, I didn’t quote Chris when he had the wrong one. :hurr:

If a player get’s removed using ent_fire, and the given player executes a command, the Entity index is most likely going to be 0 - Atleast that’s what it was like days back in GMod9.

Luckily players crash when their entity gets removed.

No they dont but they get spammed with errors and you have to CTRL+ALT+DEL remove GMOD.


] lua_run concommand.Add("am_i_gone", function(userid, args) print(userid, args) end)
> concommand.Add("am_i_gone", function(userid, args) print(userid, args) end)...

] lua_run print(Entity(1))
> print(Entity(1))...
Player [1][DrogenViech]

] am_i_gone 
Player [1][DrogenViech]	am_i_gone

] lua_run Entity(1):Remove()
> Entity(1):Remove()...
Warning: Deleting orphaned children of player
ERROR: GAMEMODE:'CalcView' Failed: base/gamemode/cl_init.lua:443: attempt to call method 'GetVehicle' (a nil value)

] am_i_gone 
Warning: Player issued command but is now vanished (Command was "")

Well you don’t crash if your player entity get’s removed - apparently you can’t call console commands anymore either - in GMod9 you could still do “say Hello world!” and it would appear as the console talking in chat, so yea, my fault, sorry.

Edit:
You don’t need to shut down hl2.exe, reconnecting fixes it though.