diff --git a/README.md b/README.md index 803205c..8e2fc3c 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,7 @@ Planned to come: Checking cause of death plus some pretty UI stuff and more! ;) ## Dependencies - [vorp_core](https://github.com/VORPCORE/vorp-core-lua) - [vorp_inventory](https://github.com/VORPCORE/vorp_inventory-lua) -- [vorp_inputs](https://github.com/VORPCORE/vorp_inputs-lua) -- [vorp_menu](https://github.com/VORPCORE/vorp_menu) +- [feather-menu](https://github.com/FeatherFramework/feather-menu/releases) - [bcc-utils](https://github.com/BryceCanyonCounty/bcc-utils) ## Installation @@ -45,7 +44,6 @@ Planned to come: Checking cause of death plus some pretty UI stuff and more! ;) - Add `bcc-medical` folder to your resources folder - Add `ensure bcc-medical` to your `resources.cfg` - Run the included database file --- Add images from `img` folder to: `...\vorp_inventory\html\img\items` - Restart server ## GitHub diff --git a/client/client.lua b/client/client.lua index 7f8fbc3..bd1b67f 100644 --- a/client/client.lua +++ b/client/client.lua @@ -1,16 +1,11 @@ -local VORPcore = exports.vorp_core:GetCore() -local Menu = exports.vorp_menu:GetMenuData() - local PromptGroup = GetRandomIntInRange(0, 0xffffff) local UsePrompt -local HealthCheck = false -local CreatedPed = 0 -local DamageBone = _U('None') -local DamageBoneSelf = _U('None') local HasJob = false -local InMenu = false local IsCalled = false -local DamageHash = nil +local CreatedPed = 0 +DamageBone = _U('None') +DamageBoneSelf = _U('None') +DamageHash = nil local function SetupUsePrompt() UsePrompt = PromptRegisterBegin() @@ -89,7 +84,7 @@ CreateThread(function() local playerCoords = GetEntityCoords(PlayerPedId(), true) local sleep = 1000 - if InMenu or IsEntityDead(playerPed) then goto END end + if IsEntityDead(playerPed) then goto END end for _, officeCfg in pairs(Offices) do local distance = #(playerCoords - officeCfg.coords) @@ -100,7 +95,6 @@ CreateThread(function() CheckPlayerJob() if HasJob then CabinetMenu() - InMenu = true else VORPcore.NotifyRightTip(_U('you_do_not_have_job'), 4000) end @@ -206,14 +200,14 @@ function SpawnNPC() if Config.doctors.toHospital then DoScreenFadeOut(800) Wait(800) - TriggerEvent('vorp_core:respawnPlayer') + TriggerServerEvent('bcc-medical:RespawnPlayer') while IsScreenFadedOut do Wait(50) end else DoScreenFadeOut(800) Wait(800) - TriggerEvent('vorp:resurrectPlayer') + TriggerServerEvent('bcc-medical:RevivePlayer') Wait(800) DoScreenFadeIn(800) end @@ -229,7 +223,7 @@ RegisterNetEvent('bcc-medical:FindDoc', function() end end) -local function GetClosestPlayer() +function GetClosestPlayer() local players = GetActivePlayers() local player = PlayerId() local coords = GetEntityCoords(PlayerPedId()) @@ -267,10 +261,6 @@ RegisterNetEvent('bcc-medical:GetClosestPlayerHeal', function(perm) end end) -RegisterNetEvent("bcc-medical:Revive", function() - TriggerEvent('vorp:resurrectPlayer') -end) - RegisterCommand(Config.Command, function(source, args, rawCommand) CheckPlayerJob() if HasJob then @@ -330,7 +320,7 @@ else MonitorBleed() end -local function DamageHashCheck() +function DamageHashCheck() if DamageHash == -842959696 then DamageHash = 'appear to be hurt' elseif DamageHash == 1885857703 or DamageHash == -544306709 then @@ -347,224 +337,8 @@ local function DamageHashCheck() return DamageHash end -function MedicMenu() - Menu.CloseAll() - local Elements = {} - local playerPed = PlayerPedId() - local closestPlayer, closestDistance = GetClosestPlayer() - local closestPlayerPed = GetPlayerPed(closestPlayer) - local closesthit, closestbone = GetPedLastDamageBone(closestPlayerPed) - local hit, bone = GetPedLastDamageBone(playerPed) - if DamageHash == nil then DamageHash = 'None' end - - TriggerEvent("bcc-medical:CheckPart", bone) - if closestPlayer ~= -1 and closestDistance <= 3.0 then - TriggerEvent("bcc-medical:CheckPartOther", closestbone) - Wait(1000) - table.insert(Elements, { - label = _U('ClosestInjury') .. DamageBone, - value = 'lastwound', - desc = _U('ClosestInjuryDesc') .. DamageBone - }) - end - - Elements = { - { - label = _U('InjuredPart') .. DamageBoneSelf, - value = 'lastwoundself', - desc = _U('InjuredPartDesc') .. DamageBoneSelf - }, - { - label = _U('Wound') .. DamageHashCheck(), - value = 'wound', - desc = _U('WoundDesc') - }, - } - - Menu.Open('default', GetCurrentResourceName(), 'vorp_menu_medic', - { - title = _U('PlayerMenu'), - align = 'top-left', - elements = Elements, - }, - function(data, menu) - if (data.current.value == 'lastwound') then - if closestPlayer ~= -1 and closestDistance <= 3.0 then - if HealthCheck == false then - HealthCheck = true - hit, closestbone = GetPedLastDamageBone(closestPlayerPed) - TriggerEvent("bcc-medical:CheckPartOther", closestbone) - else - HealthCheck = false - end - end - MedicMenu() - end - if (data.current.value == 'lastwoundself') then - if HealthCheck == false then - HealthCheck = true - hit, bone = GetPedLastDamageBone(PlayerPedId()) - TriggerEvent("bcc-medical:CheckPart", bone) - else - HealthCheck = false - end - MedicMenu() - end - end, - function(data, menu) - DamageBone = _U('None') - DamageBoneSelf = _U('None') - menu.close() - end) -end - -function DoctorMenu() - Menu.CloseAll() - local DocElements = {} - local playerPed = PlayerPedId() - local health = GetEntityHealth(playerPed) - local pulse = health / 4 + math.random(20, 30) - local closestPlayer, closestDistance = GetClosestPlayer() - local closestPlayerPed = GetPlayerPed(closestPlayer) - local patienthealth = GetEntityHealth(closestPlayerPed) - local patientpulse = patienthealth / 4 + math.random(20, 30) - - local closesthit, closestbone = GetPedLastDamageBone(closestPlayerPed) - local hit, bone = GetPedLastDamageBone(PlayerPedId()) - if DamageHash == nil then DamageHash = 'None' end - - TriggerEvent("bcc-medical:CheckPart", bone) - if closestPlayer ~= -1 and closestDistance <= 3.0 then - TriggerEvent("bcc-medical:CheckPartOther", closestbone) - Wait(1000) - table.insert(DocElements, { - label = _U('ClosestInjury') .. DamageBone, - value = 'lastwound', - desc = _U('ClosestInjuryDesc') .. DamageBone - }) - table.insert(DocElements, { - label = _U('ClosestWound') .. DamageHashCheck(), - value = 'wound', - desc = _U('WoundDesc') - }) - table.insert(DocElements, - { - label = _U('PatientPulse') .. patientpulse, - value = 'patientpulse', - desc = _U('PatientPulse') .. patientpulse - } - ) - end - DocElements = { - { label = _U('Pulse') .. pulse, value = 'pulse', desc = _U('Pulse') }, - { - label = _U('InjuredPart') .. DamageBoneSelf, - value = 'lastwoundself', - desc = _U('InjuredPartDesc') .. DamageBoneSelf - }, - { - label = _U('Wound') .. DamageHashCheck(), - value = 'wound', - desc = _U('WoundDesc') - }, - } - - Menu.Open('default', GetCurrentResourceName(), 'vorp_menu_doctor', - { - title = _U('DoctorMenu'), - align = 'top-left', - elements = DocElements, - }, - function(data, menu) - if (data.current.value == 'lastwound') then - if closestPlayer ~= -1 and closestDistance <= 3.0 then - if HealthCheck == false then - HealthCheck = true - hit, closestbone = GetPedLastDamageBone(closestPlayerPed) - TriggerEvent("bcc-medical:CheckPartOther", closestbone) - else - HealthCheck = false - end - end - DoctorMenu() - end - if (data.current.value == 'lastwoundself') then - if HealthCheck == false then - HealthCheck = true - hit, bone = GetPedLastDamageBone(playerPed) - TriggerEvent("bcc-medical:CheckPart", bone) - else - HealthCheck = false - end - DoctorMenu() - end - end, - function(data, menu) - DamageBone = _U('None') - DamageBoneSelf = _U('None') - menu.close() - end) -end - -function CabinetMenu() - Menu.CloseAll() - - local elements - if Config.PropCrafting then - elements = { - { label = _U('Stitch'), value = 'takestim' }, - { label = "Doctor Bag", value = 'takebag', desc = "Doctor Bag" }, - } - else - elements = { - { label = _U('Stitch'), value = 'takestim' }, - } - end - - local myInput = { - type = "enableinput", -- don't touch - inputType = "input", -- input type - button = _U('Button'), -- button name - placeholder = _U('Placeholder'), -- placeholder name - style = "block", -- don't touch - attributes = { - inputHeader = _U('Amount'), -- header - type = "text", -- inputype text, number,date,textarea ETC - pattern = "[0-9]", -- only numbers "[0-9]" | for letters only "[A-Za-z]+" - title = _U('NumOnly'), -- if input doesnt match show this message - style = "border-radius: 10px; background-color: ; border:none;" -- style - } - } - - Menu.Open('default', GetCurrentResourceName(), 'vorp_menu_cabinet', - { - title = _U('CabinetMenu'), - subtext = _U('CabinetDesc'), - align = 'top-left', - elements = elements, - }, - function(data, menu) - if (data.current.value == 'takestim') then - TriggerEvent("vorpinputs:advancedInput", json.encode(myInput), function(result) - if result ~= "" or result then -- making sure its not empty or nil - TriggerServerEvent('bcc-medical:TakeItem', "NeedleandThread", tonumber(result)) - else - print("its empty?") -- notify - end - end) - end - - if (data.current.value == 'takebag') then - TriggerServerEvent('bcc-medical:TakeItem', "Doctor_Bag", 1) - end - end, - function(data, menu) - InMenu = false - menu.close() - end) -end - -AddEventHandler('bcc-medical:CheckPart', function(bone) +-- Function to check part and set damageboneself based on the bone parameter +function CheckPartSelf(bone) if bone == 6884 or bone == 43312 then DamageBoneSelf = _U('RightLeg') elseif bone == 65478 or bone == 55120 or bone == 45454 then @@ -582,9 +356,10 @@ AddEventHandler('bcc-medical:CheckPart', function(bone) elseif bone == 0 then DamageBoneSelf = "None" end -end) +end -AddEventHandler('bcc-medical:CheckPartOther', function(bone) +-- Function to check part and set damagebone based on the bone parameter +function CheckPartOther(bone) if bone == 6884 or bone == 43312 then DamageBone = _U('RightLeg') elseif bone == 65478 or bone == 55120 or bone == 45454 then @@ -602,7 +377,7 @@ AddEventHandler('bcc-medical:CheckPartOther', function(bone) elseif bone == 0 then DamageBone = "None" end -end) +end function GetPlayers() local players = {} diff --git a/client/functions.lua b/client/functions.lua new file mode 100644 index 0000000..48eb4d0 --- /dev/null +++ b/client/functions.lua @@ -0,0 +1,28 @@ +-- Core Variables +VORPcore = exports.vorp_core:GetCore() +BccUtils = exports['bcc-utils'].initiate() +FeatherMenu = exports['feather-menu'].initiate() + +BCCMedicalCabinetMenu = FeatherMenu:RegisterMenu('medic:cabinet:mainmenu', { + top = '5%', + left = '5%', + ['720width'] = '500px', + ['1080width'] = '600px', + ['2kwidth'] = '700px', + ['4kwidth'] = '900px', + style = {}, + contentslot = { + style = { + ['height'] = '350px', + ['min-height'] = '250px' + } + }, + draggable = true +}, { + opened = function() + DisplayRadar(false) + end, + closed = function() + DisplayRadar(true) + end +}) \ No newline at end of file diff --git a/client/menu.lua b/client/menu.lua new file mode 100644 index 0000000..0bed398 --- /dev/null +++ b/client/menu.lua @@ -0,0 +1,348 @@ +local HealthCheck = false + +function MedicMenu() + local health = GetEntityHealth(PlayerPedId()) + local pulse = health / 4 + math.random(20, 30) + local hit, bone = GetPedLastDamageBone(PlayerPedId()) + if DamageHash == nil then DamageHash = 'None' end + + local MedicMenuPage = BCCMedicalCabinetMenu:RegisterPage('doctor:menu:page') + + MedicMenuPage:RegisterElement('header', { + value = _U('PlayerMenu'), + slot = "header", + style = {} + }) + + MedicMenuPage:RegisterElement('button', { + label = _U('Pulse') .. pulse, + style = {} + }) + + MedicMenuPage:RegisterElement('button', { + label = _U('InjuredPart') .. DamageBoneSelf, + style = {}, + }, function() + if Config.devMode then + print("Injured part button clicked.") + end + if not HealthCheck then + HealthCheck = true + hit, bone = GetPedLastDamageBone(PlayerPedId()) + if Config.devMode then + print("Checking part for player.") + end + CheckPartSelf(bone) -- Directly call the function instead of triggering an event + else + HealthCheck = false + end + MedicMenu() -- Refresh or re-open the MedicMenu + end) + + MedicMenuPage:RegisterElement('line', { + slot = 'footer', + style = {} + }) + + MedicMenuPage:RegisterElement('button', { + label = "Back", + slot = 'footer', + style = {} + }) + + MedicMenuPage:RegisterElement('bottomline', { + slot = 'footer', + style = {} + }) + + -- Open the initial doctor menu + if Config.devMode then + print("Opening MedicMenu page.") + end + BCCMedicalCabinetMenu:Open({ + startupPage = MedicMenuPage + }) +end + +function DoctorMenu() + local health = GetEntityHealth(PlayerPedId()) + local pulse = health / 4 + math.random(20, 30) + local closestPlayer, closestDistance = GetClosestPlayer() + local closestPlayerPed = GetPlayerPed(closestPlayer) + local patientHealth = GetEntityHealth(closestPlayerPed) + local patientPulse = patientHealth / 4 + math.random(20, 30) + + local closestHit, closestBone = GetPedLastDamageBone(closestPlayerPed) + local hit, bone = GetPedLastDamageBone(PlayerPedId()) + if DamageHash == nil then DamageHash = 'None' end + + local DoctorMenuPage = BCCMedicalCabinetMenu:RegisterPage('doctor:menu:page') + + DoctorMenuPage:RegisterElement('header', { + value = _U('DoctorMenu'), + slot = "header", + style = {} + }) + + if closestPlayer ~= -1 and closestDistance <= 3.0 then + if Config.devMode then + print("Found closest player within range. Checking part other.") + end + CheckPartOther(closestBone) + Wait(1000) + DoctorMenuPage:RegisterElement('button', { + label = _U('ClosestInjury') .. DamageBone, + style = {}, + }, function() + if Config.devMode then + print("Closest injury button clicked.") + end + if closestPlayer ~= -1 and closestDistance <= 3.0 then + if not HealthCheck then + HealthCheck = true + hit, closestBone = GetPedLastDamageBone(closestPlayerPed) + if Config.devMode then + print("Checking part other for closest bone.") + end + CheckPartOther(closestBone) -- Directly call the function instead of triggering an event + else + HealthCheck = false + end + end + DoctorMenu() -- Refresh or re-open the DoctorMenu + end) + + DoctorMenuPage:RegisterElement('button', { + label = _U('ClosestInjuryDesc') .. DamageBone, + style = {}, + }) + + + DoctorMenuPage:RegisterElement('button', { + label = _U('ClosestWound') .. DamageHashCheck(), + style = {} + }) + + DoctorMenuPage:RegisterElement('button', { + label = _U('WoundDesc') .. DamageHashCheck(), + style = {} + }) + + DoctorMenuPage:RegisterElement('textdisplay', { + label = _U('PatientPulse') .. patientPulse, + style = {} + }) + end + + DoctorMenuPage:RegisterElement('button', { + label = _U('ClosestWound') .. DamageHashCheck(), + style = {}, + }, function() + if Config.devMode then + print("Injured part button clicked.") + end + if closestPlayer ~= -1 and closestDistance <= 3.0 then + if not HealthCheck then + HealthCheck = true + hit, closestBone = GetPedLastDamageBone(closestPlayerPed) + if Config.devMode then + print("Checking part other for closest bone.") + end + CheckPartOther(closestBone) -- Directly call the function instead of triggering an event + else + HealthCheck = false + end + end + DoctorMenu() -- Refresh or re-open the DoctorMenu + end) + + -- Add specific injury details + DoctorMenuPage:RegisterElement('button', { + label = _U('ClosestInjury') .. ": " .. (bone or _U('None')), + style = {} + }) + + DoctorMenuPage:RegisterElement('line', { + slot = 'footer', + style = {} + }) + + DoctorMenuPage:RegisterElement('button', { + label = 'Back', + slot = 'footer', + style = {} + }, function() + if Config.devMode then + print("Back button clicked. Refreshing menu.") + end + DoctorMenu() -- Navigate back or refresh the menu + end) + + DoctorMenuPage:RegisterElement('bottomline', { + slot = 'footer', + style = {} + }) + + -- Open the initial doctor menu + if Config.devMode then + print("Opening DoctorMenu page.") + end + BCCMedicalCabinetMenu:Open({ + startupPage = DoctorMenuPage + }) +end + +function CabinetMenu() + BCCMedicalCabinetMenu:Close() -- Ensure no other menus are open + if Config.devMode then + print("Closed existing menu.") + end + + -- Initialize the cabinet choice menu page + local cabinetChoiceMenuPage = BCCMedicalCabinetMenu:RegisterPage('cabinet_choice_page') + + cabinetChoiceMenuPage:RegisterElement('header', { + value = _U('CabinetMenu'), + slot = "header", + style = {} + }) + + cabinetChoiceMenuPage:RegisterElement('line', { + slot = "header", + style = {} + }) + + -- Button for initiating the stitch input + cabinetChoiceMenuPage:RegisterElement('button', { + label = _U('Stitch') + }, function() + if Config.devMode then + print("Stitch button clicked.") + end + ShowInputForItem(cabinetChoiceMenuPage, "Stitch", "NeedleandThread") + end) + + -- Register buttons for Bandage Items + for _, item in ipairs(Config.BandageItems) do + cabinetChoiceMenuPage:RegisterElement('button', { + label = item:sub(1, 1):upper() .. item:sub(2), + style = {} + }, function() + if Config.devMode then + print(item .. " button clicked.") + end + ShowInputForItem(cabinetChoiceMenuPage, item, item) + end) + end + + -- Register buttons for Revive Items + for _, item in ipairs(Config.ReviveItems) do + cabinetChoiceMenuPage:RegisterElement('button', { + label = item:sub(1, 1):upper() .. item:sub(2), + style = {} + }, function() + if Config.devMode then + print(item .. " button clicked.") + end + ShowInputForItem(cabinetChoiceMenuPage, item, item) + end) + end + + -- Button for Doctor Bag + cabinetChoiceMenuPage:RegisterElement('button', { + label = "Doctor Bag" + }, function() + if Config.devMode then + print("Doctor Bag button clicked.") + end + TriggerServerEvent('bcc-medical:TakeItem', "Doctor_Bag", 1) + end) + + cabinetChoiceMenuPage:RegisterElement('line', { + slot = "footer", + style = {} + }) + + -- Register a back or close button on the menu + cabinetChoiceMenuPage:RegisterElement('button', { + label = "Close", + slot = "footer", + style = {} + }, function() + if Config.devMode then + print("Close button clicked. Closing menu.") + end + BCCMedicalCabinetMenu:Close() + end) + + cabinetChoiceMenuPage:RegisterElement('bottomline', { + slot = "footer", + style = {} + }) + + -- Open the cabinet choice menu + if Config.devMode then + print("Opening cabinet choice menu.") + end + BCCMedicalCabinetMenu:Open({ + startupPage = cabinetChoiceMenuPage + }) +end + +function ShowInputForItem(page, itemLabel, serverItemName) + local inputPage = BCCMedicalCabinetMenu:RegisterPage('entry:quantity') + + local currentInputValue = nil -- To hold the input value as a string initially + + inputPage:RegisterElement('header', { + value = itemLabel, + slot = "header", + style = {} + }) + + inputPage:RegisterElement('input', { + label = "Enter Amount for " .. itemLabel, + placeholder = "Enter amount...", + style = {} + }, function(data) + currentInputValue = data.value -- Direct assignment as string + if Config.devMode then + print("Input received: " .. currentInputValue) + end + end) + + inputPage:RegisterElement('button', { + label = "Submit", + slot = "footer", + style = {} + }, function() + local amount = tonumber(currentInputValue) -- Proper conversion to number + if amount and amount > 0 then + if Config.devMode then + print("Amount entered for " .. itemLabel .. ": " .. amount) + end + TriggerServerEvent('bcc-medical:TakeItem', serverItemName, amount) + CabinetMenu() + else + print("Invalid input. Please enter a numeric value.") + end + end) + + inputPage:RegisterElement('button', { + label = "Back", + slot = "footer", + style = {} + }, function() + if Config.devMode then + print("Back button clicked. Returning to cabinet menu.") + end + CabinetMenu() -- Navigate back + end) + + if Config.devMode then + print("Opening input page for item: " .. itemLabel) + end + BCCMedicalCabinetMenu:Open({ + startupPage = inputPage + }) +end \ No newline at end of file diff --git a/configs/config.lua b/configs/config.lua index e6cd4e2..dc47bcf 100644 --- a/configs/config.lua +++ b/configs/config.lua @@ -8,14 +8,15 @@ Config.keys = { usePrompt = 0xC7B5340A -- Enter } -Config.bleedChance = 85 -- Chance of bleed (lower - easier, higher - harder) +Config.bleedChance = 85 -- Chance of bleed (lower - easier, higher - harder) -Config.StopBleedOnRevive = true -- Stops Player Bleeding on Revive +Config.StopBleedOnRevive = true -- Stops Player Bleeding on Revive +Config.StopBleedOnRespawn = true -- Stops Player Bleeding on Respawn -- Used in case of temp bleed stop (Not yet Implemented) Config.EnableBleedAfter = 0 -Config.AnimOnBleed = true -- should Player animate on bleed +Config.AnimOnBleed = true -- should Player animate on bleed Config.PropCrafting = true -- Set to false to disable prop-based crafting with the Doctor Bag item @@ -28,12 +29,13 @@ Config.ReviveItems = { 'SmellingSalts' } -Config.Stitches = 'NeedleandThread' --Can change to an equivalent item in your database or run the items.sql, icon in items folder, remember case sensitive +Config.Stitches = 'NeedleandThread' -- Can change to an equivalent item in your database, remember items are case sensitive + Config.usewebhook = true Config.Webhook = '' Config.WebhookTitle = 'Medic' -Config.Command = 'medic' -- Slash command to use in chat to open Medic Menu +Config.Command = 'medic' -- Slash command to use in chat to open Medic Menu Config.gonegative = false -- Can you go negative paying for NPC revival Config.synsociety = false @@ -51,43 +53,43 @@ Config.doctors = { --u_m_m_rhddoctor_01 --u_m_m_valdoctor_01 - command = "sendhelp", -- Command to Call for NPC Doctor - amount = 45, -- Payment for Revive from NPC Doctor - timer = 1, -- How many minutes between calls - toHospital = true -- if true, player will be respawned to nearby hospital else will be revived on spot + command = "sendhelp", -- Command to Call for NPC Doctor + amount = 45, -- Payment for Revive from NPC Doctor + timer = 1, -- How many minutes between calls + toHospital = true -- if true, player will be respawned to nearby hospital else will be revived on spot } Config.BlipColors = { - LIGHT_BLUE = 'BLIP_MODIFIER_MP_COLOR_1', - DARK_RED = 'BLIP_MODIFIER_MP_COLOR_2', - PURPLE = 'BLIP_MODIFIER_MP_COLOR_3', - ORANGE = 'BLIP_MODIFIER_MP_COLOR_4', - TEAL = 'BLIP_MODIFIER_MP_COLOR_5', - LIGHT_YELLOW = 'BLIP_MODIFIER_MP_COLOR_6', - PINK = 'BLIP_MODIFIER_MP_COLOR_7', - GREEN = 'BLIP_MODIFIER_MP_COLOR_8', - DARK_TEAL = 'BLIP_MODIFIER_MP_COLOR_9', - RED = 'BLIP_MODIFIER_MP_COLOR_10', - LIGHT_GREEN = 'BLIP_MODIFIER_MP_COLOR_11', - TEAL2 = 'BLIP_MODIFIER_MP_COLOR_12', - BLUE = 'BLIP_MODIFIER_MP_COLOR_13', - DARK_PUPLE = 'BLIP_MODIFIER_MP_COLOR_14', - DARK_PINK = 'BLIP_MODIFIER_MP_COLOR_15', - DARK_DARK_RED = 'BLIP_MODIFIER_MP_COLOR_16', - GRAY = 'BLIP_MODIFIER_MP_COLOR_17', - PINKISH = 'BLIP_MODIFIER_MP_COLOR_18', - YELLOW_GREEN = 'BLIP_MODIFIER_MP_COLOR_19', - DARK_GREEN = 'BLIP_MODIFIER_MP_COLOR_20', - BRIGHT_BLUE = 'BLIP_MODIFIER_MP_COLOR_21', - BRIGHT_PURPLE = 'BLIP_MODIFIER_MP_COLOR_22', - YELLOW_ORANGE = 'BLIP_MODIFIER_MP_COLOR_23', - BLUE2 = 'BLIP_MODIFIER_MP_COLOR_24', - TEAL3 = 'BLIP_MODIFIER_MP_COLOR_25', - TAN = 'BLIP_MODIFIER_MP_COLOR_26', - OFF_WHITE = 'BLIP_MODIFIER_MP_COLOR_27', - LIGHT_YELLOW2 = 'BLIP_MODIFIER_MP_COLOR_28', - LIGHT_PINK = 'BLIP_MODIFIER_MP_COLOR_29', - LIGHT_RED = 'BLIP_MODIFIER_MP_COLOR_30', - LIGHT_YELLOW3 = 'BLIP_MODIFIER_MP_COLOR_31', - WHITE = 'BLIP_MODIFIER_MP_COLOR_32' -} \ No newline at end of file + LIGHT_BLUE = 'BLIP_MODIFIER_MP_COLOR_1', + DARK_RED = 'BLIP_MODIFIER_MP_COLOR_2', + PURPLE = 'BLIP_MODIFIER_MP_COLOR_3', + ORANGE = 'BLIP_MODIFIER_MP_COLOR_4', + TEAL = 'BLIP_MODIFIER_MP_COLOR_5', + LIGHT_YELLOW = 'BLIP_MODIFIER_MP_COLOR_6', + PINK = 'BLIP_MODIFIER_MP_COLOR_7', + GREEN = 'BLIP_MODIFIER_MP_COLOR_8', + DARK_TEAL = 'BLIP_MODIFIER_MP_COLOR_9', + RED = 'BLIP_MODIFIER_MP_COLOR_10', + LIGHT_GREEN = 'BLIP_MODIFIER_MP_COLOR_11', + TEAL2 = 'BLIP_MODIFIER_MP_COLOR_12', + BLUE = 'BLIP_MODIFIER_MP_COLOR_13', + DARK_PUPLE = 'BLIP_MODIFIER_MP_COLOR_14', + DARK_PINK = 'BLIP_MODIFIER_MP_COLOR_15', + DARK_DARK_RED = 'BLIP_MODIFIER_MP_COLOR_16', + GRAY = 'BLIP_MODIFIER_MP_COLOR_17', + PINKISH = 'BLIP_MODIFIER_MP_COLOR_18', + YELLOW_GREEN = 'BLIP_MODIFIER_MP_COLOR_19', + DARK_GREEN = 'BLIP_MODIFIER_MP_COLOR_20', + BRIGHT_BLUE = 'BLIP_MODIFIER_MP_COLOR_21', + BRIGHT_PURPLE = 'BLIP_MODIFIER_MP_COLOR_22', + YELLOW_ORANGE = 'BLIP_MODIFIER_MP_COLOR_23', + BLUE2 = 'BLIP_MODIFIER_MP_COLOR_24', + TEAL3 = 'BLIP_MODIFIER_MP_COLOR_25', + TAN = 'BLIP_MODIFIER_MP_COLOR_26', + OFF_WHITE = 'BLIP_MODIFIER_MP_COLOR_27', + LIGHT_YELLOW2 = 'BLIP_MODIFIER_MP_COLOR_28', + LIGHT_PINK = 'BLIP_MODIFIER_MP_COLOR_29', + LIGHT_RED = 'BLIP_MODIFIER_MP_COLOR_30', + LIGHT_YELLOW3 = 'BLIP_MODIFIER_MP_COLOR_31', + WHITE = 'BLIP_MODIFIER_MP_COLOR_32' +} diff --git a/fxmanifest.lua b/fxmanifest.lua index 82ded79..0c16441 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -4,20 +4,22 @@ rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aw lua54 'yes' -version '0.1.0' +version '0.2.0' description 'All in one player and NPC medic script' -shared_script { +shared_scripts { 'configs/*.lua', 'locale.lua', 'languages/*.lua' } client_scripts { + 'client/functions.lua', 'client/dataview.lua', 'client/Weapons.lua', 'client/client.lua', + 'client/menu.lua', } server_scripts { diff --git a/languages/en_lang.lua b/languages/en_lang.lua index fa2bfd3..821678e 100644 --- a/languages/en_lang.lua +++ b/languages/en_lang.lua @@ -50,7 +50,7 @@ Locales["en_lang"] = { revived = "You have been revived for $", notenough = "You do not have $", doctoractive = "A Doctor is available, /alert instead", - doctoractive2 = "A Doctor is available, use voice instead", + doctoractive2 = "A Doctor is available, use voice instead", ----------- REMOVE you_do_not_have_job = "You are missing the job needed", cooldown = "Please wait ", Wound = "My Wound: ", diff --git a/server/server.lua b/server/server.lua index d27c1a5..5f9041d 100644 --- a/server/server.lua +++ b/server/server.lua @@ -159,7 +159,8 @@ RegisterNetEvent('bcc-medical:ReviveClosestPlayer', function(reviveItem, closest if count > 0 then exports.vorp_inventory:subItem(_source, reviveItem, 1) - TriggerClientEvent('bcc-medical:Revive', closestPlayer) + --TriggerClientEvent('bcc-medical:Revive', closestPlayer) + TriggerEvent('bcc-medical:RevivePlayer', closestPlayer) if Config.usewebhook then VORPcore.AddWebhook(Config.WebhookTitle, Config.Webhook, _U('Player_Syringe') .. playerName .. _U('Used_Syringe') .. targetName) end @@ -256,18 +257,44 @@ exports.vorp_inventory:registerUsableItem(Config.Stitches, function(data) VORPcore.NotifyRightTip(_source, _U('You_Used') .. stitches, 4000) end) -RegisterNetEvent("vorp_core:Server:OnPlayerRevive",function() +RegisterServerEvent('bcc-medical:RevivePlayer', function(source) + local _source = source + local user = VORPcore.getUser(_source) + if not user then return end + + VORPcore.Player.Revive(_source) +end) + +RegisterServerEvent('bcc-medical:RespawnPlayer', function() + local _source = source + local user = VORPcore.getUser(_source) + if not user then return end + + VORPcore.Player.Respawn(_source) +end) + +local function UpdateBleed(source) + local _source = source + local user = VORPcore.getUser(_source) + if not user then return end + local Char = user.getUsedCharacter + local identifier = Char.identifier + local Charid = Char.charIdentifier + + MySQL.query.await('UPDATE `characters` SET `bleed` = ? WHERE `charidentifier` = ? AND `identifier` = ?', { 0, Charid, identifier }) + if Config.devMode then + print('Stopped Bleding for', GetPlayerName(_source)) + end +end + +AddEventHandler('vorp_core:Server:OnPlayerRevive', function(source) if Config.StopBleedOnRevive then - local _source = source - local user = VORPcore.getUser(_source) - if not user then return end - local Char = user.getUsedCharacter - local identifier = Char.identifier - local Charid = Char.charIdentifier - - MySQL.query.await('UPDATE `characters` SET `bleed` = ? WHERE `charidentifier` = ? AND `identifier` = ?', { 0, Charid, identifier }) - if Config.devMode then - print('Stopped Bleding for',GetPlayerName(_source)) - end + UpdateBleed(source) + end +end) + +AddEventHandler('vorp_core:Server:OnPlayerRespawn', function(source) + if Config.StopBleedOnRespawn then + UpdateBleed(source) end end) diff --git a/version b/version index 3a985ce..d02bf0b 100644 --- a/version +++ b/version @@ -1,2 +1,2 @@ -<0.1.0> +<0.2.0> See GitHub for details!