Skip to content

Commit

Permalink
Fixed no drive-bys
Browse files Browse the repository at this point in the history
  • Loading branch information
ElPumpo committed Jun 16, 2018
1 parent 5baf2a5 commit 037551c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
1 change: 0 additions & 1 deletion __resource.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
17 changes: 12 additions & 5 deletions client/no_drive_by-client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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'))
Expand Down
2 changes: 1 addition & 1 deletion server/generic_messages-server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 037551c

Please sign in to comment.