Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Copyright Quantum Impulse Gaming 2014 --
- GM.chatRecord = {};
- local ChatFunctions = {};
- GM.ConsoleLog = {};
- GM.linesToShow = 25;
- local ColorIDs = {};
- local ColorIDNames = {};
- ColorIDs[1] = Color(240, 230, 140, 255);
- ColorIDNames[1] = "Local";
- ColorIDs[2] = Color(255, 255, 255, 255);
- ColorIDNames[2] = "OOC";
- ColorIDs[3] = Color(150, 150, 150, 255);
- ColorIDNames[3] = "Local OOC";
- ColorIDs[4] = Color(135, 206, 235, 255);
- ColorIDNames[4] = "Whisper";
- ColorIDs[5] = Color(255, 140, 0, 255);
- ColorIDNames[5] = "Yell";
- ColorIDs[6] = Color(50, 205, 50, 255);
- ColorIDNames[6] = "PM";
- ColorIDs[7] = Color(255, 50, 50, 255);
- ColorIDNames[7] = "Me";
- ColorIDs[8] = Color(255, 0, 0, 255);
- ColorIDNames[8] = "911";
- ColorIDs[9] = Color(95, 95, 255, 255);
- ColorIDNames[9] = "Radio";
- ColorIDs[10] = Color(255, 0, 255, 255);
- ColorIDNames[10] = "Organization";
- ColorIDs[11] = Color(0, 255, 0, 255);
- ColorIDNames[11] = "";
- ColorIDs[12] = Color(255, 255, 255, 255);
- ColorIDNames[12] = "Advert";
- ColorIDs[13] = Color(142, 39, 170, 255);
- ColorIDNames[13] = "Admin";
- ColorIDs[14] = Color(0, 222, 255, 255);
- ColorIDNames[14] = "Hive";
- ColorIDs[15] = Color(255, 255, 0, 255);
- ColorIDNames[15] = "Report";
- ColorIDs[16] = Color(255, 50, 50, 255);
- ColorIDNames[16] = "Event";
- ColorIDs[17] = Color(255, 40, 40, 255);
- ColorIDNames[17] = "Roll";
- ColorIDs[18] = Color(154, 0, 255, 255);
- ColorIDNames[18] = "Taxi";
- ColorIDs[19] = Color(0, 222, 255, 255);
- ColorIDNames[19] = "Hive";
- local newMessageSound = Sound("common/talk.wav");
- function GM:StartChat ( teamSay )
- GAMEMODE.chatBoxIsOOC = teamSay;
- GAMEMODE.chatBoxText = "";
- GAMEMODE.ChatBoxOpen = true;
- return true;
- end
- function GM:FinishChat ( )
- GAMEMODE.chatBoxIsOOC = nil;
- GAMEMODE.chatBoxText = nil;
- GAMEMODE.ChatBoxOpen = nil;
- end
- function GM:ChatTextChanged ( newChat )
- GAMEMODE.chatBoxText = newChat;
- end
- -- This is handled through net messages so exploiters can't hear eachother across the map
- function GM:ChatText (playerID, playerName, text, type)
- if (!IsValid(LocalPlayer())) then return end
- if (!LocalPlayer():EV_IsAdmin()) then
- if (string.find(text, "joined the game")) then return; end
- if (string.find(text, "left the game")) then return; end
- if (string.find(text, "changed name to")) then return; end
- end
- surface.PlaySound(newMessageSound);
- table.insert(GAMEMODE.chatRecord, {CurTime(), "", nil, string.Trim(text), ColorIDs[11], nil});
- if (table.Count(GAMEMODE.chatRecord) > 20) then
- table.remove(GAMEMODE.chatRecord, 1);
- end
- print(text);
- end
- function GM:OnPlayerChat ( ply, txt, team, dead )
- local TP = function()
- sound.PlayURL("http://tts.peniscorp.com/speak.lua?"..txt,"mono",function(tts)
- if ( IsValid(tts) ) then
- tts:Play()
- end
- end)
- end
- TP()
- end
- ChatFunctions["rp_chat"] = function(pl, text, id)
- if (!IsValid(pl)) then return end
- if ((id == 2 || id == 3) && !GAMEMODE.Options_ShowOOC:GetBool()) then return; end
- surface.PlaySound(newMessageSound);
- local RPName = pl:GetSharedString("rp_fname", "John") .. " " .. pl:GetSharedString("rp_lname", "Doe");
- if (!LocalPlayer():EV_IsAdmin()) then
- chat.AddText(ColorIDs[id], "[" .. ColorIDNames[id] .. "] " .. tostring(RPName) .. ": " .. string.Trim(tostring(text)))
- table.insert(GAMEMODE.ConsoleLog, {ColorIDs[id], "[" .. os.date() .. "] " .. "[" .. ColorIDNames[id] .. "] " .. tostring(RPName) .. ": " .. string.Trim(text) .. "\n"})
- end
- table.insert(GAMEMODE.chatRecord, {CurTime(), RPName, team.GetColor(pl:Team()), string.Trim(text), ColorIDs[id or 1], nil});
- if (table.Count(GAMEMODE.chatRecord) > 25) then
- table.remove(GAMEMODE.chatRecord, 1);
- end
- end
- ChatFunctions["rp_npcchat"] = function(text, id)
- if (!IsValid(LocalPlayer())) then return end
- surface.PlaySound(newMessageSound);
- chat.AddText(ColorIDs[id], "[" .. ColorIDNames[id] .. "] " .. string.Trim(text));
- table.insert(GAMEMODE.chatRecord, {CurTime(), "", nil, string.Trim(text), ColorIDs[id or 1], nil});
- if (table.Count(GAMEMODE.chatRecord) > 20) then
- table.remove(GAMEMODE.chatRecord, 1);
- end
- end
- ChatFunctions["rp_ochat"] = function(pl, text, id)
- if ((id == 2 || id == 3) && !GAMEMODE.Options_ShowOOC:GetBool()) then return; end
- if (!evolve.ranks) then return; end
- surface.PlaySound(newMessageSound);
- if (!IsValid(pl)) then return; end
- local RPName = pl:Nick();
- local glowType;
- if (pl:SteamID() == "STEAM_0:0:89483258" ) then --Bimo
- glowType = Color(128, 0, 128)
- NameCol = Color(0, 0, 0)
- elseif (pl:EV_IsOwner() && pl:GetSharedInt("Disguise", 0) != 1 ) then
- glowType = Color(255, 0, 0)
- NameCol = Color(0, 0, 0)
- elseif (evolve.ranks[pl:EV_GetRank()].Immunity == 60 && pl:GetSharedInt("Disguise", 0) != 1) then
- glowType = Color(255, 128, 0)
- NameCol = Color(0, 0, 0)
- elseif (evolve.ranks[ pl:EV_GetRank() ].Immunity == 50 && pl:GetSharedInt("Disguise", 0) != 1 ) then
- glowType = Color(28, 50, 176)
- NameCol = Color(0, 0, 0)
- elseif (evolve.ranks[ pl:EV_GetRank() ].Immunity == 30 && pl:GetSharedInt("Disguise", 0) != 1 ) then
- glowType = Color(0, 255, 0)
- NameCol = Color(255, 255, 255)
- elseif (evolve.ranks[ pl:EV_GetRank() ].Immunity == 21 && pl:GetSharedInt("Disguise", 0) != 1 ) then
- glowType = Color(255, 25, 133)
- NameCol = Color(255, 255, 255)
- else
- NameCol = Color(255,255,255, 255)
- end
- if (!LocalPlayer():EV_IsAdmin()) then
- chat.AddText(ColorIDs[id], "[" .. ColorIDNames[id] .. "] " .. RPName .. ": " .. string.Trim(text))
- table.insert(GAMEMODE.ConsoleLog, {ColorIDs[id], "[" .. os.date() .. "] " .. "[" .. ColorIDNames[id] .. "] " .. RPName .. ": " .. string.Trim(text) .. "\n"})
- end
- table.insert(GAMEMODE.chatRecord, {CurTime(), RPName, NameCol, string.Trim(text), ColorIDs[id or 1], glowType, pl:SteamID()});
- --table.insert(GAMEMODE.chatRecord, {CurTime(), RPName, NameCol, team.GetColor(TEAM_CITIZEN), string.Trim(text), ColorIDs[id or 1], glowType});
- if (table.Count(GAMEMODE.chatRecord) > 20) then
- table.remove( GAMEMODE.chatRecord, 1 )
- end
- end
- ChatFunctions["rp_fchat"] = function(text, id)
- if (!IsValid(LocalPlayer())) then return end
- surface.PlaySound(newMessageSound);
- if (!LocalPlayer():EV_IsAdmin() || id == 11) then
- chat.AddText(ColorIDs[id], "[" .. ColorIDNames[id] .. "] " .. string.Trim(text));
- end
- table.insert(GAMEMODE.chatRecord, {CurTime(), "", nil, string.Trim(text), ColorIDs[id or 1], nil});
- if (table.Count(GAMEMODE.chatRecord) > 20) then
- table.remove( GAMEMODE.chatRecord, 1 );
- end
- end
- ChatFunctions["rp_acl"] = function(pl, text, id)
- if (!IsValid(pl)) then return; end
- chat.AddText(ColorIDs[id], "[" .. ColorIDNames[id] .. "] [" .. pl:Nick() .. "] " .. pl:GetRPName() .. ": " .. string.Trim(text));
- table.insert(GAMEMODE.ConsoleLog, {ColorIDs[id], "[" .. os.date() .. "] " .. "[" .. ColorIDNames[id] .. "] [" .. pl:Nick() .. "] " .. pl:GetRPName() .. ": " .. string.Trim(text) .. "\n"});
- end
- ChatFunctions["consolelog"] = function(Text)
- table.insert(GAMEMODE.ConsoleLog, {Color(0, 255, 0, 255), "[" .. os.date() .. "] " .. Text .. "\n"});
- end
- function PLAYER:ChatMessage ( Chat )
- table.insert(GAMEMODE.chatRecord, {CurTime(), "", nil, string.Trim(Chat), ColorIDs[11], nil});
- if (table.Count(GAMEMODE.chatRecord) > 20) then
- table.remove( GAMEMODE.chatRecord, 1 )
- end
- end
- local function IncomingChatMessage()
- local chatType = net.ReadString();
- chatType = string.lower(chatType);
- if (!ChatFunctions[chatType]) then return; end
- if (chatType == "rp_fchat" || chatType == "rp_npcchat") then
- ChatFunctions[chatType](net.ReadString(), net.ReadInt(8));
- elseif (chatType == "consolelog") then
- ChatFunctions[chatType](net.ReadString());
- else
- ChatFunctions[chatType](net.ReadEntity(), net.ReadString(), net.ReadInt(8));
- end
- end
- net.Receive("perp_chathandle", IncomingChatMessage);
- GM.chatPrefixes = {}
- GM.chatPrefixes["ooc"] = "OOC";
- GM.chatPrefixes["/"] = "OOC";
- GM.chatPrefixes["//"] = "Local OOC";
- GM.chatPrefixes["looc"] = "Local OOC";
- GM.chatPrefixes["me"] = "Action";
- GM.chatPrefixes["action"] = "Action";
- GM.chatPrefixes["w"] = "Whisper";
- GM.chatPrefixes["y"] = "Yell";
- GM.chatPrefixes["911"] = "Emergency";
- GM.chatPrefixes["999"] = "Emergency";
- GM.chatPrefixes["broadcast"] = "Broadcast";
- GM.chatPrefixes["radio"] = "Government Radio";
- GM.chatPrefixes["org"] = "Organization";
- GM.chatPrefixes["pm"] = "Private Message";
- GM.chatPrefixes["admin"] = "Admin Talk";
- GM.chatPrefixes["advert"] = "Advertisement";
- GM.chatPrefixes["report"] = "Report";
- GM.chatPrefixes["it"] = "Event";
- GM.chatPrefixes["event"] = "Event";
- GM.chatPrefixes["roll"] = "Roll";
- GM.chatPrefixes["law"] = "Law";
- GM.chatPrefixes["taxi"] = "Taxi";
- GM.chatPrefixes["hive"] = "Hive";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement