Skip to content

Instantly share code, notes, and snippets.

@VADemon
Last active October 7, 2015 21:18
Show Gist options
  • Save VADemon/3226436 to your computer and use it in GitHub Desktop.
Save VADemon/3226436 to your computer and use it in GitHub Desktop.
Requested by: http://www.unrealsoftware.de/forum_posts.php?post=327431 Toggle-able Adminsay Lua v1.2
--Adminsay by VADemon version 1.3 http://www.unrealsoftware.de/profile.php?userid=7844
--Requested by AtomKuh http://www.unrealsoftware.de/profile.php?userid=86415
adminsay={}
adminsay.enabled = {}
adminsay.prefix = {}
adminsay.suffix = {}
adminsay.color = {}
adminsay.standardcolor = "255255255" --if user hasn't a defined color
function adminsay.addUser(usgn, prefix, suffix, color) -- DONT TOUCH THIS
usgn = tonumber(usgn)
if usgn~=0 then
local prefix = prefix or ""
local suffix = suffix or ""
local color = color or adminsay.standardcolor
adminsay.enabled[usgn] = true
adminsay.prefix[usgn] = prefix
adminsay.suffix[usgn] = suffix
adminsay.color[usgn] = color
print("©" .. color .. "[AdminSay] Added user \"" .. usgn .."\"! Prefix: \""..prefix.."\" and Suffix: \""..suffix.."\"")
else
print("©255000000[AdminSay] Unable to add USGN ID \"0\"!")
end
end
--To add a user use this function:
-- adminsay.addUser( USGN_HERE, PREFIX, SUFFIX, COLOR_CODE)
--To set an empty prefix or suffix, just write nil OR ""
adminsay.addUser(7844, "[Script Developer]", nil, "122180050")
adminsay.addUser(9000, "", " [The OVER9000 Master]", "240180150")
-- ADD YOUR USERS HERE ^
-- END OF CONFIG
addhook("say","adminsay.say", 15) -- INCREASE THE NUMBER IF YOUR NORMAL MESSAGES ARE SHOWN THOUGH AdminSay is active!
function adminsay.say(id,say)
local usgn=player(id,"usgn")
if say=="!adminsay toggle" then
if adminsay.enabled[usgn] then
adminsay.enabled[usgn]=false
msg2(id,"©255255255Der Admin-tag wurde ausgeschaltet!")
elseif adminsay.enabled[usgn]==false then
adminsay.enabled[usgn]=true
msg2(id,"©255255255Der Admin-tag wurde eingeschaltet!")
else
msg2(id,"©255255255Du darfst diesen Befehl nicht benutzen!")
end
return 1
end
if adminsay.enabled[usgn] then
msg("©"..adminsay.getcolor(usgn)..adminsay.getprefix(usgn)..player(id,"name")..adminsay.getsuffix(usgn)..adminsay.dead(id)..say)
return 1
end
end
function adminsay.dead(id)
local msg=": "
if player(id,"health")==0 then
msg=" *DEAD*"..msg
end
return msg
end
function adminsay.getprefix(usgn)
if adminsay.prefix[usgn] then
return adminsay.prefix[usgn]
end
return ""
end
function adminsay.getsuffix(usgn)
if adminsay.suffix[usgn] then
return adminsay.suffix[usgn]
end
return ""
end
function adminsay.getcolor(usgn)
if adminsay.color[usgn] then
return adminsay.color[usgn]
end
return adminsay.standardcolor
end
@Alphace
Copy link

Alphace commented Apr 30, 2013

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment