Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/g drugselling #1

Merged
merged 17 commits into from
Feb 19, 2023
Prev Previous commit
Next Next commit
Implement walk up and drive up
  • Loading branch information
Giana committed Feb 17, 2023
commit 5f4a51ac0999b9d18d56f70f3dd650a6fb2ce86f
34 changes: 34 additions & 0 deletions client/main.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
-- Threads --

-- Walk up & drive up
Citizen.CreateThread(function()
while true do
if LocalPlayer.state.isLoggedIn then
local ped = PlayerPedId()
local pos = GetEntityCoords(ped)
local inRange = false
for k, v in pairs(Config.SellLocations) do
if v.active then
local dist = #(pos - v.coords)
if dist < 10 then
if v.marker.enabled then
if (v.type == 'walkup' and not IsPedInAnyVehicle(ped, false)) or (v.type == 'driveup' and IsPedInAnyVehicle(ped, false)) or v.type == 'any' or v.type == 'target' then
DrawMarker(v.marker.type, v.coords.x, v.coords.y, v.coords.z + 0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.marker.scaleX, v.marker.scaleY, v.marker.scaleZ, v.marker.red, v.marker.green, v.marker.blue, v.marker.alpha, v.marker.bob, v.marker.faceCamera, 0, 1, 0, 0, 0)
end
end
if dist < 1.5 then
if (v.type == 'walkup' and not IsPedInAnyVehicle(ped, false)) or (v.type == 'driveup' and IsPedInAnyVehicle(ped, false)) or v.type == 'any' then
TriggerServerEvent('g-drugselling:server:sell', v)
end
end
inRange = true
end
end
end
if not inRange then
Citizen.Wait(2000)
end
end
Citizen.Wait(3)
end
end)