Share Pastebin
Guest
Public paste!

Guildmaster Tool

By: a guest | Aug 17th, 2010 | Syntax: Lua | Size: 3.86 KB | Hits: 193 | Expires: Never
This paste has a previous version, view the difference. Copy text to clipboard
  1. -- Summon Cooldown in seconds
  2. local GSCD = 30
  3.  
  4. local GuildSummonCD = {}
  5.  
  6. function GuildTool_OnGossip(item, event, plr)
  7.         if(plr:IsInGuild() == true) then
  8.                 if(plr:GetGuildLeader() == plr:GetName()) then
  9.                         item:GossipCreateMenu(100, plr, 0)
  10.                         item:GossipMenuAddItem(1, "Summon ALL Guild Members", 1, 0, "Are you sure you want to summon ALL guild members?")
  11.                         item:GossipMenuAddItem(1, "Invite Player to Guild", 2, 1, "Insert Players name into the code box.")
  12.                         item:GossipMenuAddItem(1, "Kick Player from Guild", 3, 1, "Insert Players name into the code box.")
  13.                         item:GossipMenuAddItem(1, "Guild Notifications", 4, 0)
  14.                         item:GossipMenuAddItem(1, "Disband Guild", 7, 1, "To disband your guild, type DISBAND into the code box.")
  15.                         item:GossipSendMenu(plr)
  16.                 else
  17.                         plr:SendBroadcastMessage("You are not this guild's leader!")
  18.                 end
  19.         else
  20.                 plr:SendBroadcastMessage("You are not in a guild!")
  21.         end
  22. end
  23.  
  24. function GuildTool_OnSubGossip(item, event, plr, id, intid, code)
  25.  
  26.         if(GSCD >= 60) then
  27.                 GSCD_Timer = GSCD/60
  28.                 GSCD_Type = "Minutes"
  29.         elseif(GSCD < 60) then
  30.                 GSCD_Timer = GSCD
  31.                 GSCD_Type = "Seconds"
  32.         end
  33.  
  34.         if(intid == 1) then
  35.                 if GuildSummonCD[plr:GetName()] ~= nil and ((os.clock()-GuildSummonCD[plr:GetName()])) <= GSCD then
  36.                         plr:SendAreaTriggerMessage("|cFFFF0000You must wait "..GSCD_Timer.." "..GSCD_Type.." before using this function!")
  37.                         plr:GossipComplete()
  38.                 else
  39.                         GuildSummonCD[plr:GetName()] = os.clock()
  40.                         for k, v in pairs(GetPlayersInWorld()) do
  41.                                 if (v:GetGuildId() == plr:GetGuildId()) then
  42.                                         if(v:GetName() ~= v:GetGuildLeader()) then
  43.                                                 v:Teleport(plr:GetMapId(), plr:GetX(), plr:GetY(), plr:GetZ(), plr:GetO())
  44.                                                 v:SendBroadcastMessage("You have been summoned by your Guild Master!")
  45.                                         else
  46.                                                 plr:SendBroadcastMessage("All guild members have been summoned.")
  47.                                         end
  48.                                 end
  49.                         end
  50.                         plr:GossipComplete()
  51.                 end
  52.         end
  53.  
  54.         if(intid == 2) or (intid == 3) then
  55.                 for k, v in pairs(GetPlayersInWorld()) do
  56.                         local pCode = code
  57.                         if(v:GetName() == pCode) then
  58.                                 if(intid == 2) then
  59.                                         if(v:IsInGuild() == true) and (v:GetGuildId() ~= plr:GetGuildId()) then
  60.                                                 plr:SendBroadcastMessage(""..pCode.." is already in a guild!")
  61.                                         elseif(v:IsInGuild() == true) and (v:GetGuildId() == plr:GetGuildId()) then
  62.                                                 plr:SendBroadcastMessage(""..pCode.." is already in your guild!")
  63.                                         elseif(v:IsInGuild() == false) and (v:GetName() == pCode) then
  64.                                                 plr:SendGuildInvite(v)
  65.                                         end
  66.                                 elseif(intid == 3) then
  67.                                         if(v:GetGuildId() == plr:GetGuildId()) then
  68.                                                 plr:RemoveGuildMember(v)
  69.                                         elseif(v:GetGuildId() ~= plr:GetGuildId()) then
  70.                                                 plr:SendBroadcastMessage(""..pCode.." is not in your guild, or is not online.")
  71.                                         end
  72.                                 end
  73.                         end
  74.                 end
  75.                 plr:GossipComplete()
  76.         end
  77.        
  78.         if(intid == 4) then
  79.                 item:GossipCreateMenu(100, plr, 0)
  80.                 item:GossipMenuAddItem(1, "Guild Chat Notification", 5, 1, "Insert Guild Chat Notification into the code box.")
  81.                 item:GossipMenuAddItem(1, "Guild Warning Notifications", 6, 1, "Insert Guild Warning Notification into the code box.")
  82.                 item:GossipSendMenu(plr)
  83.         end
  84.        
  85.         if(intid == 5) or (intid == 6) then
  86.                 for k, v in pairs(GetPlayersInWorld()) do
  87.                         local pCode = code
  88.                         if (v:GetGuildId() == plr:GetGuildId()) then
  89.                                 if(intid == 5) then
  90.                                         v:SendBroadcastMessage("|cFF33FF33[Guild Notification]: |cFFFFFFFF"..pCode.."")
  91.                                 elseif(intid == 6) then
  92.                                         v:SendAreaTriggerMessage("|cFF33FF33[Guild Warning]: |cFFFFFFFF"..pCode.."")
  93.                                 end
  94.                         end
  95.                 end
  96.                 plr:GossipComplete()
  97.         end
  98.        
  99.         if(intid == 7) then
  100.                 local pCode = "DISBAND"
  101.                 if(code == pCode) then
  102.                         plr:DisbandGuild()
  103.                 elseif(code ~= pCode) then
  104.                         plr:SendBroadcastMessage("You did not type DISBAND into the code box.")
  105.                 end
  106.                 plr:GossipComplete()
  107.         end
  108. end
  109.  
  110. RegisterItemGossipEvent(90003, 1, "GuildTool_OnGossip")
  111. RegisterItemGossipEvent(90003, 2, "GuildTool_OnSubGossip")