Is there a way to send an alert if your are driving without a license?
Need help with this too… I know there’s one in esx snippets but not sure how to implement that… not to mention nodrivecopcar civilian…
Your overthinking things. Its a client side loop. So place it client side in a script… Lets say esx_policejob. And for driving without a license, place it in the dmv resource and use missiontext. Simple.
First of all thanks for the replies
Second im a little noob in .lua do you know any script that i can use on dmv for all the civilians without a license?
This should work, I used to use this, if there is an update to DMV school, just update the code from it.
esx_dmvschool.zip (113.0 KB)
Later ill check if this is the same dmv mod that i have if not ill replace it thanks
You just need a script that checks if they have the right licenses in your database, if not then draw the text
"You are driving without a license"
Thanks for your reply! There’s an issue I noticed… weapon licenses and dmv licenses disappear whem I die. I’m pretty positive it’s because of esx_ambulancejob… any ideas? I managed to make it let me keep my guns but after I relog they are gone anyway. It used to be when one goes to hospital they would lose weapons and items right away. However, I hated that and sort of disabled it… it still removes weapons and items but only when you respawn at hospital and then relog. Any idea to completely prevent that from happening? Removing that part of code completely from server.lua and client.lua just breaks it…
I was having the exact same problem in my server, so i simple created a extra line in esx_ambulancejob, in the line “Config.RemoveItemsAfterRPDeath” checking if the player have the licenses (by mysql, cause when you buy the licenses they are store in the databse in the table user_licenses) if the player have the license, simple give it to the player…
or check te inventory, but i dont think this is the best away
if Config.RemoveItemsAfterRPDeath then
for i=1, #xPlayer.inventory, 1 do
if xPlayer.inventory[i].count > 0 then
xPlayer.setInventoryItem(xPlayer.inventory[i].name, 0)
end
end
local identifier = GetPlayerIdentifiers(source)[1]
MySQL.Async.fetchAll('SELECT * FROM user_licenses WHERE owner=@id',
{
['@id'] = identifier
},
function(gotInfo)
for i=1, #gotInfo, 1 do
if gotInfo[i].owner == GetPlayerIdentifiers(source)[1] then
if gotInfo[i].type == 'dmv' then
xPlayer.addInventoryItem('dmv', 1)
end
if gotInfo[i].type == 'drive' then
xPlayer.addInventoryItem('drive', 1)
end
if gotInfo[i].type == 'drive_truck' then
xPlayer.addInventoryItem('drive_truck', 1)
end
if gotInfo[i].type == 'drive_bike' then
xPlayer.addInventoryItem('drive_bike', 1)
end
if gotInfo[i].type == 'weapon' then
xPlayer.addInventoryItem('weapon', 1)
end
end
end
end)
end
Any idea how to make this to let the police drive police vehicles? Because right now it doesn’t let the police drive the police vehicles and it let’s the civilians drive police vehicles… the opposite of what I want.
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsPedInAnyPoliceVehicle(GetPlayerPed(PlayerId())) then
local veh = GetVehiclePedIsUsing(GetPlayerPed(PlayerId()), false)
if (GetPedInVehicleSeat(veh, -1) == GetPlayerPed(PlayerId())) then
if (PlayerData.job ~= nil and (PlayerData.job.name ~= 'police' or PlayerData.job.name ~= 'ambulance')) then
ESX.ShowNotification("Une voiture de police n'est pas réservée aux civils..")
SetVehicleUndriveable(veh, true)
end
end
end
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsPedInAnyPoliceVehicle(GetPlayerPed(PlayerId())) then
local veh = GetVehiclePedIsUsing(GetPlayerPed(PlayerId()), false)
if (GetPedInVehicleSeat(veh, -1) == GetPlayerPed(PlayerId())) then
if PlayerData.job ~= nil and (PlayerData.job.name ~= 'police' or PlayerData.job.name ~= 'ambulance') then
ESX.ShowNotification("Une voiture de police n'est pas réservée aux civils..")
SetVehicleUndriveable(veh, true)
end
end
end
end
end)
Working like this @RalfTech , tested in my server!
@Cheleber Doesn’t work… I can’t use police vehicles even-though I am a cop. Yet normal people can drive police vehicles. The opposite of what I want. Can you add to paste-bin your police script? Maybe I placed it in the wrong section…?