local medkitpoints = {} local PointsToAdd = {} local AddingHealth = {} local PickupCollected = {} local id = {} function health_grad_init(e) StartTimer(e) medkitpoints[e] = 10 PointsToAdd[e] = 0 AddingHealth[e] = false PickupCollected[e] = false id[e] = e end function health_grad_main(e) PlayerDist = GetPlayerDistance(e) if not PickupCollected[e] and PlayerDist < 70 and id[e] == 1 then PickupCollected[e] = true PlaySound(e, 0) Hide(e) end if PickupCollected[e] and g_PlayerHealth > 0 and id[e] == 1 then if not AddingHealth[e] then AddingHealth[e] = true PointsToAdd[e] = medkitpoints[e] StartTimer(e) end if AddingHealth[e] and PointsToAdd[e] > 0 and GetTimer(e) > 100 and id[e] == 1 then AddPlayerHealth(e) PointsToAdd[e] = PointsToAdd[e] - 1 StartTimer(e) end if PointsToAdd[e] == 0 and id[e] == 1 then AddingHealth[e] = false ActivateIfUsed(e) PromptDuration("Med kit caught : +"..medkitpoints[e].." id[e]:"..e, 2000) Destroy(e) end end end