Newbie Posted May 2, 2014 Share Posted May 2, 2014 function updatePickups() local angle = math.fmod((getTickCount() - g_PickupStartTick) * 360 / 2000, 360) local g_Pickups = g_Pickups local pickup, x, y, cX, cY, cZ, pickX, pickY, pickZ for colshape,elem in pairs(g_VisiblePickups) do pickup = g_Pickups[colshape] if pickup.load then setElementRotation(elem, 0, 0, angle) if pickup.label then cX, cY, cZ = getCameraMatrix() pickX, pickY, pickZ = unpack(pickup.position) x, y = getScreenFromWorldPosition(pickX, pickY, pickZ + 2.85, 0.08 ) local distanceToPickup = getDistanceBetweenPoints3D(cX, cY, cZ, pickX, pickY, pickZ) if distanceToPickup > 80 then pickup.labelInRange = false pickup.label:visible(false) elseif x then if distanceToPickup < 60 then if isLineOfSightClear(cX, cY, cZ, pickX, pickY, pickZ, true, false, false, true, false) then if not pickup.labelInRange then if pickup.anim then pickup.anim:remove() end pickup.anim = Animation.createAndPlay( pickup.label, Animation.presets.dxTextFadeIn(500) ) pickup.labelInRange = true pickup.labelVisible = true end if not pickup.labelVisible then pickup.label:color(255, 153, 0,255) end pickup.label:visible(true) else pickup.label:color(255, 153, 0,255) pickup.labelVisible = false pickup.label:visible(false) end else if pickup.labelInRange then if pickup.anim then pickup.anim:remove() end pickup.anim = Animation.createAndPlay( pickup.label, Animation.presets.dxTextFadeOut(1000) ) pickup.labelInRange = false pickup.labelVisible = false pickup.label:visible(true) end end local scale = (60/distanceToPickup)*0.7 pickup.label:scale(scale) pickup.label:position(x, y, false) else pickup.label:color(255, 153, 0,255) pickup.labelVisible = false pickup.label:visible(false) end if Spectate.fadedout then pickup.label:visible(false) -- Hide pickup labels when screen is black end end else if pickup.label then pickup.label:visible(false) if pickup.labelInRange then pickup.label:color(255, 153, 0,255) pickup.labelInRange = false end end end end end addEventHandler('onClientRender', g_Root, updatePickups) Link to comment
Newbie Posted May 2, 2014 Author Share Posted May 2, 2014 Which line is 448? 2. local angle = math.fmod((getTickCount() - g_PickupStartTick) * 360 / 2000, 360) Link to comment
Gallardo9944 Posted May 2, 2014 Share Posted May 2, 2014 apparently it doesn't set the tick count. Add at the beginning of the code: local g_PickupStartTick = getTickCount() Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now