How do you tell if the server console used a command created with concommand.Add?
5 replies, posted
This works but is it safe? Is it possible for other players to somehow make ply NULL when a command is sent?
[lua]
concommand.Add("ev_cleanup_info",function(ply)
if not ply:IsValid() or ply:IsSuperAdmin() then
end
end)
[/lua]
It's safe. The engine lets people send commands before they are valid, but Garry's Mod checks for this before Lua concommands are ran.
[QUOTE=thegrb93;47420431]This works but is it safe? Is it possible for other players to somehow make ply NULL when a command is sent?
[lua]
concommand.Add("ev_cleanup_info",function(ply)
if not ply:IsValid() or ply:IsSuperAdmin() then
end
end)
[/lua][/QUOTE]
No, the player object should always exist when a player executes a command. There was an old exploit a few years back where you could run a command the same frame you disconnected and you could trick the server but no such exploit is in the wild nowadays.
FYI the player object [b]will NOT be valid[/b] if you enter the console command into the server console ( If you are using srcds )
[QUOTE=Robotboy655;47420483]FYI the player object [b]will NOT be valid[/b] if you enter the console command into the server console ( If you are using srcds )[/QUOTE]
We should really have some sort of check for that though. It doesn't make sense for most situations but for something like this and a few others I can think of it would be helpful.
[QUOTE=Aide;47420732]We should really have some sort of check for that though.[/QUOTE]
That is the check? Seems like the only sensible behaviour to me.
Sorry, you need to Log In to post a reply to this thread.