SHOW:
|
|
- or go back to the newest paste.
1 | --[[ | |
2 | _____ ____ | |
3 | | ___| __ ___ _______ _ __ / ___|___ _ __ ___ | |
4 | | |_ | '__/ _ \_ / _ \ '_ \| | / _ \| '__/ _ \ | |
5 | | _|| | | (_) / / __/ | | | |__| (_) | | | __/ | |
6 | |_| |_| \___/___\___|_| |_|\____\___/|_| \___| | |
7 | - | Lightning speed and strength |
7 | + | Lightning speed and strength |
8 | - | conjured directly from the depths of logic! |
8 | + | conjured directly from the depths of logic! |
9 | - | Prismatic-Network 2013 (C) by Psykko |
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 | - | LOC = {} |
18 | + | -- Rewritten by Rochet2 |
19 | ||
20 | local CD = 20 -- 20 sec | |
21 | ||
22 | - | function LOC.Options(event, player, message) |
22 | + | local LOC = {} |
23 | - | if (message == "#save") then -- command to save location |
23 | + | local function OnChat(event, player, message) |
24 | - | if (LOC[tostring(player)] == nil) then |
24 | + | if (message == "#save") then -- command to save location |
25 | - | LOC[tostring(player)] = {cooldown = 0, map = player:GetMapId(), x = player:GetX(),y = player:GetY(),z = player:GetZ()} |
25 | + | local str = tostring(player) |
26 | - | player:SendBroadcastMessage("|cffff6060[Prismatic-Network]: |cff00ccffYour Location has been Saved.") -- text on save |
26 | + | local x,y,z,o = player:GetLocation() |
27 | - | else |
27 | + | LOC[str] = |
28 | - | if (GetCooldown(player).cooldown ~= 0) then |
28 | + | { |
29 | - | LOC[tostring(player)] = {cooldown = GetCooldown(player).cooldown, map = player:GetMapId(), x = player:GetX(),y = player:GetY(),z = player:GetZ()} |
29 | + | cooldown = (LOC[str] and LOC[str].cooldown) or 0, |
30 | - | else |
30 | + | location = {player:GetMapId(),x,y,z}, |
31 | - | LOC[tostring(player)] = {cooldown = 0, map = player:GetMapId(), x = player:GetX(),y = player:GetY(),z = player:GetZ()} |
31 | + | } |
32 | - | end |
32 | + | player:SendBroadcastMessage("|cffff6060[Prismatic-Network]: |cff00ccffYour Location has been Saved.") |
33 | - | player:SendBroadcastMessage("|cffff6060[Prismatic-Network]: |cff00ccffYour Checkpoint has been changed to his Location.") -- text on save the next point |
33 | + | return false |
34 | - | end |
34 | + | elseif (message == "#go") then -- command to teleport to checkpoint |
35 | - | return 0; |
35 | + | local str = tostring(player) |
36 | - | end |
36 | + | if (LOC[str]) then |
37 | - | if (message == "#go") then -- command to teleport to checkpoint |
37 | + | local ctime = os.time() |
38 | - | if (GetCoords(player) ~= false) then |
38 | + | if (LOC[str].cooldown < ctime) then |
39 | - | if (GetCooldown(player).cooldown == 0) then |
39 | + | player:Teleport(table.unpack(LOC[str].location)) |
40 | - | player:Teleport(GetCoords(player)) |
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 | - | 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 | - | GetCooldown(player).cooldown = os.time() + CD |
42 | + | else |
43 | - | else |
43 | + | player:SendBroadcastMessage("|cffff6060[Prismatic-Network]: |cff00ccffPlease wait "..(LOC[str].cooldown - ctime).." seconds to teleport again.") -- text on cooldown |
44 | - | player:SendBroadcastMessage("|cffff6060[Prismatic-Network]: |cff00ccffPlease wait "..GetCooldown(player).cooldown - os.time().." seconds to teleport again.") -- text on cooldown |
44 | + | end |
45 | - | end |
45 | + | else |
46 | - | else |
46 | + | player:SendBroadcastMessage("|cffff6060[Prismatic-Network]: |cff00ccffYou havent set a Checkpoint yet.") -- text on no saved location |
47 | - | player:SendBroadcastMessage("|cffff6060[Prismatic-Network]: |cff00ccffYou havent set a Checkpoint yet.") -- text on no saved location |
47 | + | end |
48 | - | end |
48 | + | return false |
49 | - | return 0; |
49 | + | end |
50 | - | end |
50 | + | |
51 | - | end |
51 | + | |
52 | RegisterServerHook(16, OnChat) |