local nearest = nil local nearest_dist = 80 local int_nearest_dist = nearest_dist local cmode = 0 local new_y = 0 local prop_x = 0 local prop_z = 0 carriable_object = {} function carry_object_init(e) cmode = 0 carriable_object[e] = 1 end function carry_object_main(e) if cmode == 0 then if nearest == nil then nearest_dist = int_nearest_dist elseif GetPlayerDistance(nearest) > nearest_dist then nearest_dist = int_nearest_dist end if GetPlayerDistance(e) < nearest_dist then nearest_dist = GetPlayerDistance(e) nearest = e end if (GetPlayerDistance(e) <= nearest_dist) then Prompt("Press E to carry") if g_KeyPressE == 1 then cmode = 1 nearest = e end end elseif (cmode == 1) then new_y = math.rad(g_PlayerAngY) prop_x = g_PlayerPosX + (math.sin(new_y) * 70) prop_z = g_PlayerPosZ + (math.cos(new_y) * 70) CollisionOff(nearest) SetPosition(nearest , prop_x, g_PlayerPosY , prop_z) RotateToCamera(nearest) CollisionOn(nearest) Prompt("Release E to drop") if g_KeyPressE == 0 or GetPlayerDistance(nearest) > int_nearest_dist then cmode = 0 CollisionOff(nearest) SetPosition(nearest , prop_x , g_PlayerPosY , prop_z) CollisionOn(nearest) nearest = int_nearest_dist nearest = nil end end end