Try fix messages not sending + add phone animation

This commit is contained in:
Jérémie N'gadi
2017-09-13 14:52:49 +02:00
parent 68477e141f
commit 8faec4d095
2 changed files with 32 additions and 45 deletions
+12 -2
View File
@@ -38,6 +38,8 @@ end)
function OpenPhone()
local playerPed = GetPlayerPed(-1)
TriggerServerEvent('esx_phone:reload', PhoneData.phoneNumber)
SendNUIMessage({
@@ -51,10 +53,16 @@ function OpenPhone()
SetNuiFocus(true, true)
end)
if not IsPedInAnyVehicle(playerPed, false) then
TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_STAND_MOBILE", 0, true);
end
end
function ClosePhone()
local playerPed = GetPlayerPed(-1)
SendNUIMessage({
showPhone = false
})
@@ -63,6 +71,8 @@ function ClosePhone()
GUI.PhoneIsShowed = false
ClearPedTasks(playerPed)
end
RegisterNetEvent('esx_phone:loaded')
@@ -136,9 +146,9 @@ RegisterNetEvent('esx_phone:onMessage')
AddEventHandler('esx_phone:onMessage', function(phoneNumber, message, position, anon, job, dispatchRequestId)
if job == 'player' then
ESX.ShowNotification(_U('new_message', message))
ESX.ShowNotification(_U('new_message', message))
else
ESX.ShowNotification('~b~' .. job .. ': ~s~' .. message)
ESX.ShowNotification('~b~' .. job .. ': ~s~' .. message)
end
SendNUIMessage({