General > Developers Corner
Give Access to a single rcon command?
JamminR:
So you're trying to allow this TTT command while not just dead, but also while alive?
I'm guessing if someone is alive, which means they are in an active round, they can't run it.
Then this is your catch ... "GetRoundState() != ROUND_ACTIVE"
GetRoundState NOT EQUAL to ACTIVE = Don't show if server is in a round.
nathan736:
--- Quote from: JamminR on January 03, 2013, 05:22:45 PM ---So you're trying to allow this TTT command while not just dead, but also while alive?
I'm guessing if someone is alive, which means they are in an active round, they can't run it.
Then this is your catch ... "GetRoundState() != ROUND_ACTIVE"
GetRoundState NOT EQUAL to ACTIVE = Don't show if server is in a round.
--- End quote ---
ok to some respects you are correct if the user is super admin they can run it when ever because they are to be trusted but admins and lower or who else i want to be able to see logs when dead during a round would be geting output via the else if unless i coded this wrong
JamminR:
I'm pretty sure Gmod functions are case-sensitive, just like rest of Lua.
You're using 'ply:alive()' instead of ply:Alive()'.
But, that's all my flu symptom addled and sore brain can see at the moment.
nathan736:
this should work *UNTESTED WILL BREAK LOGS IF DOESNT WORK*
--- Code: ---local function PrintDamageLog(ply)
local pr = GetPrintFn(ply)
if (not IsValid(ply)) or ply:IsSuperAdmin() or ply:IsUserGroup("admin") or ply:IsUserGroup("moderator") or GetRoundState() != ROUND_ACTIVE then
if ply:Alive() and GetRoundState() = ROUND_ACTIVE and (ply:IsUserGroup("admin") or ply:IsUserGroup("moderator")) then
pr("You do not appear to be dead, nor are we in the post-round phase!")
return
end
ServerLog(Format("%s used ttt_print_damagelog\n", IsValid(ply) and ply:Nick() or "console"))
pr("*** Damage log:\n")
if not dmglog_console:GetBool() then
pr("Damage logging for console disabled. Enable with ttt_log_damage_for_console 1.")
end
for k, txt in ipairs(GAMEMODE.DamageLog) do
pr(txt)
end
pr("*** Damage log end.")
else
if IsValid(ply) then
pr("You do not appear to be RCON or a superadmin, nor are we in the post-round phase!")
end
end
end
concommand.Add("ttt_print_damagelog", PrintDamageLog)
--- End code ---
update yeah this doesnt work need help
nathan736:
this doesnt work just make a duplicate command in the admin.lua for the printing dammage logs and remove the if arguments and call that via ulx
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version