Advertisement
Rochet2

Untitled

Apr 17th, 2013
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2.   _____                        ____              
  3.  |  ___| __ ___ _______ _ __  / ___|___  _ __ ___
  4.  | |_ | '__/ _ \_  / _ \ '_ \| |   / _ \| '__/ _ \
  5.  |  _|| | | (_) / /  __/ | | | |__| (_) | | |  __/
  6.  |_|  |_|  \___/___\___|_| |_|\____\___/|_|  \___|
  7.      Lightning speed and strength
  8.          conjured directly from the depths of logic!  
  9.             Prismatic-Network 2013 (C) by Psykko
  10. <--------------------------------------------------------------------------->
  11.  - Developer(s): Psykko
  12.  - Complete: 100%
  13.  - ScriptName: 'CheckpointSystem'
  14.  - Comment: N/A
  15. <--------------------------------------------------------------------------->
  16. ]]
  17.  
  18. -- Rewritten by Rochet2
  19.  
  20. local CD = 20 -- 20 sec
  21.  
  22. local LOC = {}
  23. local function OnChat(event, player, message)
  24.     if (message == "#save") then -- command to save location
  25.         local str = tostring(player)
  26.         local x,y,z,o = player:GetLocation()
  27.         LOC[str] =
  28.         {
  29.             cooldown = (LOC[str] and LOC[str].cooldown) or 0,
  30.             location = {player:GetMapId(),x,y,z},
  31.         }
  32.         player:SendBroadcastMessage("|cffff6060[Prismatic-Network]: |cff00ccffYour Location has been Saved.")
  33.         return false
  34.     elseif (message == "#go") then    -- command to teleport to checkpoint
  35.         local str = tostring(player)
  36.         if (LOC[str]) then
  37.             local ctime = os.time()
  38.             if (LOC[str].cooldown < ctime) then
  39.                 player:Teleport(table.unpack(LOC[str].location))
  40.                 player:SendBroadcastMessage("|cffff6060[Prismatic-Network]: |cff00ccffYou have been Teleported to your Checkpoint. You can use this Command in 10seconds again.") -- text on teleport
  41.                 LOC[str].cooldown = ctime + CD
  42.             else
  43.                 player:SendBroadcastMessage("|cffff6060[Prismatic-Network]: |cff00ccffPlease wait "..(LOC[str].cooldown - ctime).." seconds to teleport again.") -- text on cooldown
  44.             end
  45.         else
  46.             player:SendBroadcastMessage("|cffff6060[Prismatic-Network]: |cff00ccffYou havent set a Checkpoint yet.") -- text on no saved location
  47.         end
  48.         return false
  49.     end    
  50. end
  51.  
  52. RegisterServerHook(16, OnChat)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement