Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.91 KB | None | 0 0
  1. CHAT = {}
  2.  
  3. function ChatZor(event, player, message)
  4.     if (message:find("#g") == 1) then
  5.         for _, v in pairs(GetPlayersInWorld()) do
  6.             if (not HasBlockedChat(v)) then
  7.                 if (player:GetGmRank() == 'az') then
  8.                     v:SendBroadcastMessage("|cFF00FFFF[Psicrest] |cFFFFA500[Admin] |cFFFF6060["..player:GetName().."]: |cFF32CD32"..message:gsub("#g ", ""))
  9.                 elseif (player:GetGmRank() == '1') then
  10.                     v:SendBroadcastMessage("|cFF00FFFF[Psicrest] |cFFFFA500[Trial GM] |cFFFF6060["..player:GetName().."]: |cFF32CD32"..message:gsub("#g ", ""))
  11.                 elseif (player:GetGmRank() == '2') then
  12.                     v:SendBroadcastMessage("|cFF00FFFF[Psicrest] |cFFFFA500[GM] |cFFFF6060["..player:GetName().."]: |cFF32CD32"..message:gsub("#g ", ""))
  13.                                 elseif (player:GetGmRank() == '3') then
  14.                     v:SendBroadcastMessage("|cFF00FFFF[Psicrest] |cFFFFA500[Head GM] |cFFFF6060["..player:GetName().."]: |cFF32CD32"..message:gsub("#g ", ""))
  15.                                 elseif (player:GetGmRank() == 'a') then
  16.                     v:SendBroadcastMessage("|cFF00FFFF[Psicrest] |cFFFFA500[Developer] |cFFFF6060["..player:GetName().."]: |cFF32CD32"..message:gsub("#g ", ""))
  17.  
  18.                                 elseif (player:GetGmRank() == 'g') then
  19.                     v:SendBroadcastMessage("|cFF00FFFF[Psicrest] |cFFFFA500[Vip] |cFFFF6060["..player:GetName().."]: |cFF32CD32"..message:gsub("#g ", ""))
  20.                 else
  21.                     v:SendBroadcastMessage("|cFF00FFFF[Psicrest] |cFFFF6060["..player:GetName().."]: |cFF32CD32"..message:gsub("#g ", ""))
  22.                 end
  23.             end
  24.         end
  25.         return 0;
  26.     end
  27.     if (message == "#block chat") then
  28.         if (not CHAT[tostring(player)]) then
  29.             CHAT[tostring(player)] = {blocked = 0}
  30.         end
  31.         for k, v in pairs(CHAT) do
  32.             if (k == tostring(player)) then
  33.                 if (v.blocked == 0) then
  34.                     v.blocked = 1
  35.                     player:SendBroadcastMessage("You have blocked the chat.")
  36.                 else
  37.                     player:SendBroadcastMessage("You already blocked the chat.")
  38.                 end
  39.             end
  40.         end
  41.         return 0;
  42.     end
  43.     if (message == "#unblock chat") then
  44.         if (not CHAT[tostring(player)]) then
  45.             player:SendBroadcastMessage("You haven't blocked the chat.")
  46.         end
  47.         for k, v in pairs(CHAT) do
  48.             if (k == tostring(player)) then
  49.                 if (v.blocked == 1) then
  50.                     v.blocked = 0
  51.                     player:SendBroadcastMessage("You have unblocked the chat.")
  52.                 else
  53.                     player:SendBroadcastMessage("You haven't blocked the chat.")
  54.                 end
  55.             end
  56.         end
  57.         return 0;
  58.     end
  59.     if (message == "#chat check") then
  60.         local bool
  61.         if (HasBlockedChat(player)) then
  62.             bool = "blocked"
  63.         else
  64.             bool = "not blocked"
  65.         end
  66.         player:SendBroadcastMessage("Status: "..bool)
  67.         return 0;
  68.     end
  69.     if (message == "#check") then
  70.         player:CastSpell(72521)
  71.         return 0;
  72.     end
  73. end
  74.  
  75. function HasBlockedChat(plr)
  76.     for k, v in pairs(CHAT) do
  77.         if (k == tostring(plr)) then
  78.             if (v.blocked == 1) then
  79.                 return true;
  80.             end
  81.         end
  82.     end
  83.     return false;
  84. end
  85.  
  86. RegisterServerHook(16, "ChatZor")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement