Advertisement
Rochet2

Untitled

Feb 20th, 2013
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local CooldownTimer = 10 -- seconds
  2. local ChatCommand = "#tele"
  3.  
  4. local CD = {} -- Cooldown store
  5. local function Command(event, pPlayer, msg, _, _)
  6.     if (msg == ChatCommand) then                   -- check that the message is our command
  7.         local sPlayer = tostring(pPlayer)          -- convert player to a string
  8.         if CD[sPlayer] and os.clock()-CD[sPlayer] <= CooldownTimer then -- Check if the player has a cooldown and if he has waited enough
  9.             pPlayer:SendAreaTriggerMessage("|cFFFF0000You must wait "..CooldownTimer.." seconds before teleporting again!")
  10.         else
  11.             CD[sPlayer] = os.clock()               -- re set the time to the store for the player
  12.             pPlayer:Teleport(map, x, y, z)
  13.         end
  14.         return false                               -- prevent the player from saying #tele ingame
  15.     end
  16. end
  17.  
  18. RegisterServerHook(16, Command)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement