mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 17:58:54 +00:00
Fixed player revive notification showing Steam name, and check if online
This commit is contained in:
+33
-42
@@ -62,48 +62,7 @@ function OpenMobileAmbulanceActionsMenu()
|
||||
else
|
||||
|
||||
if data.current.value == 'revive' then
|
||||
|
||||
isBusy = true
|
||||
|
||||
ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity)
|
||||
if quantity > 0 then
|
||||
local closestPlayerPed = GetPlayerPed(closestPlayer)
|
||||
|
||||
if IsPedDeadOrDying(closestPlayerPed, 1) then
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
ESX.ShowNotification(_U('revive_inprogress'))
|
||||
|
||||
local lib, anim = 'mini@cpr@char_a@cpr_str', 'cpr_pumpchest'
|
||||
|
||||
for i=1, 15, 1 do
|
||||
Citizen.Wait(900)
|
||||
|
||||
ESX.Streaming.RequestAnimDict(lib, function()
|
||||
TaskPlayAnim(PlayerPedId(), lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false)
|
||||
end)
|
||||
end
|
||||
|
||||
TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit')
|
||||
TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer))
|
||||
|
||||
-- Show revive award?
|
||||
if Config.ReviveReward > 0 then
|
||||
ESX.ShowNotification(_U('revive_complete_award', GetPlayerName(closestPlayer), Config.ReviveReward))
|
||||
else
|
||||
ESX.ShowNotification(_U('revive_complete', GetPlayerName(closestPlayer)))
|
||||
end
|
||||
else
|
||||
ESX.ShowNotification(_U('player_not_unconscious'))
|
||||
end
|
||||
else
|
||||
ESX.ShowNotification(_U('not_enough_medikit'))
|
||||
end
|
||||
|
||||
isBusy = false
|
||||
|
||||
end, 'medikit')
|
||||
|
||||
revivePlayer(closestPlayer)
|
||||
elseif data.current.value == 'small' then
|
||||
|
||||
ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity)
|
||||
@@ -174,6 +133,38 @@ function OpenMobileAmbulanceActionsMenu()
|
||||
end)
|
||||
end
|
||||
|
||||
function revivePlayer(closestPlayer)
|
||||
isBusy = true
|
||||
|
||||
ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity)
|
||||
if quantity > 0 then
|
||||
local closestPlayerPed = GetPlayerPed(closestPlayer)
|
||||
|
||||
if IsPedDeadOrDying(closestPlayerPed, 1) then
|
||||
local playerPed = PlayerPedId()
|
||||
local lib, anim = 'mini@cpr@char_a@cpr_str', 'cpr_pumpchest'
|
||||
ESX.ShowNotification(_U('revive_inprogress'))
|
||||
|
||||
for i=1, 15 do
|
||||
Citizen.Wait(900)
|
||||
|
||||
ESX.Streaming.RequestAnimDict(lib, function()
|
||||
TaskPlayAnim(playerPed, lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false)
|
||||
end)
|
||||
end
|
||||
|
||||
TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit')
|
||||
TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer))
|
||||
else
|
||||
ESX.ShowNotification(_U('player_not_unconscious'))
|
||||
end
|
||||
else
|
||||
ESX.ShowNotification(_U('not_enough_medikit'))
|
||||
end
|
||||
isBusy = false
|
||||
end, 'medikit')
|
||||
end
|
||||
|
||||
function FastTravel(coords, heading)
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ Locales['br'] = {
|
||||
['revive_inprogress'] = 'Reanimação em andamento',
|
||||
['revive_complete'] = 'você ressuscitou ~y~%s~s~',
|
||||
['revive_complete_award'] = 'você ressuscitou ~y~%s~s~, ~g~$%s~s~',
|
||||
['revive_fail_offline'] = 'that player is no longer online',
|
||||
['heal_inprogress'] = 'you are healing!',
|
||||
['heal_complete'] = 'you have healed ~y~%s~s~',
|
||||
['no_players'] = 'Nenhum jogador nas proximidades',
|
||||
|
||||
@@ -39,6 +39,7 @@ Locales['cs'] = {
|
||||
['revive_inprogress'] = 'probíhá oživení!',
|
||||
['revive_complete'] = 'oživili jste ~y~%s~s~',
|
||||
['revive_complete_award'] = 'oživili jste ~y~%s~s~ a dostali jste ~g~$%s~s~!',
|
||||
['revive_fail_offline'] = 'that player is no longer online',
|
||||
['heal_inprogress'] = 'uzdravujete!',
|
||||
['heal_complete'] = 'uzdravili jste ~y~%s~s~',
|
||||
['no_players'] = 'v okolí není žádný hráč!',
|
||||
|
||||
@@ -39,6 +39,7 @@ Locales['en'] = {
|
||||
['revive_inprogress'] = 'a revive is in progress!',
|
||||
['revive_complete'] = 'you have revived ~y~%s~s~',
|
||||
['revive_complete_award'] = 'you have revived ~y~%s~s~ and earned ~g~$%s~s~!',
|
||||
['revive_fail_offline'] = 'that player is no longer online',
|
||||
['heal_inprogress'] = 'you are healing!',
|
||||
['heal_complete'] = 'you have healed ~y~%s~s~',
|
||||
['no_players'] = 'no players nearby',
|
||||
|
||||
@@ -39,6 +39,7 @@ Locales['es'] = {
|
||||
['revive_inprogress'] = 'reanimación en curso',
|
||||
['revive_complete'] = 'has sido reanimado ~y~%s~s~',
|
||||
['revive_complete_award'] = 'has sido reanimado ~y~%s~s~, ~g~$%s~s~',
|
||||
['revive_fail_offline'] = 'that player is no longer online',
|
||||
['heal_inprogress'] = 'you are healing!',
|
||||
['heal_complete'] = 'you have healed ~y~%s~s~',
|
||||
['no_players'] = 'ningún jugador cerca',
|
||||
|
||||
+4
-3
@@ -1,8 +1,8 @@
|
||||
Locales['fi'] = {
|
||||
-- Cloakroom
|
||||
['cloakroom'] = 'Vaatelokero',
|
||||
['ems_clothes_civil'] = 'Siviilikamppeet',
|
||||
['ems_clothes_ems'] = 'Työkamppeet',
|
||||
['cloakroom'] = 'vaatelokero',
|
||||
['ems_clothes_civil'] = 'siviilikamppeet',
|
||||
['ems_clothes_ems'] = 'työkamppeet',
|
||||
-- Vehicles
|
||||
['ambulance'] = 'ambulance',
|
||||
['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.',
|
||||
@@ -39,6 +39,7 @@ Locales['fi'] = {
|
||||
['revive_inprogress'] = 'elvytys on menossa!',
|
||||
['revive_complete'] = 'sinä elvytit henkilön ~y~%s~s~',
|
||||
['revive_complete_award'] = 'sinä elvytit henkilön ~y~%s~s~ ja tienasit ~g~$%s~s~!',
|
||||
['revive_fail_offline'] = 'that player is no longer online',
|
||||
['heal_inprogress'] = 'sinä olet parantamassa!',
|
||||
['heal_complete'] = 'sinä paransit henkilön ~y~%s~s~',
|
||||
['no_players'] = 'ei pelaajia lähettyvillä',
|
||||
|
||||
+4
-3
@@ -1,8 +1,8 @@
|
||||
Locales['fr'] = {
|
||||
-- Cloakroom
|
||||
['cloakroom'] = 'Vestiaire',
|
||||
['ems_clothes_civil'] = 'Tenue Civil',
|
||||
['ems_clothes_ems'] = 'Tenue Ambulancier',
|
||||
['cloakroom'] = 'vestiaire',
|
||||
['ems_clothes_civil'] = 'tenue Civil',
|
||||
['ems_clothes_ems'] = 'tenue Ambulancier',
|
||||
-- Vehicles
|
||||
['ambulance'] = 'ambulance',
|
||||
['helicopter_prompt'] = 'appuyez sur ~INPUT_CONTEXT~ pour accéder aux ~y~Actions de l\'hélicoptère~s~.',
|
||||
@@ -39,6 +39,7 @@ Locales['fr'] = {
|
||||
['revive_inprogress'] = 'réanimation en cours',
|
||||
['revive_complete'] = 'vous avez réanimé ~y~%s~s~',
|
||||
['revive_complete_award'] = 'vous avez réanimé ~y~%s~s~, ~g~$%s~s~',
|
||||
['revive_fail_offline'] = 'that player is no longer online',
|
||||
['heal_inprogress'] = 'vous soignez...',
|
||||
['heal_complete'] = 'vous avez soigné ~y~%s~s~',
|
||||
['no_players'] = 'aucun joueur à proximité',
|
||||
|
||||
@@ -39,6 +39,7 @@ Locales['pl'] = {
|
||||
['revive_inprogress'] = 'trwa wskrzeszenie',
|
||||
['revive_complete'] = 'zostałeś wskrzeszony ~y~%s~s~',
|
||||
['revive_complete_award'] = 'zostałeś wskrzeszony ~y~%s~s~ i zarobiono ~g~$%s~s~!',
|
||||
['revive_fail_offline'] = 'that player is no longer online',
|
||||
['heal_inprogress'] = 'leczysz!',
|
||||
['heal_complete'] = 'zostałeś uleczony ~y~%s~s~',
|
||||
['no_players'] = 'brak graczy w pobliżu',
|
||||
|
||||
@@ -39,6 +39,7 @@ Locales['sv'] = {
|
||||
['revive_inprogress'] = 'en återupplivning har börjats',
|
||||
['revive_complete'] = 'du har återupplivat ~y~%s~s~, bra jobbat!',
|
||||
['revive_complete_award'] = 'du har återupplivat ~y~%s~s~ och tjärnat ~g~%s SEK~s~ för dina tjänster, bra jobbat!',
|
||||
['revive_fail_offline'] = 'den spelaren har lämnat servern',
|
||||
['heal_inprogress'] = 'du behandlar patienten!',
|
||||
['heal_complete'] = 'du har behandlat ~y~%s~s~',
|
||||
['no_players'] = 'det finns inga spelare i närheten!',
|
||||
|
||||
+18
-11
@@ -3,17 +3,24 @@ local playersHealing = {}
|
||||
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
|
||||
RegisterServerEvent('esx_ambulancejob:revive')
|
||||
AddEventHandler('esx_ambulancejob:revive', function(target)
|
||||
RegisterNetEvent('esx_ambulancejob:revive')
|
||||
AddEventHandler('esx_ambulancejob:revive', function(playerId)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
if xPlayer.job.name == 'ambulance' then
|
||||
xPlayer.addMoney(Config.ReviveReward)
|
||||
TriggerClientEvent('esx_ambulancejob:revive', target)
|
||||
if xPlayer and xPlayer.job.name == 'ambulance' then
|
||||
local xTarget = ESX.GetPlayerFromId(playerId)
|
||||
|
||||
if xTarget then
|
||||
xPlayer.showNotification(_U('revive_complete_award', xTarget.name, Config.ReviveReward))
|
||||
xPlayer.addMoney(Config.ReviveReward)
|
||||
xTarget.triggerEvent('esx_ambulancejob:revive')
|
||||
else
|
||||
xPlayer.showNotification(_U('revive_fail_offline'))
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_ambulancejob:heal')
|
||||
RegisterNetEvent('esx_ambulancejob:heal')
|
||||
AddEventHandler('esx_ambulancejob:heal', function(target, type)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
@@ -22,7 +29,7 @@ AddEventHandler('esx_ambulancejob:heal', function(target, type)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_ambulancejob:putInVehicle')
|
||||
RegisterNetEvent('esx_ambulancejob:putInVehicle')
|
||||
AddEventHandler('esx_ambulancejob:putInVehicle', function(target)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
@@ -88,7 +95,7 @@ if Config.EarlyRespawnFine then
|
||||
cb(bankBalance >= Config.EarlyRespawnFineAmount)
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_ambulancejob:payFine')
|
||||
RegisterNetEvent('esx_ambulancejob:payFine')
|
||||
AddEventHandler('esx_ambulancejob:payFine', function()
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
local fineAmount = Config.EarlyRespawnFineAmount
|
||||
@@ -188,7 +195,7 @@ function getPriceFromHash(hashKey, jobGrade, type)
|
||||
return 0
|
||||
end
|
||||
|
||||
RegisterServerEvent('esx_ambulancejob:removeItem')
|
||||
RegisterNetEvent('esx_ambulancejob:removeItem')
|
||||
AddEventHandler('esx_ambulancejob:removeItem', function(item)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
xPlayer.removeInventoryItem(item, 1)
|
||||
@@ -200,7 +207,7 @@ AddEventHandler('esx_ambulancejob:removeItem', function(item)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_ambulancejob:giveItem')
|
||||
RegisterNetEvent('esx_ambulancejob:giveItem')
|
||||
AddEventHandler('esx_ambulancejob:giveItem', function(itemName, amount)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
@@ -274,7 +281,7 @@ ESX.RegisterServerCallback('esx_ambulancejob:getDeathStatus', function(source, c
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_ambulancejob:setDeathStatus')
|
||||
RegisterNetEvent('esx_ambulancejob:setDeathStatus')
|
||||
AddEventHandler('esx_ambulancejob:setDeathStatus', function(isDead)
|
||||
local identifier = GetPlayerIdentifiers(source)[1]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user