General > Developers Corner
Give Access to a single rcon command?
PAL-18:
Any idea how i can give admins access to a single rcon command?
In this case, the command is: ttt_print_damagelog
JamminR:
See http://forums.ulyssesmod.net/index.php/topic,5889.0.html
Not sure it ever got answered fully, but we sure tried to help.
Stickly Man!:
In case you don't want to have a separate command for it, you can in fact limit rcon commands. It works best in XGUI, but you can see the access tag equivalent in the chat:
.. It's not very forgiving in terms of needing to be spelled out EXACTLY, but, it works:
--- Code: ---] ulx rcon "ulx slap sti"
(SILENT) You ran rcon command: ulx slap sti
(Console) slapped You with 0 damage
] ulx rcon disconnect
Command "ulx rcon", argument #1: invalid string
] ulx rcon "say 'bob'"
(SILENT) You ran rcon command: say 'bob'
Console: 'bob'
--- End code ---
nathan736:
to do this the clean way for at least the ttt command you would edit the logic for who can use the command
some place there should be a if statement
if ply:is superadmin then
ttt logs go here
end
im no lazy to find it right now be back tomorow hopefully
screw it i did its the admin.lua file in ttt/gamemode/admin.lua
*falls asleep*
nathan736:
ok a bump im geting pissed about this i tried doing this and got it to work just not with a not alive aswell so im going to copy paste my code
--- Code: ---local function PrintDamageLog(ply)
local pr = GetPrintFn(ply)
if (not IsValid(ply)) or ply:IsSuperAdmin() or GetRoundState() != ROUND_ACTIVE then
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.")
end
if not ply:alive() then
if ply:IsUserGroup("admin") or ply:IsUserGroup("moderator") then
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.")
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 ---
vinnila code is here
--- Code: ---local function PrintDamageLog(ply)
local pr = GetPrintFn(ply)
if (not IsValid(ply)) or ply:IsSuperAdmin() or GetRoundState() != ROUND_ACTIVE then
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 ---
Navigation
[0] Message Index
[#] Next page
Go to full version