-- LUA Script - precede every function and global member with lowercase name of script + '_main' local U = require "scriptbank\\utillib" local rad = math.rad function push_init( e ) Include( "utillib.lua" ) end local minSpeed = 0.1 local currSpeed = nil function push_main( e ) if timer == nil then timer = g_Time end if currSpeed == nil then currSpeed = GetGamePlayerControlTopspeed() end if g_KeyPressW == 1 then local pxp, pyp, pzp, pya = g_PlayerPosX, g_PlayerPosY - 10, g_PlayerPosZ, g_PlayerAngY local rayX, _, rayZ = U.Rotate3D ( 0, 0, 80, 0, rad( pya ), 0 ) local obj = PhysicsRayCast( pxp, pyp, pzp, pxp + rayX, pyp, pzp + rayZ, 30 ) if obj ~= nil and obj > 0 then -- pushing an object so slow down SetGamePlayerControlTopspeed( minSpeed ) else SetGamePlayerControlTopspeed( currSpeed ) end end end