Advertisement
Guest User

Derpchat v2 - 3

a guest
Dec 7th, 2011
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.71 KB | None | 0 0
  1. /*-------------------------------------------------------------------------------------------------------------------------
  2.     Derp Chat something
  3. -------------------------------------------------------------------------------------------------------------------------*/
  4.  
  5. local PLUGIN = {}
  6. PLUGIN.Title = "Derp Chat"
  7. PLUGIN.Description = "Serverside Derpy chat!"
  8. PLUGIN.Author = "Matt/Lucas Longley/Overv"
  9. PLUGIN.ChatCommand = "derpchat"
  10. PLUGIN.Usage = "[1/0]"
  11. PLUGIN.Privileges = { "Derp Chat" }
  12.  
  13. local On = false
  14.  
  15. function translateText(text)
  16. text = string.upper(text)
  17. local textArray = string.Explode(" ", text)
  18. local output = ""
  19. local arrayLength = table.Count(textArray)
  20. local wordLength
  21.  
  22. for i=1, arrayLength do
  23.    wordLength = string.len(textArray[i])
  24.    
  25.     if (textArray[i] == ("YOUR") and wordLength == 4) or (textArray[i] == ("YOU'RE") and wordLength == 6) then
  26.     output = output .. "UR"
  27.     end
  28.    
  29.     if(textArray[i] == ("YOUR")) then
  30.     output = output .. "U"
  31.     end
  32.    
  33.     if(table.Count(textArray) >= 3 and (textArray[i] .. " " .. textArray[i+1] .. " " .. textArray[i+2]) == ("GOT TA GO") and i == 1) then
  34.     output = output .. "G2G"
  35.     i = i + 2
  36.     end
  37.    
  38.     if(table.Count(textArray) >= 2 and (textArray[i] .. " " .. textArray[i+1]) == ("GOTTA GO") and i == 1) then
  39.     output = output .. "G2G"
  40.     i = i + 1
  41.     end
  42.    
  43.     if(table.Count(textArray) >= 2 and (textArray[i] .. " " .. textArray[i+1]) == ("WHAT THE") and i == 1) then
  44.     output = output .. "WT"
  45.         if table.Count(textArray) >= 3 and (textArray[i+2] == "FUCK") and i == 1 then
  46.             output = output .. "F"
  47.             end
  48.     end
  49.    
  50.     if table.Count(textArray) >= 3 and (textArray[i+2] == "HECK") or (textArray[i+2] == "HELL") and i == 1 then
  51.         output = output .. "H"
  52.     end
  53.    
  54.     if(textArray[i] == ("WHAT")) then
  55.     output = output .. "WUT"
  56.     end
  57.    
  58.     if (textArray[i] == ("ARE")) or (textArray[i] == (ARE) and 3 == wordLength) then
  59.     output = output .. "R"
  60.     end
  61.    
  62.     if(textArray[i] == ("WHY")) then
  63.     output = output .. "Y"
  64.     end
  65.    
  66.     if(table.Count(textArray) >= 3 and (textArray[i] .. " " .. textArray[i+1] .. " " .. textArray[i+2]) == ("BE RIGHT BACK") and i == 1) then
  67.     output = output .. "BRB"
  68.     i = i + 2
  69.     end
  70.    
  71.     if(textArray[i] == ("BECAUSE")) then
  72.     output = output .. "B/C"
  73.     end
  74.    
  75.     if(table.Count(textArray) >= 3 and (textArray[i] .. " " .. textArray[i+1] .. " " .. textArray[i+2]) == ("OH MY GOD") and i == 1) then
  76.     output = output .. "OMG"
  77.     i = i + 2
  78.     end
  79.    
  80.     if (textArray[i] == ("THE")) then
  81.         if (math.floor(math.random() * 100) % 2) then
  82.         output = output .. "TEH"
  83.         else
  84.         output = output .. "DA"
  85.         end
  86.     end
  87.    
  88.     if(textArray[i] == ("MY")) then
  89.     output = output .. "MAH"
  90.     end
  91.    
  92.     if(textArray[i] == ("NEW")) then
  93.     output = output .. "NU"
  94.     end
  95.    
  96.     if(textArray[i] == ("WITH")) then
  97.     output = output .. "WIT"
  98.     end
  99.    
  100.     if(textArray[i] == ("REALLY")) then
  101.     output = output .. "RILLY"
  102.     end
  103.    
  104.     if(textArray[i] == ("PLEASE")) then
  105.     output = output .. "PLZ"
  106.     end
  107.    
  108.     if(textArray[i] == ("THANKS")) then
  109.     output = output .. "THX"
  110.     end
  111.    
  112.     if(textArray[i] == ("THIS")) then
  113.     output = output .. "THES"
  114.     end
  115.    
  116.     if(textArray[i] == ("IS")) then
  117.     output = output .. "SI"
  118.     end
  119.    
  120.     if(textArray[i] == ("LOVE")) then
  121.     output = output .. "LUV"
  122.     end
  123.    
  124.     if (textArray[i] == ("THERE")) then
  125.         if (math.floor(math.random() * 100) % 2) then
  126.         output = output .. "THEIR"
  127.         else
  128.         output = output .. "THEYRE"
  129.         end
  130.     end
  131.    
  132.     if (textArray[i] == ("THEIR")) then
  133.         if (math.floor(math.random() * 100) % 2) then
  134.         output = output .. "THERE"
  135.         else
  136.         output = output .. "THEYRE"
  137.         end
  138.     end
  139.    
  140.     if (textArray[i] == ("THEY'RE")) then
  141.         if (math.floor(math.random() * 100) % 2) then
  142.         output = output .. "THEIR"
  143.         else
  144.         output = output .. "THERE"
  145.         end
  146.     end
  147.    
  148.     if(textArray[i] == ("OK")) then
  149.     output = output .. "K"
  150.     end
  151.    
  152.     if(textArray[i] == ("OKAY")) then
  153.     output = output .. "K"
  154.     end
  155.    
  156.     if(textArray[i] == ("LIBRARY")) then
  157.     output = output .. "LIBERRY"
  158.     end
  159.    
  160.     end // line 322
  161.    
  162.     if not wordLength then wordLength = string.len(textArray[1]) end
  163.  
  164. print("Text = " .. text)
  165. PrintTable(textArray)
  166. print("arrayLength = " .. arrayLength)
  167. print("wordLength = " .. wordLength)
  168. print("Output = " .. output)
  169.    
  170.         for j=0,j < wordLength do
  171.        
  172.         if (string.sub(textArray[i], j, j)) == (string.sub(textArray[i], j+1, j+1)) then
  173.         output = output .. (string.sub(textArray[i], j, j))
  174.        
  175.         j = j + 1
  176.        
  177.         end
  178.        
  179.         if (string.sub(textArray[i], j, j) == "B") then
  180.         if (string.sub(textArray[i], j+1, j+1) == "E") then
  181.         output = output .. "B"
  182.         j = j + 1
  183.         end
  184.         end
  185.        
  186.         if (string.sub(textArray[i], j, j) == "C") then
  187.        
  188.             if (string.sub(textArray[i], j+1, j+1) == "K") then
  189.                 if (string.sub(textArray[i], j+2, j+2) == "S") then
  190.                 output = output .. "X"
  191.                 j = j + 2
  192.                 else
  193.                 output = output .. "K"
  194.                 j = j + 1
  195.                 end
  196.             if (string.sub(textArray[i], j+1, j+1) == "S") then
  197.                 if (string.sub(textArray[i], j+2, j+2) == "S") then
  198.                 output = output .. "X"
  199.                 j = j + 1
  200.                 end
  201.             end
  202.             //
  203.             else
  204.             output = output .. "C"
  205.             end
  206.         end
  207.        
  208.             if (string.sub(textArray[i], j, j == "E")) then
  209.             if (Math.floor(Math.random() * 100) % 3 == 2) then
  210.             output = output .. "3"
  211.             else
  212.             if (Math.floor(Math.random() * 100) % 3 == 1) then
  213.             output = output .. "A"
  214.             else
  215.             output = output .. "E"
  216.             end
  217.             end
  218.             end
  219.        
  220.         if (string.sub(textArray[i], j, j == "I")) then
  221.             if ((string.sub(textArray[i], j+1, j+1)) .. (string.sub(textArray[i], j+2, j+2)) == "NG") then
  222.             output = output .. "NG"
  223.             j = j + 2
  224.             end
  225.         end
  226.        
  227.         // Line 500
  228.         if (string.sub(textArray[i], j+2, j+2) == "E") then
  229.         output = output .. "IE" .. string.sub(textArray[i], j+1, j+1)
  230.         j = j + 2
  231.         end
  232.        
  233.         if (string.sub(textArray[i], j+1, j+1) == "E") then
  234.         output = output .. "EI"
  235.         j = j + 1
  236.         end
  237.        
  238.         if (string.sub(textArray[i], j, j == "I")) then // Do stuff with I's
  239.                 if (string.sub(textArray[i], j+1, j+1) == "'") then
  240.                     if (string.sub(textArray[i], j+2, j+2) == "M") then
  241.                         if (textArray[i+1] .. " " .. textArray[i+2] == "GOING TO") then
  242.                         output = output .. "IMA"
  243.                         i = i + 2
  244.                         j = j + 2
  245.                         else
  246.                         output = output .. "IM"
  247.                         end
  248.                     end
  249.                 end
  250.         end
  251.        
  252.         if (textArray[i+1] == "AM") then
  253.             if (textArray[i+2] .. " " .. textArray[i+3] == "GOING TO") then
  254.             output = output .. "IMA"
  255.             i = i + 3
  256.             else
  257.             output = output .. "IM"
  258.             i = i + 1
  259.             end
  260.         else
  261.         output = output .. "I"
  262.         end
  263.        
  264.         if (string.sub(textArray[i], j, j == "A")) then
  265.             if (string.sub(textArray[i], j, j == "M")) then
  266.             output = output .. "M"
  267.             j = j + 1
  268.             end
  269.         end
  270.        
  271.         if (string.sub(textArray[i], j+1, j+1) == "I") then
  272.         output = output .. "A" .. string.sub(textArray[i], j+2, j+2) .. "E"
  273.         j = j + 2
  274.         end
  275.        
  276.         if (string.sub(textArray[i], j+1, j+1) == "I") .. (string.sub(textArray[i], j+2, j+2) == "I") .. (string.sub(textArray[i], j+3, j+3) == "I") == "TER" then
  277.         output = output .. "8R"
  278.         j = j + 3
  279.         end
  280.        
  281.         if (string.sub(textArray[i], j+2, j+2) == "E") then
  282.         output = output .. "AE"
  283.         j = j + 2
  284.         else
  285.         output = output .. "A"
  286.         end
  287.        
  288.         if (string.sub(textArray[i], j, j) == "S") then
  289.             if (string.sub(textArray[i], j+1, j+1)) .. (string.sub(textArray[i], j+2, j+2)) .. (string.sub(textArray[i], j+3, j+3)) .. (string.sub(textArray[i], j+4, j+4)) .. (string.sub(textArray[i], j+5, j+5)) == "CHOOL" then
  290.             output = output .. "SKOOL"
  291.             j = j + 5
  292.             end
  293.         end
  294.        
  295.         //line 720
  296.        
  297.         if (string.sub(textArray[i], j+1, j+1)) .. (string.sub(textArray[i], j+2, j+2)) .. " " .. (string.sub(textArray[i], 1, 1)) .. (string.sub(textArray[i], 2, 2)) .. (string.sub(textArray[i], 3, 3)) == "SEE YOU" then
  298.         output = output .. "CYA"
  299.         j = j + 5
  300.         end
  301.        
  302.         if (string.sub(textArray[i], j+1, j+1)) .. (string.sub(textArray[i], j+2, j+2)) .. " " .. (string.sub(textArray[i], 1, 1)) .. (string.sub(textArray[i], 2, 2)) == "SEE YA" then
  303.         output = output .. "CYA"
  304.         j = j + 5
  305.                
  306.         else
  307.         output = output .. "S"
  308.         end
  309.         if (string.sub(textArray[i], j, j)) == "O" then
  310.             if (string.sub(textArray[i], j+1, j+1)) == "O" then
  311.             output = output .. "U"
  312.             j = j + 1
  313.             end
  314.             if (string.sub(textArray[i], j+1, j+1)) == "U" and (string.sub(textArray[i], j+2, j+2)) == "L" then
  315.             output = output .. "U"
  316.             j = j + 2
  317.             end
  318.             if (string.sub(textArray[i], j+1, j+1)) == "H" then
  319.             output = output .. "O"
  320.             j = j + 1
  321.             end
  322.             if (string.sub(textArray[i], j+1, j+1)) .. (string.sub(textArray[i], j+2, j+2)) == "US" and (string.sub(textArray[i], j+3, j+3)) != "E" then
  323.             output = output .. "OS"
  324.             j = j + 2
  325.             else
  326.             output = output .. "O"
  327.             end
  328.         end
  329.         // line 830
  330.        
  331.         if (string.sub(textArray[i], j, j)) .. (string.sub(textArray[i], j+1, j+1)) == "LY" and
  332.         j .. 2 == wordLength or (string.sub(textArray[i], j+2, j+2)) == "." or (string.sub(textArray[i], j+2, j+2)) == "!" or (string.sub(textArray[i], j+2, j+2)) == "?" or (string.sub(textArray[i], j+2, j+2)) == "'" or (string.sub(textArray[i], j+2, j+2)) == ";" or (string.sub(textArray[i], j+2, j+2)) == "," or (string.sub(textArray[i], j+2, j+2)) == ":" or (string.sub(textArray[i], j+2, j+2)) == "\"" or (string.sub(textArray[i], j+2, j+2)) == "`" or (string.sub(textArray[i], j+2, j+2)) == "~" then
  333.         output = output .. "LEY"
  334.         j = j + 2
  335.         end
  336.        
  337.         if (string.sub(textArray[i], j, j)) .. (string.sub(textArray[i], j+1, j+1)) .. (string.sub(textArray[i], j+2, j+2)) == "USE" then
  338.         output = output .. "UES"
  339.         j = j + 2
  340.         end
  341.        
  342.         if (string.sub(textArray[i], j, j)) == "T" then
  343.             if (string.sub(textArray[i], j+1, j+1)) == "O" then
  344.             output = output .. "2"
  345.                 if (string.sub(textArray[i], j+2, j+2)) == "O" then
  346.                     j = j + 2
  347.                 end
  348.             else
  349.                 j = j + 1
  350.             end
  351.         end
  352.        
  353.         // line 911
  354.            
  355.         if (string.sub(textArray[i], j+1, j+1)) .. (string.sub(textArray[i], j+2, j+2)) .. (string.sub(textArray[i], j+3, j+3)) == "HAT" then
  356.         output = output .. "TAHT"
  357.         j = j + 3
  358.         else
  359.         output = output .. "T"
  360.         end
  361.    
  362.         // line 942
  363.        
  364.         if (string.sub(textArray[i], j, j)) != "." and (string.sub(textArray[i], j, j)) != "!" and (string.sub(textArray[i], j, j)) != "?" and (string.sub(textArray[i], j, j)) != "'" and (string.sub(textArray[i], j, j)) != ";" and (string.sub(textArray[i], j, j)) != "," and (string.sub(textArray[i], j, j)) != ":" and (string.sub(textArray[i], j, j)) != "\"" and (string.sub(textArray[i], j, j)) != "`" and (string.sub(textArray[i], j, j)) == "~" then
  365.         output = output .. string.sub(textArray[i], j, j)
  366.         end
  367.     end
  368.    
  369.     // line 960
  370.    
  371.     if string.find(textArray[i],".") or string.find(textArray[i],"!") or string.find(textArray[i],"?") then
  372.     local placeInWord
  373.     end
  374.    
  375.     if string.find(textArray[i],"!") then
  376.     local firstCharacter = "!"
  377.     end
  378.    
  379.     if string.find(textArray[i],".") then
  380.     local firstCharacter = "."
  381.     end
  382.    
  383.     if string.find(textArray[i],"?") then
  384.     local firstCharacter = "?"
  385.     end
  386.    
  387.     if string.find(textArray[i],".") < string.find(textArray[i],firstCharacter) and string.find(textArray[i],".") then
  388.     firstCharacter = "."
  389.     end
  390.    
  391.     if string.find(textArray[i],"?") < string.find(textArray[i],firstCharacter) and string.find(textArray[i],"?") then
  392.     firstCharacter = "!"
  393.     end
  394.    
  395.     placeInWord = string.find(textArray[i],firstCharacter)
  396.    
  397.     if string.find(textArray[i],"?") then
  398.     output = output .. "?"
  399.     else
  400.     output = output .. "!"
  401.     end
  402.    
  403.     // Line 1055
  404.    
  405.     if string.find(placeInWord,"!") or string.find(placeInWord,".") then
  406.     for var=1,math.random(1,5) do
  407.         if (math.floor(math.random() * 100) % 2) then
  408.         output = output .. "!"
  409.         else
  410.         output = output .. "1"
  411.     end
  412.     end
  413.     end
  414.    
  415.     if string.find(placeInWord,"?") then
  416.     for var=1,math.random(1,5) do
  417.         if (math.floor(math.random() * 100) % 2) then
  418.         output = output .. "?"
  419.         else
  420.         output = output .. "!"
  421.     end
  422.     end
  423.     end
  424.    
  425.     //line 1120
  426.    
  427.     if (math.floor(math.random() * 100) % 2) then
  428.     output = output .. " OMG";
  429.     end
  430.  
  431.     if (math.floor(math.random() * 100) % 2) then
  432.     output = output .. " WTF";
  433.     end
  434.    
  435.     if (math.floor(math.random() * 100) % 2) then
  436.     output = output .. " LOL";
  437.     end
  438.  
  439.    
  440.     if (table.Count(textArray) >= 2 and i != arrayLength - 1 and textArray[i+1] != "") and i == 1 then
  441.     output = output .. " "
  442.     end
  443.    
  444.     return output
  445. end
  446.  
  447. function ISaid( ply, text, public )
  448.     if On == true then
  449.     print("DerpChat is on!")
  450.     return translateText(text)
  451.     else
  452.     print("DerpChat is off!")
  453.     return text
  454.     end
  455. end
  456.  
  457. function PLUGIN:Call( ply, args )
  458.     if ply:EV_HasPrivilege( "Derp Chat" ) then
  459.         if args[1] == "0" then
  460.             On = false
  461.             evolve:Notify( evolve.colors.white, "Derpchat is now Off." )
  462.         else
  463.             On = true
  464.             evolve:Notify( evolve.colors.white, "Derpchat is now On." )
  465.         end
  466.     else
  467.         evolve:Notify( ply, evolve.colors.red, evolve.constants.notallowed )
  468.     end
  469. end
  470.  
  471. hook.Add( "PlayerSay", "ISaid", ISaid );
  472.  
  473. evolve:RegisterPlugin( PLUGIN )
  474.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement