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