Exports

Pharmacy Supply System Exports

Server Side Exports

reducePharmacySupplies(pharmacyId)

Reduces the supplies at a pharmacy when medications are given out. Returns true if supplies were available and reduced, false otherwise.

local hasSupplies = exports['envi-prescriptions']:reducePharmacySupplies(1)

Client Side Exports

OpenPharmacySuppliesMenu()

Opens the pharmacy supplies management menu for staff.

exports['envi-prescriptions']:OpenPharmacySuppliesMenu()

OpenPharmacyEmployeeMenu()

Opens the pharmacy employee computer interface.

exports['envi-prescriptions']:OpenPharmacyEmployeeMenu()

Insurance System Exports

Server Side Exports


HasMedicalInsurance(source)

Returns a boolean indicating if the player has any active insurance plan.

-- Check if player has insurance
local hasInsurance = exports['envi-prescriptions']:HasMedicalInsurance(source)
if hasInsurance then
    -- Player has insurance coverage
    print("Player has medical insurance")
else
    -- Player doesn't have insurance
    print("Player has no insurance coverage")
end

GetPlayerInsurance(source)

Returns complete insurance details for a player.

-- Get player's insurance data
local insuranceData = exports['envi-prescriptions']:GetPlayerInsurance(source)
if insuranceData and insuranceData.plan ~= 'none' then
    print("Player has " .. insuranceData.planName .. " plan")
    print("Discount rate: " .. insuranceData.discount .. "%")
    print("Down-Payment amount: $" .. insuranceData.downpayment)
end

GetInsuranceClaimHistory(source)

Returns a player's insurance claim history.

-- Get claim history
local claimHistory = exports['envi-prescriptions']:GetInsuranceClaimHistory(source)
for _, claim in ipairs(claimHistory) do
    print("Claim for " .. claim.medication .. " on " .. claim.formatted_date)
    print("Amount covered: $" .. claim.covered_amount)
    print("Status: " .. claim.status)
end

PurchaseInsurance(source, planId)

Attempts to purchase an insurance plan for a player. Returns true on success, false otherwise.

-- Purchase 'premium' plan for player
local success = exports['envi-prescriptions']:PurchaseInsurance(source, 'premium')
if success then
    print("Insurance plan purchased successfully")
else
    print("Failed to purchase insurance plan")
end

CancelInsurance(source)

Cancels a player's current insurance plan. Returns true on success, false otherwise.

-- Cancel player's insurance
local success = exports['envi-prescriptions']:CancelInsurance(source)
if success then
    print("Insurance cancelled successfully")
else
    print("Failed to cancel insurance")
end

SellInsuranceThroughBroker(brokerId, customerId, planId)

Allows a broker (insurance salesperson) to sell insurance to another player. Returns true if successful.

-- Insurance broker sells premium plan to customer
local success = exports['envi-prescriptions']:SellInsuranceThroughBroker(source, targetId, 'premium')
if success then
    print("Insurance sold successfully through broker")
else
    print("Failed to sell insurance through broker")
end

IsPlayerBannedFromInsurance(citizenid)

Checks if a player is banned from purchasing insurance.

local isBanned = exports['envi-prescriptions']:IsPlayerBannedFromInsurance(citizenid)
if isBanned then
    print("Player is banned from purchasing insurance")
else
    print("Player is eligible for insurance")
end

Client Side Exports

HasMedicalInsurance()

Returns a bool - if the player has any active insurance plan.

-- Check if player has insurance
local hasInsurance = exports['envi-prescriptions']:HasMedicalInsurance()
if hasInsurance then
    -- Has insurance, offer discount
    SetDiscountRate(25)
end

GetInsuranceDetails()

Returns complete insurance details for the player.

-- Get insurance details
local insuranceData = exports['envi-prescriptions']:GetInsuranceDetails()
if insuranceData and insuranceData.plan ~= 'none' then
    -- Use the insurance details
    local discountRate = insuranceData.discount
    ShowNotification("You have " .. insuranceData.planName .. " insurance with " .. discountRate .. "% discount")
end

OpenInsuranceMenu()

Opens the insurance menu for the player.

-- Open insurance menu from another script
RegisterCommand('checkinsurance', function()
    exports['envi-prescriptions']:OpenInsuranceMenu()
end, false)

GetClaimHistory()

Returns the player's insurance claim history.

-- Get player's claim history
local claims = exports['envi-prescriptions']:GetClaimHistory()
if #claims > 0 then
    DisplayClaimsList(claims)
else
    ShowNotification("You have no insurance claims")
end

OpenInsuranceBrokerMenu()

Opens the insurance broker menu for selling insurance to other players.

-- Open broker menu from another script
exports['envi-prescriptions']:OpenInsuranceBrokerMenu()

Prescription Records Exports

Server Side Exports


FlagPrescriptionRecord(recordId, reason, source)

Flags a prescription record for review.

exports['envi-prescriptions']:FlagPrescriptionRecord(123, "Possible misuse", source)

GetDoctorPrescriptionRecords(doctorIdentifier)

Gets all prescription records for a specific doctor.

local records = exports['envi-prescriptions']:GetDoctorPrescriptionRecords(doctorIdentifier)

Last updated