kusanagy

pvp_token

Dec 29th, 2017
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.67 KB | None | 0 0
  1. -- -- -- -- -- -- -- -- -- -- -- -- --
  2. -- -- PvP Token System by Salja. -- --
  3. -- -- -- -- -- -- -- -- -- -- -- -- --
  4.  
  5. -- Include sc_default
  6. require "base/sc_default"
  7.  
  8. local TokenSystem = {}
  9.  
  10. -- Settings
  11. TokenSystem.Settings = {
  12.     Name = "[Token System]",
  13.     ItemOrGold = 0,                     -- 0 = Gold and Item, 1 = Only Item, 2 = Only Gold
  14.     WorldAnnounce = true,               -- Sends a World Announce false = Off, true = On
  15.     GoldCount = 10000,                  -- Reward in copper
  16.     ItemEntry = 20558,                  -- Warsong Gulch Mark of Honor
  17.     ItemCount = 1,                      -- Count of the Item
  18.     ItemName = GetItemLink(20558),
  19.     Cooldown = 180,                     -- Wehn you kill the same player in this time you become not gold or item (set to 0 for disable)
  20. };
  21.  
  22. function TokenSystem.OnPlayerKill(event, killer, killed)
  23.     local Receiver = killer:GetGUIDLow()
  24.     local KillerName = killer:GetName()
  25.     local KilledName = killed:GetName()
  26.  
  27.     if (TokenSystem.Settings.WorldAnnounce == true) then
  28.         SendWorldMessage(string.format("%s |Hplayer:%s|h[%s]|h killed |Hplayer:%s|h[%s]|h", TokenSystem.Settings.Name, KillerName, KillerName, KilledName, KilledName))
  29.     end
  30.  
  31.     if (TokenSystem.Settings.ItemOrGold ~= 2) then
  32.         if killed:GetLuaCooldown() == 0 then
  33.             if (killer:AddItem(TokenSystem.Settings.ItemEntry, TokenSystem.Settings.ItemCount)) then
  34.                 if (TokenSystem.Settings.ItemCount == 1) then
  35.                     killer:SendBroadcastMessage(string.format("%s |CFF20C000 You get: %s|CFF20C000.|r", TokenSystem.Settings.Name, TokenSystem.Settings.ItemName))
  36.                     killed:SetLuaCooldown(TokenSystem.Settings.Cooldown)
  37.                 else
  38.                     killer:SendBroadcastMessage(string.format("%s |CFF20C000 You get: %s|CFF20C000 x%s.|r", TokenSystem.Settings.Name, TokenSystem.Settings.ItemNamem, TokenSystem.Settings.ItemCount))
  39.                     killed:SetLuaCooldown(TokenSystem.Settings.Cooldown)
  40.                 end
  41.             else
  42.                 killer:SendBroadcastMessage(string.format("%s |cffff0000 Your bags are full, we will send it by mail.|r", TokenSystem.Settings.Name))
  43.                 SendMail("Token System", "Your Bags are full we send via Mail", Receiver, nil, 41, nil, TokenSystem.Settings.ItemEntry, TokenSystem.Settings.ItemCount)
  44.                 killed:SetLuaCooldown(TokenSystem.Settings.Cooldown)
  45.             end
  46.         else
  47.             killer:SendBroadcastMessage(string.format("%s Set Cooldown for %s, to %s seconds for next token kill", TokenSystem.Settings.Name, KilledName, math.ceil(killed:GetLuaCooldown())))
  48.             killed:SendBroadcastMessage(string.format("%s Set YOUR Cooldown, to %s seconds for next token kill", TokenSystem.Settings.Name, math.ceil(killed:GetLuaCooldown())))
  49.         end
  50.     end
  51.  
  52.     if (TokenSystem.Settings.ItemOrGold ~= 1) then
  53.         if killed:GetLuaCooldown() == 0 then
  54.             killer:ModifyMoney(TokenSystem.Settings.GoldCount)
  55.             killer:SendBroadcastMessage(string.format("%s |CFF20C000 You get: %s|CFF20C000 Copper.|r", TokenSystem.Settings.Name, TokenSystem.Settings.GoldCount))
  56.             killed:SetLuaCooldown(TokenSystem.Settings.Cooldown)
  57.         else
  58.             killer:SendBroadcastMessage(string.format("%s Set Cooldown for %s, to %s seconds for next token kill", TokenSystem.Settings.Name, KilledName, math.ceil(killed:GetLuaCooldown())))
  59.             killed:SendBroadcastMessage(string.format("%s Set YOUR Cooldown, to %s seconds for next token kill", TokenSystem.Settings.Name, math.ceil(killed:GetLuaCooldown())))
  60.         end
  61.     end
  62. end
  63.  
  64. RegisterPlayerEvent(6, TokenSystem.OnPlayerKill)
Advertisement
Add Comment
Please, Sign In to add comment