SHARE
TWEET
Untitled
a guest
Jan 29th, 2018
60
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- function OnPlayerDied(playerId, reasonID, reason)
- local pos = GetEntityCoords(GetPlayerPed(-1))
- local isDocConnected = nil
- TriggerServerEvent('es_em:sv_getDocConnected')
- Citizen.CreateThread(
- function()
- while isDocConnected == nil do
- Citizen.Wait(1)
- RegisterNetEvent('es_em:cl_getDocConnected')
- AddEventHandler('es_em:cl_getDocConnected',
- function(cb)
- isDocConnected = cb
- if isDocConnected then
- SendNotification(txt[lang]['callAmb'])
- end
- end
- )
- end
- end
- )
- SendNotification(txt[lang]['respawn'])
- Citizen.CreateThread(
- function()
- local emergencyCalled = false
- local notifReceivedAt = nil
- while not isRes do
- Citizen.Wait(1)
- if (IsControlJustReleased(1, Keys['E'])) and not emergencyCalled then
- if not isDocConnected then
- ResPlayer()
- else
- notifReceivedAt = GetGameTimer()
- SendNotification(txt[lang]['youCallAmb'])
- TriggerServerEvent('es_em:sendEmergency', reason, GetPlayerServerId(PlayerId()), pos.x, pos.y, pos.z)
- end
- emergencyCalled = true
- elseif (IsControlJustReleased(1, Keys['X'])) then
- ResPlayer()
- end
- if (GetTimeDifference(GetGameTimer(), notifReceivedAt) > 15000) and not emergencyComes and emergencyCalled then
- SendNotification(txt[lang]['callAmb'])
- emergencyCalled = false
- end
- end
- isDocConnected = nil
- isRes = false
- emergencyComes = false
- end)
- end
RAW Paste Data

