Ulysses
General => Developers Corner => Topic started by: PAL-18 on January 02, 2013, 06:32:40 PM
-
Any idea how i can give admins access to a single rcon command?
In this case, the command is: ttt_print_damagelog
-
See http://forums.ulyssesmod.net/index.php/topic,5889.0.html
Not sure it ever got answered fully, but we sure tried to help.
-
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:
(http://img401.imageshack.us/img401/5134/rconlimitations.png)
.. It's not very forgiving in terms of needing to be spelled out EXACTLY, but, it works:
] 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'
-
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*
-
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
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)
vinnila code is here
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)
-
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.
-
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.
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
-
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.
-
this should work *UNTESTED WILL BREAK LOGS IF DOESNT WORK*
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)
update yeah this doesnt work need help
-
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
-
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:
I dont see the restrict command on my XGUI and im using the latest ULIB+ULX
(https://dl.dropbox.com/u/18722727/xgui.jpg)
-
Holly crap something i can help with! anyway theres an easy way to do this without ulx your going to want to go to "gamemodes\terrortown\gamemode and open admin.lua.
Find 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")
and change ply:IsSuperAdmin()
to ply:IsAdmin()
from that all admins will be able to use the ttt_print_damagelog command at anytime from the console.
-
@bender180 Awesome, thanks!
-
I dont see the restrict command on my XGUI and im using the latest ULIB+ULX
Are you sure you clicked on "ulx rcon" in the middle there? It looks like it hasn't been selected. The side menu (as seen in my screenshot above) should pop out when you do.
-
Are you sure you clicked on "ulx rcon" in the middle there? It looks like it hasn't been selected. The side menu (as seen in my screenshot above) should pop out when you do.
I run a deathrun on my server, and I'm trying to let my players enable third person through RCON but limiting them from every other rcon command, when I get home Ill try this, would there be any other way to do it though?
Sal
-
I run a deathrun on my server, and I'm trying to let my players enable third person through RCON but limiting them from every other rcon command, when I get home Ill try this, would there be any other way to do it though?
You'd be better off using lua for a third person view.
-
yes doing it the actual "correct way" by adding a chat hook.