local car = GetVehiclePedIsIn(GetPlayerPed(-1), false)
if IsVehicleModel(car, GetHashKey("car_model_name",_r)) then
EDITED:
Also guys you can check what seat the player is: if ( GetPedInVehicleSeat( GetVehiclePedIsIn(ped, false ), -1 ) then -- (This will check if it his in the driver seat)
is that script specific to a PED or to a job? I am using skinchanger with the freemode PED, so if it locks out the vehicle to any non-police PED than it wont do what im looking for. I dont mind customizing or modifying as needed to fit what im looking for, i just need a direction to go in
local cops = {
'steam:110000105959047',
--'license:1234975143578921327',
}
function isCop(player)
local allowed = false
for i,id in ipairs(cops) do
for x,pid in ipairs(GetPlayerIdentifiers(player)) do
if string.lower(pid) == string.lower(id) then
allowed = true
end
end
end
return allowed
end
RegisterServerEvent('checkcop')
AddEventHandler('checkcop', function()
local id = source
if isCop(id) then
TriggerClientEvent("setjob", source, 'cop')
else
TriggerClientEvent("setjob", source, 'nocop')
end
end)
Client
local job
AddEventHandler("load", function()
TriggerServerEvent( "checkcop")
end)
RegisterNetEvent('setjob')
AddEventHandler('setjob', function(j)
print('job setted ' .. j)
job = j
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait( 5000 )
if NetworkIsSessionStarted() then
TriggerEvent('load')
return
end
end
end )