Yep, That did the trick, worked as intended
Alright, awesome!
Sorry about that, guess I never tested using the hospital without any actual limb damage.
Its all good, Appreciate the quick fix, great release!
Anyone have a .sql file for this working with esx?
Hmm script works fine for me but when i start adding in for ESX that’s when everything fails and it’s back to the old problem not getting a heal, stuck in birds eye, etc.
I mean, i kinda want it to work for ESX so that being treated at the hospital costs a little
If you’re not getting healed & camera doesn’t get destroyed, you’re not making it to the TriggerClientEvent(‘mythic_hospital:client:FinishServices’, src) call in server/main.lua.
As for adding ESX stuff to it, honestly no idea. I’ve not touched ESX. Best suggestion would be pull up another resource that bills player using ESX and see how they’re doing it.
No, i’m getting healed and everythings fine when i put it in as it is in the folder when i downloaded it.
Only time it’s failing are if i try adding it to ESX, but without ESX it’s fine
local playerInjury = {}
ESX = nil
TriggerEvent(‘esx:getSharedObject’, function(obj) ESX = obj end)
function GetCharsInjuries(source)
return playerInjury[source]
end
RegisterServerEvent(‘mythic_hospital:server:SyncInjuries’)
AddEventHandler(‘mythic_hospital:server:SyncInjuries’, function(data)
local src = source
playerInjury[src] = data
end)
What error are you getting?
Bleh, woops.
In server/main.lua on line 66 change
local totalBill = totalBill
to
local totalBill = injuryBasePrice
Sorry, dumb tired mistakes
thank you
Seems like bleeding is not working after relogging. Is there anyway to fix this? im using ESX
Added this for payment.
RegisterServerEvent('mythic_hospital:server:EnteredBed')
AddEventHandler('mythic_hospital:server:EnteredBed', function()
local src = source
local injuries = GetCharsInjuries(src)
local xPlayer = ESX.GetPlayerFromId(src)
local totalBill = injuryBasePrice
if injuries ~= nil then
for k, v in pairs(injuries.limbs) do
if v.isDamaged then
totalBill = totalBill + (injuryBasePrice * v.severity)
end
end
if injuries.isBleeding > 0 then
totalBill = totalBill + (injuryBasePrice * injuries.isBleeding)
end
end
xPlayer.removeMoney(totalBill)
TriggerClientEvent('mythic_hospital:client:FinishServices', src)
end)
you have a way to remove the items from inventory after use?
error on xPlayer.removeMoney(totalBill)
Error running system event handling function for resource mythic_hospital: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: @mythic_hospital/server/main.lua:65: attempt to index a nil value (global 'ESX')
stack traceback:
@mythic_hospital/server/main.lua:65: in upvalue 'handler'
citizen:/scripting/lua/scheduler.lua:219: in function <citizen:/scripting/lua/scheduler.lua:218>
stack traceback:
[C]: in function 'error'
citizen:/scripting/lua/scheduler.lua:41: in field 'CreateThreadNow'
citizen:/scripting/lua/scheduler.lua:218: in function <citizen:/scripting/lua/scheduler.lua:182>
can you show me your lines for that function
Very nice script ! Could you help a little bit more with a snippet that would allow to get the current injuries/bleeding state of a target so medics could receive this information server-side ?
is line
RegisterServerEvent('mythic_hospital:server:EnteredBed')
AddEventHandler('mythic_hospital:server:EnteredBed', function()
local src = source
local injuries = GetCharsInjuries(src)
local xPlayer = ESX.GetPlayerFromId(src)
local totalBill = injuryBasePrice
if injuries ~= nil then
for k, v in pairs(injuries.limbs) do
if v.isDamaged then
totalBill = totalBill + (injuryBasePrice * v.severity)
end
end
if injuries.isBleeding > 0 then
totalBill = totalBill + (injuryBasePrice * injuries.isBleeding)
end
end
xPlayer.removeMoney(totalBill)
TriggerClientEvent('mythic_hospital:client:FinishServices', src)
end)
thanks to help
did you grab the latest update and add the esx changes above? what does your server/wound.lua file look like?
Getting same error as you are @KOI-ANIME_Website_An
same question as above.