PDA

View Full Version : [LUA] Global Chat System



Avidgamer
19-08-10, 10:11 PM
Again, I was browsing through my LUA folder when I found this..

Simple chat system, allows both Horde & Alliance to chat with each other on a "channel". Like trade, but you don't have an option to leave. You can edit the Command for the Chat System to anything, however it can't be ".s" as those functions are client based, not server side. e.g. #chat, #c, #cc, #ch etc.

Chat System - Pastebin (http://www.pastebin.org/616079)


local ChatMsg = "#chat" -- Command for use of chat system

--[[ EDIT THE BELOW SCRIPT AT YOUR OWN RISK ]]--
function ChatSystem (event, player, message, type, language)
if (message:find(ChatMsg.." ") == 1) then
local text = message:gsub(ChatMsg.." ", "")
local plrs = GetPlayersInWorld()
for k, v in pairs(plrs) do
if (player:GetTeam() == 0) then -- Alliance
local GMrank = player:GetGmRank()
if (GMrank == 'az') then
v:SendBroadcastMessage("|cFF00FFFF[LMS-Chat] |cFFFFA500[Admin] |cffffff00["..player:GetName().."]: |cff00ff00"..text.."") -- Admin Tag
elseif (GMrank == 'a') then
v:SendBroadcastMessage("|cFF00FFFF[LMS-Chat] |cFFFFA500[GM] |cffffff00["..player:GetName().."]: |cff00ff00"..text.."") -- GM Tag
else
v:SendBroadcastMessage("|cFF00FFFF[LMS-Chat] |cff00ff00[Alliance] |cffffff00["..player:GetName().."]: |cff00ff00"..text.."") -- Ally Tag
end
elseif (player:GetTeam() == 1) then -- Horde
local GMrank = player:GetGmRank()
if (GMrank == 'az') then
v:SendBroadcastMessage("|cFF00FFFF[LMS-Chat] |cFFFFA500[Admin] |cffffff00["..player:GetName().."]: |cffff0000"..text.."") -- Admin Tag
elseif (GMrank == 'a') then
v:SendBroadcastMessage("|cFF00FFFF[LMS-Chat] |cFFFFA500[GM] |cffffff00["..player:GetName().."]: |cffff0000"..text.."") -- GM Tag
else
v:SendBroadcastMessage("|cFF00FFFF[LMS-Chat] |cffff0000[Horde] |cffffff00["..player:GetName().."]: |cffff0000"..text.."") -- Horde Tag

end
end
end
return 0
end

end

RegisterServerHook(16, "ChatSystem")

zwroblewski
22-08-10, 10:56 PM
1st comment and +rep if i can. . .awesome share!

Avidgamer
23-08-10, 08:49 AM
Yeah, it's rather nice for large servers, or even small servers to communicate easily. Looks good and is easy to use.

zwroblewski
23-08-10, 01:00 PM
Yupp but it didn't work for my server but i still give you cred

Avidgamer
23-08-10, 05:08 PM
What error did it give? If your using ArcEmu should work perfectly, all you do is put it into your Scripts folder, load world.exe up (or type reloadscripts in the world.exe screen). It should say "Loaded 1 script" if thats the only script you have. If there is an error, it'll list it. Second, try in-game typing #c Hello!

Unless you changed the chat command, then use that.

zwroblewski
24-08-10, 10:50 AM
Na when i type in #chat to join the channel it just says "#chat" Outloud and trust me i know what to do with lua scripts im no noobs xD

Avidgamer
24-08-10, 03:53 PM
It's technically not a "channel" as such. You do not type #chat to join. You type #chat message here. Everyone will get this message.

zwroblewski
24-08-10, 11:30 PM
So you have to type that everytime lol :P ok it works thanks dude =)

Avidgamer
25-08-10, 10:40 AM
No problem :)