-- 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
-- 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
-- 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
-- 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
-- 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
-- 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
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
-- Check if player has insurance
local hasInsurance = exports['envi-prescriptions']:HasMedicalInsurance()
if hasInsurance then
-- Has insurance, offer discount
SetDiscountRate(25)
end
-- 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
-- Open insurance menu from another script
RegisterCommand('checkinsurance', function()
exports['envi-prescriptions']:OpenInsuranceMenu()
end, false)
-- 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
-- Open broker menu from another script
exports['envi-prescriptions']:OpenInsuranceBrokerMenu()