mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 18:28:52 +00:00
Add removeSpecialContact + disable gps option
This commit is contained in:
+11
-1
@@ -108,6 +108,16 @@ AddEventHandler('esx_phone:addSpecialContact', function(name, phoneNumber, base6
|
||||
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx_phone:removeSpecialContact')
|
||||
AddEventHandler('esx_phone:removeSpecialContact', function(phoneNumber)
|
||||
|
||||
SendNUIMessage({
|
||||
removeSpecialContact = true,
|
||||
number = phoneNumber
|
||||
})
|
||||
|
||||
end)
|
||||
|
||||
RegisterNUICallback('add_contact', function(data, cb)
|
||||
|
||||
local phoneNumber = tonumber(data.phoneNumber)
|
||||
@@ -167,7 +177,7 @@ AddEventHandler('esx_phone:stopDispatch', function(dispatchRequestId, playerName
|
||||
|
||||
end)
|
||||
|
||||
RegisterNUICallback('setGPS', function(data)
|
||||
RegisterNUICallback('setGPS', function(data)
|
||||
SetNewWaypoint(data.x, data.y)
|
||||
ESX.ShowNotification('Position entrée dans le GPS')
|
||||
end)
|
||||
|
||||
+39
-13
@@ -206,9 +206,9 @@
|
||||
okNumberData : fromNumber,
|
||||
gpsLocationX : (messages[i].job == 'player') ? '' : messages[i].position.x,
|
||||
gpsLocationY : (messages[i].job == 'player') ? '' : messages[i].position.y,
|
||||
activeGPS : (messages[i].job == 'player') ? '' : "active",
|
||||
activeGPS : (messages[i].job == 'player') ? '' : (messages[i].position) ? 'active' : '',
|
||||
jobData : (messages[i].job == 'player') ? '' : messages[i].job,
|
||||
showOK : (messages[i].job == 'player') ? '' : "showOK"
|
||||
showOK : (messages[i].job == 'player') ? '' : 'showOK'
|
||||
}
|
||||
|
||||
let html = Mustache.render(MessageTpl, view);
|
||||
@@ -249,17 +249,40 @@
|
||||
element.scrollTop += 100;
|
||||
}
|
||||
|
||||
window.addSpecialContact = function(name, number, base64Icon){
|
||||
|
||||
specialContacts.push({
|
||||
name : name,
|
||||
number : number,
|
||||
base64Icon: base64Icon
|
||||
});
|
||||
let addSpecialContact = function(name, number, base64Icon){
|
||||
|
||||
let found = false
|
||||
|
||||
specialContacts.sort((a,b) => {
|
||||
return a.name.localeCompare(b.name);
|
||||
});
|
||||
for(let i=0; i<specialContacts.length; i++)
|
||||
if(specialContacts[i].number == number)
|
||||
found = true;
|
||||
|
||||
if(!found){
|
||||
|
||||
specialContacts.push({
|
||||
name : name,
|
||||
number : number,
|
||||
base64Icon: base64Icon
|
||||
});
|
||||
|
||||
specialContacts.sort((a,b) => {
|
||||
return a.name.localeCompare(b.name);
|
||||
});
|
||||
|
||||
renderSpecialContacts();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
let removeSpecialContact = function(number){
|
||||
|
||||
for(let i=0; i<specialContacts.length; i++){
|
||||
if(specialContacts[i].number == number){
|
||||
specialContacts.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
renderSpecialContacts();
|
||||
|
||||
@@ -424,7 +447,10 @@
|
||||
|
||||
if(data.addSpecialContact === true){
|
||||
addSpecialContact(data.name, data.number, data.base64Icon);
|
||||
renderSpecialContacts();
|
||||
}
|
||||
|
||||
if(data.removeSpecialContact === true){
|
||||
removeSpecialContact(data.number);
|
||||
}
|
||||
|
||||
if(data.move && isPhoneShowed){
|
||||
|
||||
Reference in New Issue
Block a user