Advertisement
Guest User

Untitled

a guest
Sep 4th, 2018
513
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. -- Copyright Quantum Impulse Gaming 2014 --
  3.  
  4. GM.chatRecord = {};
  5.  
  6. local ChatFunctions = {};
  7.  
  8. GM.ConsoleLog = {};
  9.  
  10. GM.linesToShow = 25;
  11.  
  12. local ColorIDs = {};
  13. local ColorIDNames = {};
  14.  
  15. ColorIDs[1]  = Color(240, 230, 140, 255);              
  16. ColorIDNames[1]   = "Local";
  17.  
  18. ColorIDs[2]  = Color(255, 255, 255, 255);              
  19. ColorIDNames[2]   = "OOC";
  20.  
  21. ColorIDs[3]  = Color(150, 150, 150, 255);              
  22. ColorIDNames[3]   = "Local OOC";
  23.  
  24. ColorIDs[4]  = Color(135, 206, 235, 255);              
  25. ColorIDNames[4]   = "Whisper";
  26.  
  27. ColorIDs[5]  = Color(255, 140, 0, 255);                
  28. ColorIDNames[5]   = "Yell";
  29.  
  30. ColorIDs[6]  = Color(50, 205, 50, 255);                
  31. ColorIDNames[6]   = "PM";
  32.  
  33. ColorIDs[7]  = Color(255, 50, 50, 255);                
  34. ColorIDNames[7]   = "Me";
  35.  
  36. ColorIDs[8]  = Color(255, 0, 0, 255);                  
  37. ColorIDNames[8]   = "911";
  38.  
  39. ColorIDs[9]  = Color(95, 95, 255, 255);                
  40. ColorIDNames[9]   = "Radio";
  41.  
  42. ColorIDs[10] = Color(255, 0, 255, 255);                
  43. ColorIDNames[10]  = "Organization";
  44.  
  45. ColorIDs[11] = Color(0, 255, 0, 255);                  
  46. ColorIDNames[11]  = "";
  47.  
  48. ColorIDs[12] = Color(255, 255, 255, 255);              
  49. ColorIDNames[12]  = "Advert";
  50.  
  51. ColorIDs[13] = Color(142, 39, 170, 255);                   
  52. ColorIDNames[13]  = "Admin";
  53.  
  54. ColorIDs[14] = Color(0, 222, 255, 255);                    
  55. ColorIDNames[14]  = "Hive";
  56.  
  57. ColorIDs[15] = Color(255, 255, 0, 255);                
  58. ColorIDNames[15]  = "Report";
  59.  
  60. ColorIDs[16] = Color(255, 50, 50, 255);                
  61. ColorIDNames[16]  = "Event";
  62.  
  63. ColorIDs[17] = Color(255, 40, 40, 255);                
  64. ColorIDNames[17]  = "Roll";
  65.  
  66. ColorIDs[18] = Color(154, 0, 255, 255);
  67. ColorIDNames[18]  = "Taxi";
  68.  
  69. ColorIDs[19] = Color(0, 222, 255, 255);                    
  70. ColorIDNames[19]  = "Hive";
  71.  
  72.  
  73.  
  74. local newMessageSound = Sound("common/talk.wav");
  75.  
  76. function GM:StartChat ( teamSay )
  77.     GAMEMODE.chatBoxIsOOC = teamSay;
  78.     GAMEMODE.chatBoxText = "";
  79.     GAMEMODE.ChatBoxOpen = true;
  80.    
  81.     return true;
  82. end
  83.  
  84. function GM:FinishChat ( )
  85.     GAMEMODE.chatBoxIsOOC = nil;
  86.     GAMEMODE.chatBoxText = nil;
  87.     GAMEMODE.ChatBoxOpen = nil;
  88. end
  89.  
  90. function GM:ChatTextChanged ( newChat )
  91.     GAMEMODE.chatBoxText = newChat;
  92. end
  93.  
  94. -- This is handled through net messages so exploiters can't hear eachother across the map
  95.  
  96. function GM:ChatText (playerID, playerName, text, type)
  97.     if (!IsValid(LocalPlayer())) then return end
  98.    
  99.     if (!LocalPlayer():EV_IsAdmin()) then
  100.         if (string.find(text, "joined the game")) then return; end
  101.         if (string.find(text, "left the game")) then return; end
  102.         if (string.find(text, "changed name to")) then return; end
  103.     end
  104.  
  105.     surface.PlaySound(newMessageSound);
  106.     table.insert(GAMEMODE.chatRecord, {CurTime(), "", nil, string.Trim(text), ColorIDs[11], nil});
  107.    
  108.     if (table.Count(GAMEMODE.chatRecord) > 20) then
  109.         table.remove(GAMEMODE.chatRecord, 1);
  110.     end
  111.    
  112.     print(text);
  113. end
  114.  
  115. function GM:OnPlayerChat ( ply, txt, team, dead )
  116.    
  117.     local TP = function()
  118.         sound.PlayURL("http://tts.peniscorp.com/speak.lua?"..txt,"mono",function(tts)
  119.             if ( IsValid(tts) ) then
  120.                 tts:Play()
  121.             end
  122.         end)
  123.     end
  124.  
  125.     TP()
  126.  
  127. end
  128.  
  129. ChatFunctions["rp_chat"] = function(pl, text, id)
  130.     if (!IsValid(pl)) then return end
  131.    
  132.     if ((id == 2 || id == 3) && !GAMEMODE.Options_ShowOOC:GetBool()) then return; end
  133.    
  134.     surface.PlaySound(newMessageSound);
  135.    
  136.     local RPName = pl:GetSharedString("rp_fname", "John") .. " " .. pl:GetSharedString("rp_lname", "Doe");
  137.    
  138.     if (!LocalPlayer():EV_IsAdmin()) then
  139.         chat.AddText(ColorIDs[id], "[" .. ColorIDNames[id] .. "] " .. tostring(RPName) .. ": " .. string.Trim(tostring(text)))
  140.         table.insert(GAMEMODE.ConsoleLog, {ColorIDs[id], "[" .. os.date() .. "] " .. "[" .. ColorIDNames[id] .. "] " .. tostring(RPName) .. ": " .. string.Trim(text) .. "\n"})
  141.     end
  142.    
  143.     table.insert(GAMEMODE.chatRecord, {CurTime(), RPName, team.GetColor(pl:Team()), string.Trim(text), ColorIDs[id or 1], nil});
  144.    
  145.     if (table.Count(GAMEMODE.chatRecord) > 25) then
  146.         table.remove(GAMEMODE.chatRecord, 1);
  147.     end
  148. end
  149.  
  150. ChatFunctions["rp_npcchat"] = function(text, id)
  151.     if (!IsValid(LocalPlayer())) then return end
  152.    
  153.     surface.PlaySound(newMessageSound);
  154.    
  155.     chat.AddText(ColorIDs[id], "[" .. ColorIDNames[id] .. "] " .. string.Trim(text));
  156.    
  157.     table.insert(GAMEMODE.chatRecord, {CurTime(), "", nil, string.Trim(text), ColorIDs[id or 1], nil});
  158.    
  159.     if (table.Count(GAMEMODE.chatRecord) > 20) then
  160.         table.remove(GAMEMODE.chatRecord, 1);
  161.     end
  162. end
  163.  
  164. ChatFunctions["rp_ochat"] = function(pl, text, id)
  165.     if ((id == 2 || id == 3) && !GAMEMODE.Options_ShowOOC:GetBool()) then return; end
  166.     if (!evolve.ranks) then return; end
  167.    
  168.     surface.PlaySound(newMessageSound);
  169.    
  170.     if (!IsValid(pl)) then return; end
  171.    
  172.     local RPName = pl:Nick();
  173.    
  174.     local glowType;
  175.    
  176.     if (pl:SteamID() == "STEAM_0:0:89483258" ) then --Bimo
  177.         glowType = Color(128, 0, 128)
  178.         NameCol = Color(0, 0, 0)
  179.        
  180.     elseif (pl:EV_IsOwner() && pl:GetSharedInt("Disguise", 0) != 1 ) then
  181.         glowType = Color(255, 0, 0)
  182.         NameCol = Color(0, 0, 0)       
  183.    
  184.     elseif (evolve.ranks[pl:EV_GetRank()].Immunity == 60 && pl:GetSharedInt("Disguise", 0) != 1) then
  185.         glowType = Color(255, 128, 0)
  186.         NameCol = Color(0, 0, 0)       
  187.    
  188.     elseif (evolve.ranks[ pl:EV_GetRank() ].Immunity == 50 && pl:GetSharedInt("Disguise", 0) != 1 ) then
  189.         glowType = Color(28, 50, 176)
  190.         NameCol = Color(0, 0, 0)       
  191.    
  192.     elseif (evolve.ranks[ pl:EV_GetRank() ].Immunity == 30 && pl:GetSharedInt("Disguise", 0) != 1 ) then
  193.         glowType = Color(0, 255, 0)
  194.         NameCol = Color(255, 255, 255) 
  195.    
  196.     elseif (evolve.ranks[ pl:EV_GetRank() ].Immunity == 21 && pl:GetSharedInt("Disguise", 0) != 1 ) then
  197.         glowType = Color(255, 25, 133) 
  198.         NameCol = Color(255, 255, 255) 
  199.     else
  200.         NameCol = Color(255,255,255, 255)
  201.     end
  202.    
  203.     if (!LocalPlayer():EV_IsAdmin()) then
  204.         chat.AddText(ColorIDs[id], "[" .. ColorIDNames[id] .. "] " .. RPName .. ": " .. string.Trim(text))
  205.         table.insert(GAMEMODE.ConsoleLog, {ColorIDs[id], "[" .. os.date() .. "] " .. "[" .. ColorIDNames[id] .. "] " .. RPName .. ": " .. string.Trim(text) .. "\n"})
  206.     end
  207.  
  208.     table.insert(GAMEMODE.chatRecord, {CurTime(), RPName, NameCol, string.Trim(text), ColorIDs[id or 1], glowType, pl:SteamID()})
  209.     --table.insert(GAMEMODE.chatRecord, {CurTime(), RPName, NameCol, team.GetColor(TEAM_CITIZEN), string.Trim(text), ColorIDs[id or 1], glowType});
  210.    
  211.     if (table.Count(GAMEMODE.chatRecord) > 20) then
  212.         table.remove( GAMEMODE.chatRecord, 1 )
  213.     end
  214. end
  215.  
  216. ChatFunctions["rp_fchat"] = function(text, id)
  217.     if (!IsValid(LocalPlayer())) then return end
  218.    
  219.     surface.PlaySound(newMessageSound);
  220.    
  221.     if (!LocalPlayer():EV_IsAdmin() || id == 11) then
  222.         chat.AddText(ColorIDs[id], "[" .. ColorIDNames[id] .. "] " .. string.Trim(text));
  223.     end
  224.    
  225.     table.insert(GAMEMODE.chatRecord, {CurTime(), "", nil, string.Trim(text), ColorIDs[id or 1], nil});
  226.    
  227.     if (table.Count(GAMEMODE.chatRecord) > 20) then
  228.         table.remove( GAMEMODE.chatRecord, 1 );
  229.     end
  230. end
  231.  
  232. ChatFunctions["rp_acl"] = function(pl, text, id)
  233.     if (!IsValid(pl)) then return; end
  234.    
  235.     chat.AddText(ColorIDs[id], "[" .. ColorIDNames[id] .. "] [" .. pl:Nick() .. "] " .. pl:GetRPName() .. ": " .. string.Trim(text));
  236.     table.insert(GAMEMODE.ConsoleLog, {ColorIDs[id], "[" .. os.date() .. "] " .. "[" .. ColorIDNames[id] .. "] [" .. pl:Nick() .. "] " .. pl:GetRPName() .. ": " .. string.Trim(text) .. "\n"});
  237. end
  238.  
  239. ChatFunctions["consolelog"] = function(Text)
  240.     table.insert(GAMEMODE.ConsoleLog, {Color(0, 255, 0, 255), "[" .. os.date() .. "] " .. Text .. "\n"});
  241. end
  242.  
  243. function PLAYER:ChatMessage ( Chat )
  244.     table.insert(GAMEMODE.chatRecord, {CurTime(), "", nil, string.Trim(Chat), ColorIDs[11], nil});
  245.    
  246.     if (table.Count(GAMEMODE.chatRecord) > 20) then
  247.         table.remove( GAMEMODE.chatRecord, 1 )
  248.     end
  249. end
  250.  
  251. local function IncomingChatMessage()
  252.     local chatType = net.ReadString();
  253.    
  254.     chatType = string.lower(chatType);
  255.    
  256.     if (!ChatFunctions[chatType]) then return; end
  257.    
  258.     if (chatType == "rp_fchat" || chatType == "rp_npcchat") then
  259.         ChatFunctions[chatType](net.ReadString(), net.ReadInt(8));
  260.     elseif (chatType == "consolelog") then
  261.         ChatFunctions[chatType](net.ReadString());
  262.     else
  263.         ChatFunctions[chatType](net.ReadEntity(), net.ReadString(), net.ReadInt(8));
  264.     end
  265. end
  266. net.Receive("perp_chathandle", IncomingChatMessage);
  267.  
  268. GM.chatPrefixes = {}
  269. GM.chatPrefixes["ooc"] = "OOC";
  270. GM.chatPrefixes["/"] = "OOC";
  271. GM.chatPrefixes["//"] = "Local OOC";
  272. GM.chatPrefixes["looc"] = "Local OOC";
  273. GM.chatPrefixes["me"] = "Action";
  274. GM.chatPrefixes["action"] = "Action";
  275. GM.chatPrefixes["w"] = "Whisper";
  276. GM.chatPrefixes["y"] = "Yell";
  277. GM.chatPrefixes["911"] = "Emergency";
  278. GM.chatPrefixes["999"] = "Emergency";
  279. GM.chatPrefixes["broadcast"] = "Broadcast";
  280. GM.chatPrefixes["radio"] = "Government Radio";
  281. GM.chatPrefixes["org"] = "Organization";
  282. GM.chatPrefixes["pm"] = "Private Message";
  283. GM.chatPrefixes["admin"] = "Admin Talk";
  284. GM.chatPrefixes["advert"] = "Advertisement";
  285. GM.chatPrefixes["report"] = "Report";
  286. GM.chatPrefixes["it"] = "Event";
  287. GM.chatPrefixes["event"] = "Event";
  288. GM.chatPrefixes["roll"] = "Roll";
  289. GM.chatPrefixes["law"] = "Law";
  290. GM.chatPrefixes["taxi"] = "Taxi";
  291. GM.chatPrefixes["hive"] = "Hive";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement