Advertisement
Guest User

Fuck yes

a guest
Feb 6th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.32 KB | None | 0 0
  1. /*---------------------------------------------------------
  2. Talking
  3.  ---------------------------------------------------------*/
  4. local function PM(ply, args)
  5.     local namepos = string.find(args, " ")
  6.     if not namepos then
  7.         DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
  8.         return ""
  9.     end
  10.  
  11.     local name = string.sub(args, 1, namepos - 1)
  12.     local msg = string.sub(args, namepos + 1)
  13.  
  14.     if msg == "" then
  15.         DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
  16.         return ""
  17.     end
  18.  
  19.     local target = DarkRP.findPlayer(name)
  20.  
  21.     if target then
  22.         local col = team.GetColor(ply:Team())
  23.         DarkRP.talkToPerson(target, col, "(PM) "..ply:Nick(), Color(255,255,255,255), msg, ply)
  24.         DarkRP.talkToPerson(ply, col, "(PM) "..ply:Nick(), Color(255,255,255,255), msg, ply)
  25.     else
  26.         DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("could_not_find", tostring(name)))
  27.     end
  28.  
  29.     return ""
  30. end
  31. DarkRP.defineChatCommand("pm", PM, 1.5)
  32.  
  33. local function Whisper(ply, args)
  34.     local DoSay = function(text)
  35.         if text == "" then
  36.             DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
  37.             return ""
  38.         end
  39.         DarkRP.talkToRange(ply, "(".. DarkRP.getPhrase("whisper") .. ") " .. ply:Nick(), text, 90)
  40.     end
  41.     return args, DoSay
  42. end
  43. DarkRP.defineChatCommand("w", Whisper, 1.5)
  44.  
  45. local function Yell(ply, args)
  46.     local DoSay = function(text)
  47.         if text == "" then
  48.             DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
  49.             return ""
  50.         end
  51.         DarkRP.talkToRange(ply, "(".. DarkRP.getPhrase("yell") .. ") " .. ply:Nick(), text, 550)
  52.     end
  53.     return args, DoSay
  54. end
  55. DarkRP.defineChatCommand("y", Yell, 1.5)
  56.  
  57. local function Me(ply, args)
  58.     if args == "" then
  59.         DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
  60.         return ""
  61.     end
  62.  
  63.     local DoSay = function(text)
  64.         if text == "" then
  65.             DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
  66.             return ""
  67.         end
  68.         if GAMEMODE.Config.alltalk then
  69.             for _, target in pairs(player.GetAll()) do
  70.                 DarkRP.talkToPerson(target, team.GetColor(ply:Team()), ply:Nick() .. " " .. text)
  71.             end
  72.         else
  73.             DarkRP.talkToRange(ply, ply:Nick() .. " " .. text, "", 250)
  74.         end
  75.     end
  76.     return args, DoSay
  77. end
  78. DarkRP.defineChatCommand("me", Me, 1.5)
  79.  
  80. local function OOC(ply, args)
  81.     if not GAMEMODE.Config.ooc then
  82.         DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("disabled", DarkRP.getPhrase("ooc"), ""))
  83.         return ""
  84.     end
  85.  
  86.     local DoSay = function(text)
  87.         if text == "" then
  88.             DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
  89.             return ""
  90.         end
  91.         local col = team.GetColor(ply:Team())
  92.         local col2 = Color(255,255,255,255)
  93.         if not ply:Alive() then
  94.             col2 = Color(255,200,200,255)
  95.             col = col2
  96.         end
  97.         for k,v in pairs(player.GetAll()) do
  98.             DarkRP.talkToPerson(v, col, "("..DarkRP.getPhrase("ooc")..") "..ply:Name(), col2, text, ply)
  99.         end
  100.     end
  101.     return args, DoSay
  102. end
  103. DarkRP.defineChatCommand("/", OOC, true, 1.5)
  104. DarkRP.defineChatCommand("a", OOC, true, 1.5)
  105. DarkRP.defineChatCommand("ooc", OOC, true, 1.5)
  106. DarkRP.defineChatCommand("looc", LOOC, 1.5)
  107.  
  108. local function PlayerAdvertise(ply, args)
  109.     if args == "" then
  110.         DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
  111.         return ""
  112.     end
  113.     local DoSay = function(text)
  114.         if text == "" then
  115.             DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
  116.             return
  117.         end
  118.         for k,v in pairs(player.GetAll()) do
  119.             local col = team.GetColor(ply:Team())
  120.             DarkRP.talkToPerson(v, col, DarkRP.getPhrase("advert") .." "..ply:Nick(), Color(255,255,0,255), text, ply)
  121.         end
  122.     end
  123.     return args, DoSay
  124. end
  125. DarkRP.defineChatCommand("advert", PlayerAdvertise, 1.5)
  126.  
  127. local function MayorBroadcast(ply, args)
  128.     if args == "" then
  129.         DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
  130.         return ""
  131.     end
  132.     if not RPExtraTeams[ply:Team()] or not RPExtraTeams[ply:Team()].mayor then DarkRP.notify(ply, 1, 4, "You have to be mayor") return "" end
  133.     local DoSay = function(text)
  134.         if text == "" then
  135.             DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
  136.             return
  137.         end
  138.         for k,v in pairs(player.GetAll()) do
  139.             local col = team.GetColor(ply:Team())
  140.             DarkRP.talkToPerson(v, col, DarkRP.getPhrase("broadcast") .. " " ..ply:Nick(), Color(170, 0, 0,255), text, ply)
  141.         end
  142.     end
  143.     return args, DoSay
  144. end
  145. DarkRP.defineChatCommand("broadcast", MayorBroadcast, 1.5)
  146.  
  147. local function SetRadioChannel(ply,args)
  148.     if tonumber(args) == nil or tonumber(args) < 0 or tonumber(args) > 100 then
  149.         DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", "0<channel<100"))
  150.         return ""
  151.     end
  152.     DarkRP.notify(ply, 2, 4, DarkRP.getPhrase("channel_set_to_x", args))
  153.     ply.RadioChannel = tonumber(args)
  154.     return ""
  155. end
  156. DarkRP.defineChatCommand("channel", SetRadioChannel)
  157.  
  158. local function SayThroughRadio(ply,args)
  159.     if not ply.RadioChannel then ply.RadioChannel = 1 end
  160.     if not args or args == "" then
  161.         DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
  162.         return ""
  163.     end
  164.     local DoSay = function(text)
  165.         if text == "" then
  166.             DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
  167.             return
  168.         end
  169.         for k,v in pairs(player.GetAll()) do
  170.             if v.RadioChannel == ply.RadioChannel then
  171.                 DarkRP.talkToPerson(v, Color(180,180,180,255), DarkRP.getPhrase("radio_x", ply.RadioChannel), Color(180,180,180,255), text, ply)
  172.             end
  173.         end
  174.     end
  175.     return args, DoSay
  176. end
  177. DarkRP.defineChatCommand("radio", SayThroughRadio, 1.5)
  178.  
  179. local function GroupMsg(ply, args)
  180.     local DoSay = function(text)
  181.         local plyMeta = FindMetaTable("Player")
  182.         if text == "" then
  183.             DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
  184.             return
  185.         end
  186.  
  187.         local t = ply:Team()
  188.         local col = team.GetColor(ply:Team())
  189.  
  190.         local groupChats = {}
  191.         local hasReceived = {}
  192.         for _, func in pairs(GAMEMODE.DarkRPGroupChats) do
  193.             -- not the group of the player
  194.             if not func(ply) then continue end
  195.  
  196.             table.insert(groupChats, func)
  197.         end
  198.  
  199.         if #groupChats == 0 then return "" end
  200.  
  201.         for _, target in pairs(player.GetAll()) do
  202.             -- The target is in any of the group chats
  203.             for k, func in pairs(groupChats) do
  204.                 if not func(target, ply) then continue end
  205.  
  206.                 DarkRP.talkToPerson(target, col, DarkRP.getPhrase("group") .. " " .. ply:Nick(), Color(255,255,255,255), text, ply)
  207.                 break
  208.             end
  209.         end
  210.     end
  211. end
  212. -- here's the new easter egg. Easier to find, more subtle, doesn't only credit FPtje and unib5
  213. -- WARNING: DO NOT EDIT THIS
  214. -- You can edit DarkRP but you HAVE to credit the original authors!
  215. -- You even have to credit all the previous authors when you rename the gamemode.
  216. local CreditsWait = true
  217. local function GetDarkRPAuthors(ply, args)
  218.     local target = DarkRP.findPlayer(args); -- Only send to one player. Prevents spamming
  219.     if not IsValid(target) then
  220.         DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("player_doesnt_exist"))
  221.         return ""
  222.     end
  223.  
  224.     if not CreditsWait then DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("wait_with_that")) return "" end
  225.     CreditsWait = false
  226.     timer.Simple(60, function() CreditsWait = true end)--so people don't spam it
  227.  
  228.     local rf = RecipientFilter()
  229.     rf:AddPlayer(target)
  230.     if ply ~= target then
  231.         rf:AddPlayer(ply)
  232.     end
  233.  
  234.     umsg.Start("DarkRP_Credits", rf)
  235.     umsg.End()
  236.  
  237.     return ""
  238. end
  239. DarkRP.defineChatCommand("credits", GetDarkRPAuthors, 50)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement