yep still no luck.
(20 chars)
yep still no luck.
(20 chars)
Cant get it to work?
Remove the copnotification on the server
TriggerClientEvent("setjob", source, 'nocop')
TriggerClientEvent('notCopNotification', source) -- REMOVE THIS
You dont see the group setted print in the console, when you join the server?
EDIT:
I cant test it right now, just tomorow, but i think everything is fine, dont forget the __resource.lua
Try another thing:
if job ~= 'cop'
See if you dont mistake the stemid, it should be working, tomorow i wil test it
Remove the license, use just the steamid
I’ve figured it out, now I just need to set it so, it only happens if they are in the driver seat. Because it kicks them out of the back seat.
I’m using this but it lets them enter any seat.
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local ped = GetPlayerPed(-1)
if job ~= 'cop' then
if IsPedInAnyVehicle(ped) then
local car = GetVehiclePedIsIn(GetPlayerPed(-1), false)
if IsVehicleModel(car, GetHashKey("police",_r)) or IsVehicleModel(car, GetHashKey("police2",_r)) or IsVehicleModel(car, GetHashKey("police3",_r)) or IsVehicleModel(car, GetHashKey("police4",_r)) or IsVehicleModel(car, GetHashKey("sheriff",_r)) or IsVehicleModel(car, GetHashKey("sheriff2",_r)) or IsVehicleModel(car, GetHashKey("polmav",_r)) or IsVehicleModel(car, GetHashKey("policeb",_r)) or IsVehicleModel(car, GetHashKey("hwaycar",_r)) or IsVehicleModel(car, GetHashKey("hwaycar1",_r)) or IsVehicleModel(car, GetHashKey("hwaycar2",_r)) or IsVehicleModel(car, GetHashKey("hwaycar3",_r)) or IsVehicleModel(car, GetHashKey("hwaycar4",_r)) or IsVehicleModel(car, GetHashKey("hwaycar4",_r)) or IsVehicleModel(car, GetHashKey("hwaycar6",_r)) or IsVehicleModel(car, GetHashKey("hwaycar7",_r)) or IsVehicleModel(car, GetHashKey("hwaycar8",_r)) or IsVehicleModel(car, GetHashKey("hwaycar9",_r)) or IsVehicleModel(car, GetHashKey("hwaycar10",_r)) or IsVehicleModel(car, GetHashKey("chiron",_r)) or IsVehicleModel(car, GetHashKey("aventador",_r)) or IsVehicleModel(car, GetHashKey("fbi",_r)) or IsVehicleModel(car, GetHashKey("fbi2",_r)) or IsVehicleModel(car, GetHashKey("sfbc1",_r)) or IsVehicleModel(car, GetHashKey("sfbc2",_r)) or IsVehicleModel(car, GetHashKey("sfbc3",_r)) or IsVehicleModel(car, GetHashKey("sfbc4",_r)) or IsVehicleModel(car, GetHashKey("sfbc5",_r)) then
if ( GetPedInVehicleSeat( GetVehiclePedIsIn(ped, false ), -1 ) then
SetVehicleUndriveable(GetVehiclePedIsUsing(ped), true)
Vehpos= GetEntityCoords(car, true)
local xnew = Vehpos.x+2
local ynew = Vehpos.y+2
SetEntityCoords(GetPlayerPed(-1), xnew, ynew, Vehpos.z)
drawNotification("~r~Only registered police officers, may drive this vehicle")
end
end
end
end
end)
What was the problem with the job?
So try:
if ( GetPedInVehicleSeat(car, -1 ) then
The native is right i think
Yeah still refuses. It lets the person enter the driver’s seat and all other seats.
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local ped = GetPlayerPed(-1)
if job ~= 'cop' then
if IsPedInAnyVehicle(ped) then
local car = GetVehiclePedIsIn(GetPlayerPed(-1), false)
if IsVehicleModel(car, GetHashKey("police",_r)) or IsVehicleModel(car, GetHashKey("police2",_r)) or IsVehicleModel(car, GetHashKey("police3",_r)) or IsVehicleModel(car, GetHashKey("police4",_r)) or IsVehicleModel(car, GetHashKey("sheriff",_r)) or IsVehicleModel(car, GetHashKey("sheriff2",_r)) or IsVehicleModel(car, GetHashKey("polmav",_r)) or IsVehicleModel(car, GetHashKey("policeb",_r)) or IsVehicleModel(car, GetHashKey("hwaycar",_r)) or IsVehicleModel(car, GetHashKey("hwaycar1",_r)) or IsVehicleModel(car, GetHashKey("hwaycar2",_r)) or IsVehicleModel(car, GetHashKey("hwaycar3",_r)) or IsVehicleModel(car, GetHashKey("hwaycar4",_r)) or IsVehicleModel(car, GetHashKey("hwaycar4",_r)) or IsVehicleModel(car, GetHashKey("hwaycar6",_r)) or IsVehicleModel(car, GetHashKey("hwaycar7",_r)) or IsVehicleModel(car, GetHashKey("hwaycar8",_r)) or IsVehicleModel(car, GetHashKey("hwaycar9",_r)) or IsVehicleModel(car, GetHashKey("hwaycar10",_r)) or IsVehicleModel(car, GetHashKey("chiron",_r)) or IsVehicleModel(car, GetHashKey("aventador",_r)) or IsVehicleModel(car, GetHashKey("fbi",_r)) or IsVehicleModel(car, GetHashKey("fbi2",_r)) or IsVehicleModel(car, GetHashKey("sfbc1",_r)) or IsVehicleModel(car, GetHashKey("sfbc2",_r)) or IsVehicleModel(car, GetHashKey("sfbc3",_r)) or IsVehicleModel(car, GetHashKey("sfbc4",_r)) or IsVehicleModel(car, GetHashKey("sfbc5",_r)) then
if ( GetPedInVehicleSeat(car, -1 ) then
SetVehicleUndriveable(GetVehiclePedIsUsing(ped), true)
Vehpos= GetEntityCoords(car, true)
local xnew = Vehpos.x+2
local ynew = Vehpos.y+2
SetEntityCoords(GetPlayerPed(-1), xnew, ynew, Vehpos.z)
drawNotification("~r~Only registered police officers, may drive this vehicle")
end
end
end
end
end)
if GetPedInVehicleSeat(car, -1 ) == ped then
Nope this is odd, for some reason that native disabled the rest of the script.
If you tried to use that, then I can see why it’s not working.
You added 1 (
too many.
if GetPedInVehicleSeat(car, -1) == PlayerPedId() then
That should work, not sure about the rest of your code though.
Everything else works, just it is causing it when the player is in any seat and I have been trying to set it as just the drivers seat.
yes i noticed this now
This should work mate…
I think this is right, cause this works in another scripts.
local ped = GetPlayerPed(-1)
if (GetPedInVehicleSeat(car, -1) == ped) then
sorry to jump in on this but I am also trying to set this up
I am using vRP so it looks slightly different but it is still not working, did you manage to slove this in the end?
This is what I have:
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local ped = GetPlayerPed(-1)
local user_id = vRP.getUserId({source})
if vRP.hasGroup({user_id,"mechanic"}) then
if IsPedInAnyVehicle(ped) then
local car = GetVehiclePedIsIn(GetPlayerPed(-1), false)
if IsVehicleModel(car, GetHashKey("flatbed3",_r)) then
if (GetPedInVehicleSeat(car, -1) == ped) then
SetVehicleUndriveable(GetVehiclePedIsUsing(ped), true)
drawNotification("~r~You must be a Mechanic to drive this vehicle")
end
end
end
end
end
end)
The error I get is:
Error resuming coroutine: client.lua:5: attempt to index a nil value (global ‘vRP’)
I wasnt getting errors, but it wasnt working, it did at first, but once i updated the server master files for some reason it stopped, but i found a different one im using
Does anyone have a working way of restricting emergency vehicle access in ESX?
Hey guys. so i have everything working except i am trying to make it check player names, not skins or jobs. But i have been working on it for 8 hours none stop and cant get it. does anyone know how to do that? please please.
@Cheleber Can you please make a “_resource.lua” and “client.lua” and can it be just that just police,ambulance can get in to the emergency vehicles? And if it’s not too much trouble could a civ get a message “Do you want to go to jail?” when he tries to enter a police vehicle?
SQL jobs:
police
ambulance
Using ESX
Thank you but I really don’t have any xp with coding/programming