diff --git a/__resource.lua b/__resource.lua index f24e98a..351347e 100644 --- a/__resource.lua +++ b/__resource.lua @@ -31,7 +31,6 @@ client_scripts { 'client/pointfinger-client.lua', 'client/speed_limit-client.lua', 'client/no_drive_by-client.lua', - 'client/idhead_client.lua', 'client/afkkick-client.lua', 'client/handsup-client.lua', 'client/gpstools-client.lua', diff --git a/client/no_drive_by-client.lua b/client/no_drive_by-client.lua index b03e602..b95dfe5 100644 --- a/client/no_drive_by-client.lua +++ b/client/no_drive_by-client.lua @@ -9,8 +9,9 @@ local Keys = { ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173, ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 } -local car = nil + ESX = nil +local isInVehicle = false Citizen.CreateThread(function() while ESX == nil do @@ -21,12 +22,16 @@ end) Citizen.CreateThread(function() local playerPed = GetPlayerPed(-1) + local vehicle = nil while true do Citizen.Wait(1000) - car = GetVehiclePedIsIn(playerPed, false) - if car then - SetPlayerCanDoDriveBy(PlayerId(), false) + vehicle = GetVehiclePedIsIn(playerPed, false) + + if DoesEntityExist(vehicle) then + isInVehicle = true + else + isInVehicle = false end end end) @@ -35,8 +40,10 @@ Citizen.CreateThread(function() while true do Citizen.Wait(10) - if car then + if isInVehicle then + SetPlayerCanDoDriveBy(PlayerId(), false) DisableControlAction(2, Keys['TAB'], true) + HideHudComponentThisFrame(19) -- Weapon Wheel if IsDisabledControlJustReleased(0, Keys['TAB']) then ESX.ShowNotification(_U('nodrive_action_disabled')) diff --git a/server/generic_messages-server.lua b/server/generic_messages-server.lua index 16c3c2c..0bcca1b 100644 --- a/server/generic_messages-server.lua +++ b/server/generic_messages-server.lua @@ -2,7 +2,7 @@ AddEventHandler('esx:playerLoaded', function(source) TriggerClientEvent('esx:showNotification', -1, _U('message_joined', GetPlayerName(source))) end) -AddEventHandler('playerDropped', function(reason) +AddEventHandler('esx:playerDropped', function(reason) if reason ~= "Disconnected." then TriggerClientEvent('esx:showNotification', -1, _U('message_left_reason', GetPlayerName(source), reason)) else