[ESX] Mobile Data Terminal | Reports, warrants, calls, searches & more

so, i have this code in

RegisterServerEvent(‘gcPhone:sendMessage’)
AddEventHandler(‘gcPhone:sendMessage’, function(phoneNumber, message)
local sourcePlayer = tonumber(source)
local identifier = getPlayerID(sourcePlayer)
addMessage(sourcePlayer, identifier, phoneNumber, message)
-------------------MDT POLICE CALLS-----------------------------------------------------
local ItWasHuman = GetPlayerPed(sourcePlayer)
local IseeHim = GetEntityCoords(ItWasHuman)
local JesusChrist = ESX.GetPlayerFromId(sourcePlayer)
local OMG = JesusChrist.getName(sourcePlayer)

if phoneNumber == ‘police’ then
TriggerEvent(“mdt:newCall”, message, OMG, vector3(IseeHim.x, IseeHim.y, IseeHim.z))
end

end)

how ever it still doesnt work at all, can someone help? ive tried alot of things

i use this and is not work by correct coords this send the 0 0 0 coords

Why are you taking apart the GetEntityCoords? It’s returned as a vector3.

1 Like
TriggerEvent("mdt:newCall", message, OMG, IseeHim)

when i use this is the same effect for correct coords this send the 0 0 0 coords

Does anyone else have the issue of when you are creating a new report and have selected the suspect name, it then fails to load the charges to select? This issue happens 50% of the time for some people causing us to restart the script. We get no errors on F8 or CMD, its obviously pulling the correct stuff from the database as it works 50% of the time, what am i missing?

1 Like

same i got it to work the calls that is but it still sends the location to 0 0 0

do u know why it sends the coords of the call to the default location?

try adding this to your client file (if you use esx)

RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function()
	TriggerServerEvent("mdt:getOffensesAndOfficer")
end)

I don’t remember if I modified the server stuff, please note that this uses some of the stuff we added to ESX and you’ll have to change it to work on your server.

RegisterServerEvent("mdt:getOffensesAndOfficer")
AddEventHandler("mdt:getOffensesAndOfficer", function()
	local ply = ESX.GetPlayerFromId(source)
	if ply then
		local charges = {}
		MySQL.Async.fetchAll('SELECT * FROM fine_types', {
		}, function(fines)
			for j = 1, #fines do
				if fines[j].category == 0 or fines[j].category == 1 or fines[j].category == 2 or fines[j].category == 3 then
					table.insert(charges, fines[j])
				end
			end

			TriggerClientEvent("mdt:returnOffensesAndOfficer", ply.source, charges, ply.getPlayerName())
		end)
	end
end)

I have some problems with the css/html… i just downloaded it and it went like to this? https://gyazo.com/cc2ecd3a41cb6f5fd690d5ba9256813c

Is it possible to add search phone number option? Cuz right now we can search someone to get their phone number but what if we can just search phone numbers to get the owner’s info? Or perhaps we can search numbers in “Search Persons” section.

Don’t see why you couldn’t.

Tried before post this. I should did okay on lua part but still not working. So I think probably I did wrong on JS.

In sv_mdt.lua, find RegisterServerEvent(“mdt:performOffenderSearch”). Change the MySQL query to

"SELECT * FROM `characters` WHERE LOWER(`firstname`) LIKE @query OR LOWER(`lastname`) LIKE @query OR CONCAT(LOWER(`firstname`), ' ', LOWER(`lastname`)) LIKE @query OR `phone_number` LIKE @query"

Ensure phone_number is stored in the characters table.

1 Like

It solved! I just changed the characters table to users since there’s no phone_number in my character table. I’m just feel bad that I was going the wrong way since beginning. Thanks alot Linden! :smiling_face_with_three_hearts:

Do you use GCPhone v3, because i can’t even get the callinside my mdt

How can I make the vehicle license plates show up in this MDT?

For the new Gcphone Re-Ignited:

RegisterServerEvent(‘gcPhone:sendMessage’)
AddEventHandler(‘gcPhone:sendMessage’, function(phoneNumber, message, gpsData)
local _source = source
local sourcePlayer = tonumber(_source)
local ped = GetPlayerPed(source)
local IseeHim = GetEntityCoords(ped)
local mePhoneNumber = getNumberPhone(identifier)
xPlayer = ESX.GetPlayerFromId(_source)
identifier = xPlayer.identifier
addMessage(sourcePlayer, identifier, phoneNumber, message, gpsData)
TriggerEvent(“mdt:newCall”, message, mePhoneNumber, vector3(IseeHim.x, IseeHim.y, IseeHim.z))
end)

Everything works perfectly fine, having issues with fetching the location when someone triggers the mdt call event. like previous comments, defaulting to 0 0 0

Untitled
Probably because you are not on oneysnc.

Here you go buddy. FiveM native reference

Any Fix?