^_^ Electrify
21-07-11, 07:33 AM
Jusst copy/paste in a txt and save it as lua.For chat /4 MESSAGE
local CMD = { LIST = "#commands",
REZ = "#ress",
MALL = "#mall",
FOOD = "#food",
BUFFS = "#buffs",
HEAL = "#heal",
REPAIR = "#repair",
GMLIST = "#gms",
SAVE = "#save",
AURAS = "#remove" }
local RANKS = { }
RANKS["az"] = "<ADMIN>"
RANKS["a"] = "<GM>"
RANKS["g"] = "<TGM>"
RANKS[""] = "<PLAYER>"
local owner = "OWNER" --The account name of the server owner.
function CustomChatHandler(event, player, message, type, language)
if (type == 17 and message:sub(1, 1) ~= "." and message:sub(1, 1) ~= "#") then
local LogFile = io.open("logs/GlobalChat.txt", "a")
local t = player:GetTeam()
if (string.sub(message, 1, 8) ~= "GmTicket") then
for _,v in pairs(GetPlayersInWorld()) do
if (player:GetGmRank() == "az") and (string.lower(player:GetAccountName()) == owner:lower()) then
v:SendBroadcastMessage(string.format("|cFFDC143C[WORLD]|r |cFF00FFFF<Owner> %s|r: |cFFFFA07A%s|r", player:GetName(), message))
elseif (player:GetGmRank() == "az") then
v:SendBroadcastMessage(string.format("|cFFDC143C[WORLD]|r |cFF00FFFF<Admin> %s|r: |cFFFFA07A%s|r", player:GetName(), message))
elseif (player:GetGmRank() == "a") then
v:SendBroadcastMessage(string.format("|cFFDC143C[WORLD]|r |cFF00FFFF<GM> %s|r: |cFFFFA07A%s|r", player:GetName(), message))
elseif (player:GetGmRank() == "g") then
v:SendBroadcastMessage(string.format("|cFFDC143C[WORLD]|r |cFF00FFFF<Ticket GM> %s|r: |cFFFFA07A%s|r", player:GetName(), message))
elseif (t == 0) then
v:SendBroadcastMessage(string.format("|cFFDC143C[WORLD]|r |cff2B65EC[Alliance]|r |cffffcc00[%s]:|r |cffffffff%s|r", player:GetName(), message))
else
v:SendBroadcastMessage(string.format("|cFFDC143C[WORLD]|r |cffC11B17[Horde]|r |cffffcc00[%s]:|r |cffffffff%s|r", player:GetName(), message))
end
end
LogFile:write(string.format("%s %s %s [Account - %s]:: %s\n", GetTimeStamp(), RANKS[player:GetGmRank()], player:GetName(), string.upper(player:GetAccountName()), message))
end
LogFile:close()
return 0
elseif (type == 17 and message:lower() == CMD.LIST or message:lower() == CMD.LIST) then
player:SendBroadcastMessage("-------------------------------------------------")
player:SendBroadcastMessage("Your player command list")
player:SendBroadcastMessage("#commands <--- Displays your commands")
player:SendBroadcastMessage("#mall <---- Ports you to the Mall")
player:SendBroadcastMessage("#food <--- Gathers food for you to eat!")
player:SendBroadcastMessage("#buffs <--- Gives you buffs!")
player:SendBroadcastMessage("#heal me <---- Heals You From Damage!")
player:SendBroadcastMessage("#remove <---- Removes all auras from you.")
player:SendBroadcastMessage("#repair <--- Spawns a handy repair bot!")
player:SendBroadcastMessage("#ress <--- Revives you if your dead!")
player:SendBroadcastMessage("#gms <--- Shows a list of all online GMs and their rank.")
player:SendBroadcastMessage("#save <--- Saves your character to the database.")
player:SendBroadcastMessage("-------------------------------------------------")
return 0
elseif (message:lower() == CMD.SAVE) then
if (player:IsInCombat() == true) then
player:SendAreaTriggerMessage("You cannot save in combat!")
else
player:SavePlayer()
player:SendAreaTriggerMessage("Your character has been saved.")
end
return 0
elseif (message:lower() == CMD.AURAS) then
if (player:IsInCombat() == true) then
player:SendAreaTriggerMessage("You cannot remove auras in combat!")
else
player:RemoveAllAuras()
player:SendAreaTriggerMessage("All auras have been removed.")
end
return 0
elseif (message:lower() == CMD.REZ) then
if (player:IsAlive() ~= true) then
player:ResurrectPlayer()
else
player:SendAreaTriggerMessage("You are not dead!")
end
return 0
elseif (message:lower() == CMD.MALL) then
player:Teleport(MAP, X, Y, Z)
return 0
elseif (message:lower() == CMD.FOOD) then
if (player:IsInCombat() ~= false) then
player:SendAreaTriggerMessage("You can not use this command in combat.")
else
player:AddItem(21215, 20)
end
return 0
elseif (message:lower() == CMD.BUFFS) then
if (player:IsInCombat() ~= false) then
player:SendAreaTriggerMessage("You cannot buff while in combat.")
else
player:CastSpell(9884)
player:CastSpell(9910)
player:CastSpell(10938)
player:CastSpell(48102)
player:CastSpell(48100)
player:CastSpell(48104)
player:CastSpell(27126)
player:CastSpell(25898)
player:SendAreaTriggerMessage("You have been buffed.")
end
return 0
elseif (message:lower() == CMD.HEAL) then
if (player:IsInCombat() ~= false) then
player:SendAreaTriggerMessage("You cannot heal while in combat.")
else
player:CastSpell(68013)
player:SendAreaTriggerMessage("You've been healed.")
end
return 0
elseif (message:lower() == CMD.REPAIR) then
if (player:IsInCombat() ~= false) then
player:SendAreaTriggerMessage("You cannot repair while in combat.")
else
player:RepairAllPlayerItems()
player:SendAreaTriggerMessage("Your items have been repaired.")
end
return 0
elseif (message:lower() == CMD.GMLIST) then
local c = 0
player:SendBroadcastMessage("------------------------------")
for k,v in pairs(GetPlayersInWorld()) do
if (v:GetGmRank() == "g") or (v:GetGmRank() == "a") or (v:GetGmRank() == "az") then
if(v:HasFlag(150, 2) == false and v:HasFlag(150, 4) == false and v:HasFlag(150, 8) == true) then
player:SendBroadcastMessage(string.format(" - %s%s is online", RANKS[v:GetGmRank()], v:GetName()))
c = c + 1
end
end
end
player:SendBroadcastMessage("------------------------------")
if (c == 0) then
player:SendBroadcastMessage("There are currently no GMs online.")
elseif (c == 1) then
player:SendBroadcastMessage("There is currently 1 GM online.")
else
player:SendBroadcastMessage(string.format("There are currently %u GMs online.", c))
end
return 0
end
end
function GetTimeStamp()
local RAWTIME = os.time()
local DATE = os.date("%x", RAWTIME)
local TIME = nil
local HOUR = tonumber(string.sub(tostring(os.date("%X", RAWTIME)), 1, 2))
local MINUTE = tonumber(string.sub(tostring(os.date("%X", RAWTIME)), 4, 5))
local SECOND = tonumber(string.sub(tostring(os.date("%X", RAWTIME)), 7, 8))
if (HOUR == 13) then
HOUR = 1
elseif (HOUR == 14) then
HOUR = 2
elseif (HOUR == 15) then
HOUR = 3
elseif (HOUR == 16) then
HOUR = 4
elseif (HOUR == 17) then
HOUR = 5
elseif (HOUR == 18) then
HOUR = 6
elseif (HOUR == 19) then
HOUR = 7
elseif (HOUR == 20) then
HOUR = 8
elseif (HOUR == 21) then
HOUR = 9
elseif (HOUR == 22) then
HOUR = 10
elseif (HOUR == 23) then
HOUR = 11
elseif (HOUR == 00) then
HOUR = 12
end
TIME = string.format("%u:%u:%u %s", HOUR, MINUTE, SECOND, tostring(os.date("%p", RAWTIME)))
return string.format("[%s, %s]", TIME, DATE)
end
local CMD = { LIST = "#commands",
REZ = "#ress",
MALL = "#mall",
FOOD = "#food",
BUFFS = "#buffs",
HEAL = "#heal",
REPAIR = "#repair",
GMLIST = "#gms",
SAVE = "#save",
AURAS = "#remove" }
local RANKS = { }
RANKS["az"] = "<ADMIN>"
RANKS["a"] = "<GM>"
RANKS["g"] = "<TGM>"
RANKS[""] = "<PLAYER>"
local owner = "OWNER" --The account name of the server owner.
function CustomChatHandler(event, player, message, type, language)
if (type == 17 and message:sub(1, 1) ~= "." and message:sub(1, 1) ~= "#") then
local LogFile = io.open("logs/GlobalChat.txt", "a")
local t = player:GetTeam()
if (string.sub(message, 1, 8) ~= "GmTicket") then
for _,v in pairs(GetPlayersInWorld()) do
if (player:GetGmRank() == "az") and (string.lower(player:GetAccountName()) == owner:lower()) then
v:SendBroadcastMessage(string.format("|cFFDC143C[WORLD]|r |cFF00FFFF<Owner> %s|r: |cFFFFA07A%s|r", player:GetName(), message))
elseif (player:GetGmRank() == "az") then
v:SendBroadcastMessage(string.format("|cFFDC143C[WORLD]|r |cFF00FFFF<Admin> %s|r: |cFFFFA07A%s|r", player:GetName(), message))
elseif (player:GetGmRank() == "a") then
v:SendBroadcastMessage(string.format("|cFFDC143C[WORLD]|r |cFF00FFFF<GM> %s|r: |cFFFFA07A%s|r", player:GetName(), message))
elseif (player:GetGmRank() == "g") then
v:SendBroadcastMessage(string.format("|cFFDC143C[WORLD]|r |cFF00FFFF<Ticket GM> %s|r: |cFFFFA07A%s|r", player:GetName(), message))
elseif (t == 0) then
v:SendBroadcastMessage(string.format("|cFFDC143C[WORLD]|r |cff2B65EC[Alliance]|r |cffffcc00[%s]:|r |cffffffff%s|r", player:GetName(), message))
else
v:SendBroadcastMessage(string.format("|cFFDC143C[WORLD]|r |cffC11B17[Horde]|r |cffffcc00[%s]:|r |cffffffff%s|r", player:GetName(), message))
end
end
LogFile:write(string.format("%s %s %s [Account - %s]:: %s\n", GetTimeStamp(), RANKS[player:GetGmRank()], player:GetName(), string.upper(player:GetAccountName()), message))
end
LogFile:close()
return 0
elseif (type == 17 and message:lower() == CMD.LIST or message:lower() == CMD.LIST) then
player:SendBroadcastMessage("-------------------------------------------------")
player:SendBroadcastMessage("Your player command list")
player:SendBroadcastMessage("#commands <--- Displays your commands")
player:SendBroadcastMessage("#mall <---- Ports you to the Mall")
player:SendBroadcastMessage("#food <--- Gathers food for you to eat!")
player:SendBroadcastMessage("#buffs <--- Gives you buffs!")
player:SendBroadcastMessage("#heal me <---- Heals You From Damage!")
player:SendBroadcastMessage("#remove <---- Removes all auras from you.")
player:SendBroadcastMessage("#repair <--- Spawns a handy repair bot!")
player:SendBroadcastMessage("#ress <--- Revives you if your dead!")
player:SendBroadcastMessage("#gms <--- Shows a list of all online GMs and their rank.")
player:SendBroadcastMessage("#save <--- Saves your character to the database.")
player:SendBroadcastMessage("-------------------------------------------------")
return 0
elseif (message:lower() == CMD.SAVE) then
if (player:IsInCombat() == true) then
player:SendAreaTriggerMessage("You cannot save in combat!")
else
player:SavePlayer()
player:SendAreaTriggerMessage("Your character has been saved.")
end
return 0
elseif (message:lower() == CMD.AURAS) then
if (player:IsInCombat() == true) then
player:SendAreaTriggerMessage("You cannot remove auras in combat!")
else
player:RemoveAllAuras()
player:SendAreaTriggerMessage("All auras have been removed.")
end
return 0
elseif (message:lower() == CMD.REZ) then
if (player:IsAlive() ~= true) then
player:ResurrectPlayer()
else
player:SendAreaTriggerMessage("You are not dead!")
end
return 0
elseif (message:lower() == CMD.MALL) then
player:Teleport(MAP, X, Y, Z)
return 0
elseif (message:lower() == CMD.FOOD) then
if (player:IsInCombat() ~= false) then
player:SendAreaTriggerMessage("You can not use this command in combat.")
else
player:AddItem(21215, 20)
end
return 0
elseif (message:lower() == CMD.BUFFS) then
if (player:IsInCombat() ~= false) then
player:SendAreaTriggerMessage("You cannot buff while in combat.")
else
player:CastSpell(9884)
player:CastSpell(9910)
player:CastSpell(10938)
player:CastSpell(48102)
player:CastSpell(48100)
player:CastSpell(48104)
player:CastSpell(27126)
player:CastSpell(25898)
player:SendAreaTriggerMessage("You have been buffed.")
end
return 0
elseif (message:lower() == CMD.HEAL) then
if (player:IsInCombat() ~= false) then
player:SendAreaTriggerMessage("You cannot heal while in combat.")
else
player:CastSpell(68013)
player:SendAreaTriggerMessage("You've been healed.")
end
return 0
elseif (message:lower() == CMD.REPAIR) then
if (player:IsInCombat() ~= false) then
player:SendAreaTriggerMessage("You cannot repair while in combat.")
else
player:RepairAllPlayerItems()
player:SendAreaTriggerMessage("Your items have been repaired.")
end
return 0
elseif (message:lower() == CMD.GMLIST) then
local c = 0
player:SendBroadcastMessage("------------------------------")
for k,v in pairs(GetPlayersInWorld()) do
if (v:GetGmRank() == "g") or (v:GetGmRank() == "a") or (v:GetGmRank() == "az") then
if(v:HasFlag(150, 2) == false and v:HasFlag(150, 4) == false and v:HasFlag(150, 8) == true) then
player:SendBroadcastMessage(string.format(" - %s%s is online", RANKS[v:GetGmRank()], v:GetName()))
c = c + 1
end
end
end
player:SendBroadcastMessage("------------------------------")
if (c == 0) then
player:SendBroadcastMessage("There are currently no GMs online.")
elseif (c == 1) then
player:SendBroadcastMessage("There is currently 1 GM online.")
else
player:SendBroadcastMessage(string.format("There are currently %u GMs online.", c))
end
return 0
end
end
function GetTimeStamp()
local RAWTIME = os.time()
local DATE = os.date("%x", RAWTIME)
local TIME = nil
local HOUR = tonumber(string.sub(tostring(os.date("%X", RAWTIME)), 1, 2))
local MINUTE = tonumber(string.sub(tostring(os.date("%X", RAWTIME)), 4, 5))
local SECOND = tonumber(string.sub(tostring(os.date("%X", RAWTIME)), 7, 8))
if (HOUR == 13) then
HOUR = 1
elseif (HOUR == 14) then
HOUR = 2
elseif (HOUR == 15) then
HOUR = 3
elseif (HOUR == 16) then
HOUR = 4
elseif (HOUR == 17) then
HOUR = 5
elseif (HOUR == 18) then
HOUR = 6
elseif (HOUR == 19) then
HOUR = 7
elseif (HOUR == 20) then
HOUR = 8
elseif (HOUR == 21) then
HOUR = 9
elseif (HOUR == 22) then
HOUR = 10
elseif (HOUR == 23) then
HOUR = 11
elseif (HOUR == 00) then
HOUR = 12
end
TIME = string.format("%u:%u:%u %s", HOUR, MINUTE, SECOND, tostring(os.date("%p", RAWTIME)))
return string.format("[%s, %s]", TIME, DATE)
end