Ulysses
Ulysses Stuff => General Chat & Help and Support => Topic started by: ngc0202 on April 28, 2010, 12:51:43 PM
-
Is there anyway I can have it auto-run codes on-join for specific groups? e.g. Admin gets auto god mode.
-
With a little bit of lua you can. Good chance to learn.
EX:
if (ply:GetUserGroup() == "superadmin") then
game.consolecomand("ulx", "god", ply:Nick())
end
-
With a little bit of lua you can. Good chance to learn.
EX:
if (ply:GetUserGroup() == "superadmin") then
game.consolecomand("ulx", "god", ply:Nick())
end
Where does that lua go?
EDIT: Another question. In the command 'ulx groupallow', it says ulx groupallow <group> <access tag>. What does access tag mean?
-
That code was just an example of somewhere to start, alone it doesn't do anything but throw out some errors.
I'm currently at work, but when I get home in about an hour, I'll make you a fully functional script if you'd like.
As far as the access tags, do some searching around. Megiddo could explain it better if he jumps on here.
Immunity: How It Works Now (http://forums.ulyssesmod.net/index.php/topic,4314.0.html) - If you're using svn ULib, this should help you out.
-
Oh, okay. I read it over and it makes sense now.
EDIT: I would appreciate a full script, that would be good to use as a template to learn from.
-
if !autocodes then
autocodes = {}
end
--Don't touch that up there--
--Configs below--
autocodes.groups = {'superadmin', 'admin', 'operator', 'user'}
autocodes.codes = {
'superadmin' = { 'ulx god', 'ulx cloak' },
'admin' = { 'ulx god' },
}
--End of configs--
function autocodes.applyCodes( ply )
for _, group in pairs(autocodes.groups) do
if autocodes.codes[group] and ( ply:GetUserGroup == group )then
for _, code in pairs(autocodes.codes[group]) do
code = string.Explode( " ", code )
game.consolecommand( code[1], code[2], ply:Nick() )
end
end
end
end
hook.Add( "ULibPlayerReady", "Autocodes_Apply_Hook", autocodes.applyCodes )
Not tested, but pretty sure it's good.
-
Awesome, thank you. I haven't tested it yet, but I will edit when I do. First I have to fix that it doesn't copy new lines, so I have to add them myself, its just a oneliner blob.
EDIT: I fixed the code, but how do I get it to work in the server? Where do I put it?
-
No Problem and good luck! :D