Advertisement
Rochet2

Banannounce

Jul 15th, 2012
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. local function OnChat(event, pPlayer, Message, Type, Language, Misc)
  2.     if(pPlayer:IsGm()) then
  3.         local cmd, sub, id, dur, reason = Message:match("^[.!](%a+) (%a+) ([%d%p%a]+) ?(%w*) ?(%w*)$")
  4.         if(not (cmd and sub and id and dur and reason)) then
  5.             return
  6.         end
  7.         if(string.find("ban", cmd:lower()) == 1) then
  8.             local sub_t
  9.             if(string.find("ip", sub:lower()) == 1) then
  10.                 sub_t = "IP"
  11.             elseif(string.find("char", sub:lower()) == 1) then
  12.                 sub_t = "character"
  13.             elseif(string.find("account", sub:lower()) == 1) then
  14.                 sub_t = "account"
  15.             elseif(string.find("all", sub:lower()) == 1) then
  16.                 sub_t = "IP, account, character"
  17.             else
  18.                 return
  19.             end
  20.             if(reason == '') then
  21.                 reason = "no reason"
  22.             end
  23.             if(dur == '') then -- should elaborate dur more
  24.                 dur = "infinity"
  25.             elseif(not dur:find("%d")) then
  26.                 reason = dur
  27.                 dur = "infinity"
  28.             end
  29.             -- SendWorldMessage("|cffFF0000[GM] "..pPlayer:GetName().." banned "..sub_t.." "..id.." for "..dur..reason, 2)
  30.             SendWorldMessage("|cffFF0000[GM] ["..id.."]'s "..sub_t.." has been banned by ["..pPlayer:GetName().."] for ["..dur.."] Reason:["..reason.."]", 2)
  31.         end
  32.     end
  33. end
  34.  
  35. RegisterServerHook(16, OnChat)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement