Advertisement
Guest User

Grandelf

a guest
Nov 17th, 2009
587
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.22 KB | None | 0 0
  1. -- ########################### |---[ Event System ]---| ##############################
  2. --                                                          --------------------------------------------------------------------------------------             
  3. --         Made by: Grandelf
  4. --------------------------------------------------------------------------------------                 
  5. --          Officialy made for Revolution-WoW
  6. --------------------------------------------------------------------------------------    
  7. --            Now also released for the public    
  8. --------------------------------------------------------------------------------------
  9. -- ########################### |---[ Event System ]---| ##############################
  10. local McH =             -- Put in coords for horde mall here
  11. local XcH =
  12. local YcH =
  13. local ZcH =
  14. --------------------------------------------------------------------------------------
  15. local McA =         -- Put in coords for ally mall here
  16. local XcA =
  17. local YcA =
  18. local ZcA =
  19. --------------------------------------------------------------------------------------
  20. -- You can change the commands by changing the text between the ""
  21. local EventActivateMsg = "#event activate"
  22. local EventDeactivateMsg = "#event deactivate"
  23. local JoinMsg = "#event join"
  24. local Revive = "#revive"
  25. local LeaveMsg = "#event leave"
  26. local EventCommands = "#event commands"
  27. local Remind = "#event remind"
  28. local ReviveActivate = "#revive activate"
  29. local ReviveDeactivate = "#revive deactivate"
  30.  
  31. -- Do not change below here unless you know what you're doing
  32. ---------------------------------------------------------------------------------------
  33.  
  34. local EventActivated = false
  35. local ReviveActivated = false
  36.  
  37. local EventPlace = {}
  38.  
  39. function EventChatSystem(event, Player, message, type, language)
  40.     if (message == EventActivateMsg) then
  41.             if (Player:CanUseCommand("a") == true) then
  42.             if (EventActivated == true) then
  43.                 Player:SendBroadcastMessage("There is already an event running, close it first before opening a new one.")
  44.             else   
  45.                 EventActivated = true
  46.                 table.insert(EventPlace, Player:GetMapId())
  47.                         table.insert(EventPlace, Player:GetX())
  48.                         table.insert(EventPlace, Player:GetY())
  49.                         table.insert(EventPlace, Player:GetZ())
  50.                 table.insert(EventPlace, Player:GetZoneId())
  51.                 local plrs = GetPlayersInWorld()
  52.                 for k, v in pairs(plrs) do
  53.                     v:SendBroadcastMessage(""..Player:GetName().." has started an event, type "..JoinMsg.." to join! For more commands typ "..EventCommands.."")
  54.                 end
  55.             end
  56.             end
  57.         end
  58.     if (message == EventDeactivateMsg) then
  59.             if (Player:CanUseCommand("a") == true) then
  60.             if (EventActivated == false) then
  61.                 Player:SendBroadcastMessage("There is no event running to close")
  62.             else   
  63.                 EventActivated = false
  64.                 EventPlace = {}
  65.                 local plrs = GetPlayersInWorld()
  66.                 for k, v in pairs(plrs) do
  67.                     v:SendBroadcastMessage("" ..Player:GetName().." has closed the event.")
  68.                 end
  69.             end
  70.             end
  71.         end
  72.     if (message == JoinMsg) then
  73.             if (EventActivated == false) then
  74.                     Player:SendBroadcastMessage("There is no current event on.")
  75.             elseif (EventActivated == true) then
  76.             Player:Teleport(EventPlace[1], EventPlace[2], EventPlace[3], EventPlace[4])
  77.         end
  78.         end
  79.     if (message == Revive) then
  80.         if (EventActivated == false) then
  81.             Player:SendBroadcastMessage("You can only use this in an event")   
  82.         else
  83.             if (ReviveActivated == false) then
  84.                 Player:SendBroadcastMessage("A GM has to activate this first before you can use this.")
  85.             else   
  86.                 if (Player:GetZoneId() == EventPlace[5]) then
  87.                     Player:ResurrectPlayer()
  88.                 else
  89.                     Player:SendBroadcastMessage("You have to be in the event zone if you want to use this command")
  90.                 end        
  91.             end
  92.         end
  93.     end
  94.     if (message == LeaveMsg) then
  95.         if (EventActivated == false) then
  96.             Player:SendBroadcastMessage("You can only use this in an event")   
  97.         else
  98.             if (Player:GetZoneId() == EventPlace[5]) then
  99.                 if(GetTeam(Player) == 1) then
  100.                     Player:Teleport(McH, XcH, YcH, ZcH)
  101.                 elseif (GetTeam(Player) == 0) then
  102.                     Player:Teleport(McA, XcA, YcA, ZcA)
  103.                 end
  104.             else
  105.                 Player:SendBroadcastMessage("You have to be in the event zone if you want to use this command")
  106.             end
  107.         end
  108.     end
  109.     if (message == Remind) then
  110.         if (EventActivated == false) then
  111.             Player:SendBroadcastMessage("You can only use this while an event is running") 
  112.         else
  113.             local plrs = GetPlayersInWorld()
  114.             for k, v in pairs(plrs) do
  115.                 v:SendBroadcastMessage("There is an event going on, dont wait and join now by typing "..JoinMsg.." for more commands typ "..EventCommands.."")
  116.             end
  117.         end
  118.     end
  119.     if (message == ReviveActivate) then
  120.         if (Player:CanUseCommand("a") == true) then
  121.             if (EventActivated == false) then
  122.                 Player:SendBroadcastMessage("You can only use this while an event is running") 
  123.             else
  124.                 if (ReviveActivated == true) then
  125.                     Player:SendBroadcastMessage("The revive command is already enabled")
  126.                 else   
  127.                         local plrs = GetPlayersInWorld()
  128.                     for k, v in pairs(plrs) do
  129.                     v:SendBroadcastMessage("The revive command is now activated typ /g "..Revive.." to revive when died")
  130.                     end
  131.                 end
  132.             ReviveActivated = true     
  133.             end
  134.         end        
  135.     end
  136.     if (message == ReviveDeactivate) then
  137.         if (Player:CanUseCommand("a") == true) then
  138.             if (EventActivated == false) then
  139.                 Player:SendBroadcastMessage("You can only use this while an event is running") 
  140.             else
  141.                 if (ReviveActivated == false) then
  142.                     Player:SendBroadcastMessage("The revive command is already disabled")
  143.                 else   
  144.                     local plrs = GetPlayersInWorld()
  145.                     for k, v in pairs(plrs) do
  146.                         v:SendBroadcastMessage("The revive command is now disabled")
  147.                     end
  148.                 end
  149.             ReviveActivated = false    
  150.             end
  151.         end        
  152.     end
  153.     if (message == EventCommands) then
  154.         if (Player:CanUseCommand("a") == true) then
  155.             Player:SendBroadcastMessage("|cFFFF0000Commands:")
  156.             Player:SendBroadcastMessage(""..EventActivateMsg.." - Activates the event")
  157.             Player:SendBroadcastMessage(""..EventDeactivateMsg.." - Deactivates the event")
  158.             Player:SendBroadcastMessage(""..JoinMsg.." - Teleports you to the event")
  159.             Player:SendBroadcastMessage(""..LeaveMsg.." - Teleports you back to the mall if you want to leave the event")
  160.             Player:SendBroadcastMessage(""..Revive.." - Revives you when you die during the event")
  161.             Player:SendBroadcastMessage(""..Remind.." - Reminds players there is an event going on")
  162.             Player:SendBroadcastMessage(""..ReviveActivate.." - Enables the revive command for players")
  163.             Player:SendBroadcastMessage(""..ReviveDeactivate.." - Disables the revive command for players")
  164.         else   
  165.             Player:SendBroadcastMessage(""..JoinMsg.." - Teleports you to the event")
  166.             Player:SendBroadcastMessage(""..LeaveMsg.." - Teleports you back to the mall if you want to leave the event")
  167.             Player:SendBroadcastMessage(""..Revive.." - Revives you when you die during the event")
  168.         end
  169.     end
  170. end
  171.  
  172. function GetTeam(Player)
  173.     local r = Player:GetPlayerRace()
  174.     if (r == 2 or r == 5 or r == 6 or r == 8 or r == 10) then -- horde
  175.         return 1
  176.     elseif (r == 1 or r == 3 or r == 4 or r == 7 or r == 11) then -- ally
  177.         return 0
  178.     end
  179. end    
  180.  
  181. RegisterServerHook(16, "EventChatSystem")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement