Hello, If You Find Any problem Regarding This Script Feel Free To Contact in Post
This is Optimized Script With Multiple Combinations Of Codes. Best Alternative
Automaticly Injured When Fell From height Or Have Less Health Then You Must Have To Go To The Hospital For Checkin. With Check-in Health And Injures Can Also Restores. Dead Player Can Also Revives Himself From Here. No Need To Run Extra Scripts. New Check-in System
Config
Easy To Config
You Can Find Many Options in Config.lua
Citizen.CreateThread(function()
while true do
Wait(5)
if GetEntityHealth(GetPlayerPed(-1)) <= 160 then
exports[‘mythic_notify’]:DoHudText(‘error’, ‘You Are Injured, Go To The Hospital’)
setHurt()
elseif GetEntityHealth(GetPlayerPed(-1)) > 161 then
setNotHurt()
end
end
end)
function setHurt()
RequestAnimSet(“move_m@injured”)
SetPedMovementClipset(GetPlayerPed(-1), “move_m@injured”, true)
end
function setNotHurt()
ResetPedMovementClipset(GetPlayerPed(-1))
ResetPedWeaponMovementClipset(GetPlayerPed(-1))
ResetPedStrafeClipset(GetPlayerPed(-1))
end
Replace This Code With Current One in Cleint.lua at line 171
if you want the money go to ems society every time a player uses npc to be revive or heal add this
server.lua add this
if Config.GiveSocietyMoney then
TriggerEvent(‘esx_addonaccount:getSharedAccount’, Config.Society, function(account)
account.addMoney(Config.doctorPrice)
end)
end
end)
I did this without testing anything, if it works you can push it to the release if you want to
server.lua
RegisterServerEvent('draco-custom:money')
AddEventHandler('draco-custom:money', function()
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local price = Config.doctorPrice
local cash = xPlayer.getMoney() -- Get player money in cash
local bank = xPlayer.getAccount('bank').money -- Get player bank balance
if cash < price then
xPlayer.removeAccountMoney('bank', Config.doctorPrice) -- Remove money from bank
TriggerEvent('esx_addonaccount:getSharedAccount', 'society_'..Config.Society, function(account) -- If you don't want to give society money just delete lines 34 and 35
account.addMoney(Config.doctorPrice / math.random(5))
TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'success', text = '$'.. Config.doctorPrice ..' Money Detucted from your bank account'}) -- Alert
end)
elseif cash > price then
xPlayer.removeMoney(Config.doctorPrice) -- Remove money from cash account
TriggerEvent('esx_addonaccount:getSharedAccount', 'society_'..Config.Society, function(account) -- If you don't want to give society money just delete lines 40 and 41
account.addMoney(Config.doctorPrice / math.random(5))
TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'success', text = '$'.. Config.doctorPrice ..' Money Detucted from your cash account'}) -- Alert
end)
if cash and bank < price then
TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'success', text = 'You don\' have enough money for this!'}) -- You don't have enough money for this alert
end
end
end)
So I put this into my server. The doctor appears and I am able interact but the problem I am having is that I get charged but I am not Healed or Revived. Any help would be much appreciated