Advertisement
Rochet2

Salja timed event cd

Dec 27th, 2014
473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local SetCooldown = "#s"
  2. local GetCooldown = "#g"
  3.  
  4. local runningevents = {}
  5. local ann(event, delay, repeats, player)
  6.         for _, v in pairs(GetPlayersInWorld()) do
  7.             v:SendBroadcastMessage(""..player:GetLuaCooldown().."")
  8.         end
  9. end
  10.  
  11. local function ChatSystem(event, player, msg, _, lang)
  12.     if (msg == SetCooldown) then
  13.         player:SetLuaCooldown(60)
  14.     elseif (msg == GetCooldown) then
  15.         if (runningevents[player:GetGUIDLow()]) then
  16.             player:RemoveEventById(runningevents[player:GetGUIDLow()])
  17.             runningevents[player:GetGUIDLow()] = nil
  18.             player:SendNotification("announce removed")
  19.         else
  20.             ann()
  21.             runningevents[player:GetGUIDLow()] = player:RegisterEvent(ann, 1000, player:GetCooldown())
  22.         end
  23.     else
  24.         return
  25.     end
  26.     return false
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement