-- LUA Script - precede every function and global member with lowercase name of script + '_main' local U = require "scriptbank\\utillib" local rad = math.rad local pad = {} function jump_pad_init( e ) Include( "utillib.lua" ) pad[ e ] = { state = 'idle' } end local lastTime = 0 local tDiff = 0 local controlEnt = nil function jump_pad_main(e) if controlEnt == nil then controlEnt = e end local timeNow = g_Time if controlEnt == e then if timeNow > lastTime + 20 then tDiff = ( timeNow - lastTime ) / 20 lastTime = timeNow end end local thisPad = pad[ e ] if thisPad == nil then return end if U.PlayerCloserThan( e, 80 ) and thisPad.state == 'idle' then thisPad.state = 'active' local xa, ya, za = rad( g_PlayerAngX ), rad( g_PlayerAngY ), rad( g_PlayerAngZ ) thisPad.vx, thisPad.vy, thisPad.vz = U.Rotate3D( 0, 10, 10, xa, ya, za ) thisPad.timer = timeNow + 1500 SetGamePlayerControlGravityActive(0) end if thisPad.state == 'active' then if timeNow < thisPad.timer then SetFreezePosition( g_PlayerPosX + thisPad.vx * tDiff, g_PlayerPosY + thisPad.vy * tDiff, g_PlayerPosZ + thisPad.vz * tDiff ) TransportToFreezePositionOnly() else thisPad.state = 'idle' SetGamePlayerControlGravityActive(1) end end end