Skip to content

Commit

Permalink
Update v1.5.1
Browse files Browse the repository at this point in the history
* Some Bugfixes
  • Loading branch information
Musiker15 committed May 27, 2024
1 parent 2c24ca9 commit 8779559
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 45 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,20 @@
* Fee for reviving
* Discord Logs
* Support for visn_are
* Support for osp_ambulance

## Important
* Please remove the dependencies that you **don't** use in `fxmanifest.lua`!

## Requirements
* [ESX Legacy](https://github.com/esx-framework/esx_core)
* [esx_addonaccount](https://github.com/esx-framework/esx_addonaccount) - *(This is optional)*
* [esx_ambulancejob](https://github.com/esx-framework/esx_ambulancejob) - *(not needed if you use visn_are)*

## Optional Requirements
You'll need one of the Scripts below
* [esx_ambulancejob](https://github.com/esx-framework/esx_ambulancejob) - *(not needed if you use visn_are or osp_ambulance)*
* [visn_are](https://store.veryinsanee.space/package/5215195) - *(This is optional)*
* [osp_ambulance](https://osp-development.tebex.io/package/6010694) - *(This is optional)*

## My other Scripts
### Paid
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4
1.5.1
58 changes: 18 additions & 40 deletions client.lua
Original file line number Diff line number Diff line change
@@ -1,47 +1,12 @@
local isDead, OnlineMedics, medicCalled, medicOnRoad, triedToRevive, wasRevived = false, 5, false, false, false, false
local taskVehicle, taskNPC, taskBlip = nil, nil, nil

if Config.VisnAre then
local visn_f = exports["visn_are"]:GetSharedFunctions()

visn_f.HookEventHandler('OnUnconsciousStateChanged', function(newState)
if newState then -- Player is Dead
isDead = true
triedToRevive = false
else -- Player was revived
isDead = false
medicCalled = false
medicOnRoad = false

if wasRevived then
wasRevived = false
TriggerServerEvent('msk_aimedic:removeMoney')
end

leaveTarget()
end
end)
else
AddEventHandler('esx:onPlayerDeath', function(data)
isDead = true
triedToRevive = false
end)

AddEventHandler('esx:onPlayerSpawn', function()
isDead = false
medicCalled = false
medicOnRoad = false

if wasRevived then
wasRevived = false
TriggerServerEvent('msk_aimedic:removeMoney')
end

leaveTarget()
end)
end
AddEventHandler('esx:onPlayerDeath', function(data)
isDead = true
triedToRevive = false
end)

--[[ AddEventHandler('playerSpawned', function()
--[[ AddEventHandler('esx:onPlayerSpawn', function()
isDead = false
medicCalled = false
medicOnRoad = false
Expand All @@ -54,6 +19,19 @@ end
leaveTarget()
end) ]]

AddEventHandler('playerSpawned', function()
isDead = false
medicCalled = false
medicOnRoad = false

if wasRevived then
wasRevived = false
TriggerServerEvent('msk_aimedic:removeMoney')
end

leaveTarget()
end)

RegisterNetEvent('msk_aimedic:refreshMedics')
AddEventHandler('msk_aimedic:refreshMedics', function(medics)
OnlineMedics = medics
Expand Down
5 changes: 4 additions & 1 deletion config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Config.Society = {
}
----------------------------------------------------------------
Config.VisnAre = GetResourceState("visn_are") ~= "missing"
Config.OSPAmbulance = GetResourceState("osp_ambulance") ~= "missing"
----------------------------------------------------------------
Config.Jobs = {
amount = 0,
Expand All @@ -47,12 +48,14 @@ Config.Medic = {
}
----------------------------------------------------------------
Config.ProgressBar = function()
exports.msk_core:ProgressStart(10000, 'Du wirst nun wiederbelebt...')
exports.msk_core:ProgressStart(Config.ReviveDuration * 1000, 'Du wirst nun wiederbelebt...')
end

Config.ReviveTrigger = function()
if Config.VisnAre then
TriggerEvent('visn_are:resetHealthBuffer')
elseif Config.OSPAmbulance then
TriggerEvent('hospital:client:Revive')
else
TriggerEvent('esx_ambulancejob:revive')
end
Expand Down
4 changes: 2 additions & 2 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ games { 'gta5' }
author 'Musiker15 - MSK Scripts'
name 'msk_aimedic'
description 'AI Medic NPC'
version '1.4'
version '1.5.1'

lua54 'yes'

Expand All @@ -23,5 +23,5 @@ server_scripts {
}

dependencies {
'es_extended'
'es_extended',
}

0 comments on commit 8779559

Please sign in to comment.