--script by smallg -- range to be able to use teleporter local use_range = 120 --key to use teleporter local input_key = "e" --entity number of real pad used to port to --put name of this entity inside the 'ifused' field of teleporter local port_pad = 2 --delay until port --rx = 1 is 1 second / rx = 10 is 10 seconds / etc local rx = 3 --number of destinations --*you must set names and target entity numbers for these in the init(e) part* local max_dest = 9 ---- local dest_number = {} local destination = {} local state = {} local pressed = 0 local delay = 0 local x = 50 local y = 10 local dest = 1 local rx_init = rx function teleportlevels_init(e) --input entity number of area's here dest_number[1] = 13 dest_number[2] = 14 dest_number[3] = 15 dest_number[4] = 16 dest_number[5] = 17 dest_number[6] = 18 dest_number[7] = 19 dest_number[8] = 21 dest_number[9] = 22 --name area's here destination[1] = "Area 1" destination[2] = "the Swamp" destination[3] = "Home" destination[4] = ".... wait, who let you in?" destination[5] = "???" destination[6] = "Unknown!!!!" destination[7] = "Lucky 777's" destination[8] = "your destination" destination[9] = "the last stop" state[e] = "init" end --init function teleportlevels_main(e) if state[e] == "init" then if GetPlayerDistance(e) <= use_range then PromptLocal(e,"Press " .. input_key .. " to power on teleporter") if g_InKey == input_key and pressed == 0 then state[e] = "select dest" pressed = 1 rx = rx_init FreezePlayer() CollisionOff(port_pad) SetPosition(port_pad,g_PlayerPosX,g_PlayerPosY,g_PlayerPosZ) y = 10 end end elseif state[e] == "select dest" then for a = 1, max_dest do --if you have bigger destination names then make the panel here bigger --format = Panel(x1,y1,x2,y2) Panel(35,y-5,65,y+4.5) TextCenterOnXColor(x,y,3,a .. " = " .. destination[a],205,5,205) y = y + 10 if g_Scancode == a+1 and pressed == 0 then pressed = 1 dest = a delay = GetTimer(e) PromptDuration("Porting in " .. rx .. " : Destination = " .. destination[dest],1000) state[e] = "porting" LoopSound(e,0) end end y= 10 elseif state[e] == "porting" then if rx > -1 then if GetTimer(e) > delay then PromptDuration("Porting in " .. rx .. " : Destination = " .. destination[dest],1000) delay = GetTimer(e) + 1000 rx = rx - 1 end else StopSound(e,0) CollisionOff(dest_number[dest]) SetPosition(port_pad,g_Entity[dest_number[dest]]['x'],g_Entity[dest_number[dest]]['y'],g_Entity[dest_number[dest]]['z']) UnFreezePlayer() TransportToIfUsed(e) PromptDuration("You have reached " .. destination[dest],2000) state[e] = "init" end end --state --reset input if pressed == 1 and g_InKey == "" then pressed = 0 end end --main function teleportlevels_exit(e) end --exit