Markers not correctly detecting if a player is in
W4RdZ opened this issue · 1 comments
Describe the Bug | A Clear & Concise Description of Bug
Markers not correctly detecting if a player is in
When i'm entering markers range, it randomly detect the player.
I mean, when i restart the ressource or the server itself, it randomly work for one job or 2 or 3 or 0.
It is like the script don't get the right positions of markers zones and so he don't give back that someone is in the area.
Sometimes i have to restart 5~10 time the ressource before it get that i'm in the marker area.
If you could take a look at the changes i made, it would be appreciate :)
Thanks
Questions
Have you made changes to anything in client/main.lua
or server/main.lua
?:
Yes :
Config.lua : (Almost everything is changed to customize easily markers)
Config = {}
Config.Locale = 'en'
Config.Main = {
DrawDistance = 40,
-- looks like this: 'LLL NNN' The maximum plate length is 8 chars (including spaces & symbols), don't go past it!
PlateLetters = 3,
PlateNumbers = 3,
PlateUseSpace = true
}
Config.Ambulance = {
Shop = true, -- true = Use Ambulance Shop | false = Does Opposite
Blips = true, -- true = Use Ambulance Blip | false = Does Opposite
Blip = {Coords = vector3(-981.65, -2060.03, 9.41), Sprite = 56, Color = 1, Display = 4, Scale = 0.8},
License = true, -- Requires License to Buy Ambulance Vehicles.
ResellPerc = 50 -- The Resell % of Vehicles Sold | Example: $10,000 / 50% = $5,000 Back
}
Config.Police = {
Shop = true, -- true = Use Police Shop | false = Does Opposite
Blips = true, -- true = Use Police Blip | false = Does Opposite
Blip = {Coords = vector3(-981.65, -2060.03, 9.41), Sprite = 56, Color = 29, Display = 4, Scale = 0.8},
License = true, -- Requires License to Buy Police Vehicles.
ResellPerc = 50 -- The Resell % of Vehicles Sold | Example: $10,000 / 50% = $5,000 Back
}
Config.Divisions = {
Ambulance = {
Heli1 = 'polmav',
Heli2 = 'firehawk'
},
Police = {
Heli1 = 'polmav'
}
}
Config.Mechanic = {
Shop = true, -- true = Use Mechanic Shop | false = Does Opposite
Blips = true, -- true = Use Mechanic Blip | false = Does Opposite
Blip = {Coords = vector3(-981.65, -2060.03, 9.41), Sprite = 532, Color = 5, Display = 4, Scale = 0.8},
License = true, -- Requires License to Buy Mechanic Vehicles.
ResellPerc = 50 -- The Resell % of Vehicles Sold | Example: $10,000 / 50% = $5,000 Back
}
Config.Aircraft = {
Shop = true, -- true = Use Aircraft Shop | false = Does Opposite
Blips = true, -- true = Use Aircraft Blip | false = Does Opposite
Blip = {Coords = vector3(-940.0, -2963.1, 18.8), Sprite = 575, Color = 27, Display = 4, Scale = 1.2},
License = true, -- Requires License to Buy Aircrafts.
ResellPerc = 50 -- The Resell % of Vehicles Sold | Example: $10,000 / 50% = $5,000 Back
}
Config.Boat = {
Shop = true, -- true = Use Boat Shop | false = Does Opposite
Blips = true, -- true = Use Boat Blip | false = Does Opposite
Blip = {Coords = vector3(-714.3, -1297.3, 4.1), Sprite = 455, Color = 27, Display = 4, Scale = 1.2},
License = true, -- Requires License to Buy Boats.
ResellPerc = 50 -- The Resell % of Vehicles Sold | Example: $10,000 / 50% = $5,000 Back
}
Config.Car = {
Shop = false, -- true = Use Car Shop | false = Does Opposite
Blips = false, -- true = Use Car Blip | false = Does Opposite
Blip = {Coords = vector3(-33.7, -1102.0, 25.4), Sprite = 326, Color = 27, Display = 4, Scale = 1.0},
License = true, -- Requires License to Buy Cars.
ResellPerc = 50 -- The Resell % of Vehicles Sold | Example: $10,000 / 50% = $5,000 Back
}
Config.Truck = {
Shop = true, -- true = Use Truck Shop | false = Does Opposite
Blips = true, -- true = Use Truck Blip | false = Does Opposite
Blip = {Coords = vector3(900.4, -1155.0, 24.1), Sprite = 67, Color = 27, Display = 4, Scale = 1.2},
License = true, -- Requires License to Buy Trucks.
ResellPerc = 50 -- The Resell % of Vehicles Sold | Example: $10,000 / 50% = $5,000 Back
}
-- You will need to setup your own callback for VIP Shop
Config.VIP = {
Shop = false, -- true = Use VIP Shop | false = Does Opposite
Blips = false, -- true = Use VIP Blip | false = Does Opposite
Blip = {Coords = vector3(-32.75, -1656.01, 28.49), Sprite = 326, Color = 27, Display = 4, Scale = 1.0},
License = true, -- Requires License to Buy VIP Vehicles.
ResellPerc = 50 -- The Resell % of Vehicles Sold | Example: $10,000 / 50% = $5,000 Back
}
Config.VIPBoat = {
Shop = false, -- true = Use VIP Shop | false = Does Opposite
Blips = false, -- true = Use VIP Blip | false = Does Opposite
Blip = {Coords = vector3(-806.8, -1354.04, 4.22), Sprite = 326, Color = 27, Display = 4, Scale = 1.0},
License = true, -- Requires License to Buy VIP Vehicles.
ResellPerc = 50 -- The Resell % of Vehicles Sold | Example: $10,000 / 50% = $5,000 Back
}
-- ShopEntering = Marker for Accessing Shop | ShopInside = Marker for Viewing Vehicles
-- ShopOutside = Marker for Purchasing Vehicles | ResellVehicle = Marker for Selling Vehicles
Config.Zones = {
-- Ambulance Shop
ShopEnteringAmbulance = {
Pos = vector3(-980.43, -2061.4, 9.41),
Color = {r = 0, g = 200, b = 0,>>>>>> a = 200<<<<<<<<<},
Size = {x = 1.0, y = 1.0, z = 1.0},
>>>>> General = { Rotate = true, Range = 3, Type = 29, ShopId = 1 } <<<<<<
},
ShopInsideAmbulance = {
Pos = vector3(-980.43, -2061.4, 9.41),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 223.98,
General = { Rotate = false, Range = 3, Type = -1, ShopId = 1 }
},
ShopInsideAmbulanceHeli = {
Pos = vector3(-942.89, -2010.71, 11.35),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 223.98,
General = { Rotate = false, Range = 3, Type = -1, ShopId = 1 }
},
ShopOutsideAmbulanceHeli = {
Pos = vector3(-942.89, -2010.71, 11.35),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 223.98,
General = { Rotate = false, Range = 3, Type = -1, ShopId = 1 }
},
ShopOutsideAmbulance = {
Pos = vector3(-980.43, -2061.4, 9.41),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 223.98,
General = { Rotate = false, Range = 3, Type = -1, ShopId = 1 }
},
ResellVehicleAmbulance = {
Pos = vector3(-890.86, -2043.65, 9.41),
Color = {r = 200, g = 0, b = 0, a = 200},
Size = {x = 1.0, y = 1.0, z = 1.0},
General = { Rotate = true, Range = 3, Type = 29, ShopId = 1 }
},
ResellVehicleAmbulanceHeli = {
Pos = vector3(-890.86, -2043.65, 9.41),
Color = {r = 255, g = 0, b = 0, a = 200},
Size = {x = 3.0, y = 3.0, z = 1.0},
General = { Rotate = true, Range = 3, Type = 29, ShopId = 1 }
},
-- Police Shop
ShopEnteringPolice = {
Pos = vector3(-986.34, -2054.91, 9.41),
Color = {r = 0, g = 200, b = 0, a = 200},
Size = {x = 1.0, y = 1.0, z = 1.0},
General = { Rotate = true, Range = 3, Type = 29, ShopId = 2 }
},
ShopInsidePolice = {
Pos = vector3(-986.34, -2054.91, 9.41),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 223.98,
General = { Rotate = false, Range = 3, Type = -1, ShopId = 2 }
},
ShopInsidePoliceHeli = {
Pos = vector3(-942.89, -2010.71, 11.35),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 223.98,
General = { Rotate = false, Range = 3, Type = -1, ShopId = 2 }
},
ShopOutsidePoliceHeli = {
Pos = vector3(-942.89, -2010.71, 11.35),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 223.98,
General = { Rotate = false, Range = 3, Type = -1, ShopId = 2 }
},
ShopOutsidePolice = {
Pos = vector3(-986.34, -2054.91, 9.41),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 223.98,
General = { Rotate = false, Range = 3, Type = -1, ShopId = 2 }
},
ResellVehiclePolice = {
Pos = vector3(-890.86, -2043.65, 9.41),
Color = {r = 200, g = 0, b = 0, a = 200},
Size = {x = 1.0, y = 1.0, z = 1.0},
General = { Rotate = true, Range = 3, Type = 29, ShopId = 2 }
},
ResellVehiclePoliceHeli = {
Pos = vector3(-890.86, -2043.65, 9.41),
Color = {r = 200, g = 0, b = 0, a = 200},
Size = {x = 1.0, y = 1.0, z = 1.0},
General = { Rotate = true, Range = 3, Type = 29, ShopId = 2 }
},
-- Mechanic Shop
ShopEnteringMechanic = {
Pos = vector3(-971.49, -2071.81, 9.41),
Color = {r = 0, g = 200, b = 0, a = 200},
Size = {x = 1.0, y = 1.0, z = 1.0},
General = { Rotate = true, Range = 3, Type = 29, ShopId = 3 }
},
ShopInsideMechanic = {
Pos = vector3(-971.49, -2071.81, 9.41),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 132.59,
General = { Rotate = false, Range = 3, Type = -1, ShopId = 3 }
},
ShopOutsideMechanic = {
Pos = vector3(-971.49, -2071.81, 9.41),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 132.59,
General = { Rotate = false, Range = 3, Type = -1, ShopId = 3 }
},
ResellVehicleMechanic = {
Pos = vector3(-890.86, -2043.65, 9.41),
Color = {r = 200, g = 0, b = 0, a = 200},
Size = {x = 1.0, y = 1.0, z = 1.0},
General = { Rotate = true, Range = 3, Type = 29, ShopId = 3 }
},
-- Aircraft Shop
ShopEnteringAircraft = {
Pos = vector3(-940.0, -2963.1, 19.8),
Color = {r = 0, g = 200, b = 0, a = 200},
Size = {x = 1.0, y = 1.0, z = 1.0},
General = { Rotate = true, Range = 1.5, Type = 29, ShopId = 4 }
},
ShopInsideAircraft = {
Pos = vector3(-1874.7, -3137.5, 14.9), -- vector3(-1075.0, -2933.2, 14.5),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 333.95, -- 59.9
General = { Rotate = false, Range = 1.5, Type = -1, ShopId = 4 }
},
ShopOutsideAircraft = {
Pos = vector3(-965.2, -2983.5, 14.5),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 59.9,
General = { Rotate = false, Range = 1.5, Type = -1, ShopId = 4 }
},
ResellVehicleAircraft = {
Pos = vector3(-1003.2, -2920.7, 13.9),
Color = {r = 200, g = 0, b = 0, a = 200},
Size = {x = 1.0, y = 1.0, z = 1.0},
General = { Rotate = true, Range = 3.5, Type = 29, ShopId = 4 }
},
-- Boat Shop
ShopEnteringBoat = {
Pos = vector3(-714.3, -1297.3, 5.1),
Color = {r = 0, g = 200, b = 0, a = 200},
Size = {x = 1.0, y = 1.0, z = 1.0},
General = { Rotate = true, Range = 1.5, Type = 29, ShopId = 5 }
},
ShopInsideBoat = {
Pos = vector3(-716.1, -1350.7, -0.4),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 138.4,
General = { Rotate = false, Range = 1.5, Type = -1, ShopId = 5 }
},
ShopOutsideBoat = {
Pos = vector3(-717.7, -1339.2, -0.4),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 90.0,
General = { Rotate = false, Range = 1.5, Type = -1, ShopId = 5 }
},
ResellVehicleBoat = {
Pos = vector3(-725.3, -1327.8, 1.4),
Color = {r = 200, g = 0, b = 0, a = 200},
Size = {x = 1.0, y = 1.0, z = 1.0},
General = { Rotate = true, Range = 3.5, Type = 29, ShopId = 5 }
},
-- Car Shop
ShopEnteringCar = {
Pos = vector3(-33.7, -1102.0, 26.4),
Color = {r = 0, g = 200, b = 0, a = 200},
Size = {x = 1.0, y = 1.0, z = 1.0},
General = { Rotate = true, Range = 1.5, Type = 29, ShopId = 6 }
},
ShopInsideCar = {
Pos = vector3(-47.5, -1097.2, 25.4),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = -20.0,
General = { Rotate = false, Range = 1.5, Type = -1, ShopId = 6 }
},
ShopOutsideCar = {
Pos = vector3(-26.8, -1083.5, 26.6),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 70.68,
General = { Rotate = false, Range = 1.5, Type = -1, ShopId = 6 }
},
ResellVehicleCar = {
Pos = vector3(-44.6, -1080.7, 26.6),
Color = {r = 200, g = 0, b = 0, a = 200},
Size = {x = 1.0, y = 1.0, z = 1.0},
General = { Rotate = true, Range = 3.5, Type = 29, ShopId = 6 }
},
-- Truck Shop
ShopEnteringTruck = {
Pos = vector3(900.4, -1155.0, 25.1),
Color = {r = 0, g = 200, b = 0, a = 200},
Size = {x = 1.0, y = 1.0, z = 1.0},
General = { Rotate = true, Range = 1.5, Type = 29, ShopId = 7 }
},
ShopInsideTruck = {
Pos = vector3(927.5, -1226.8, 24.6),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 102.93,
General = { Rotate = false, Range = 1.5, Type = -1, ShopId = 7 }
},
ShopOutsideTruck = {
Pos = vector3(994.7, -1186.4, 24.5),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 93.19,
General = { Rotate = false, Range = 1.5, Type = -1, ShopId = 7 }
},
ResellVehicleTruck = {
Pos = vector3(879.2, -1168.5, 25.0),
Color = {r = 200, g = 0, b = 0, a = 200},
Size = {x = 1.0, y = 1.0, z = 1.0},
General = { Rotate = true, Range = 3.5, Type = 29, ShopId = 7 }
},
-- VIP Shop
ShopEnteringVIP = {
Pos = vector3(-796.01, -220.09, 37.08),
Color = {r = 0, g = 200, b = 0, a = 200},
Size = {x = 1.0, y = 1.0, z = 1.0},
General = { Rotate = true, Range = 1.5, Type = 29, ShopId = 8 }
},
ShopInsideVIP = {
Pos = vector3(-771.53, -233.9, 36.08),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 211.31,
General = { Rotate = false, Range = 1.5, Type = -1, ShopId = 8 }
},
ShopOutsideVIP = {
Pos = vector3(-760.88, -243.24, 37.25),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 113.1,
General = { Rotate = false, Range = 1.5, Type = -1, ShopId = 8 }
},
ResellVehicleVIP= {
Pos = vector3(-760.56, -231.36, 37.28),
Color = {r = 200, g = 0, b = 0, a = 200},
Size = {x = 1.0, y = 1.0, z = 1.0},
General = { Rotate = true, Range = 3.5, Type = 29, ShopId = 8 }
},
-- VIP Boat Shop
ShopEnteringVIPBoat = {
Pos = vector3(-806.8, -1354.04, 5.22),
Color = {r = 0, g = 200, b = 0, a = 200},
Size = {x = 1.0, y = 1.0, z = 1.0},
General = { Rotate = true, Range = 1.5, Type = 29, ShopId = 9 }
},
ShopInsideVIPBoat = {
Pos = vector3(-768.66, -1393.84, 19.62),
Size = {x = 1.5, y = 1.5, z = 1.0},
Heading = 136.83,
General = { Rotate = false, Range = 1.5, Type = -1, ShopId = 9 }
},
ShopOutsideVIPBoat = {
Pos = vector3(-855.04, -1410.41, -0.47),
Color = {r = 200, g = 0, b = 0, a = 200},
Size = {x = 1.0, y = 1.0, z = 1.0},
General = { Rotate = false, Range = 1.5, Type = -1, ShopId = 9 }
},
ResellVehicleVIPBoat = {
Pos = vector3(649.82, -3103.56, 0.4),
Color = {r = 255, g = 222, b = 0, a = 200},
Size = {x = 3.0, y = 3.0, z = 1.0},
General = { Rotate = true, Range = 3.5, Type = 29, ShopId = 9 }
}
}
SHOP MENU CLIENT.LUA (MADE THE SAME CHANGES FOR THE POLICE)
function BuyAmbulanceMenu()
if #VehiclesAJ == 0 then
print('[esx_advancedvehicleshop] [^3ERROR^7] No Ambulance Vehicles Found!!!')
return
end
IsInMainMenu = true
StartShopRestriction()
ESX.UI.Menu.CloseAll()
local playerPed = PlayerPedId()
FreezeEntityPosition(playerPed, true)
SetEntityVisible(playerPed, false)
SetEntityCoords(playerPed, Config.Zones.ShopInsideAmbulance.Pos)
local vehiclesByCategory = {}
local elements = {}
local firstVehicleData = nil
for i=1, #CategoriesAJ, 1 do
vehiclesByCategory[CategoriesAJ[i].name] = {}
end
for i=1, #VehiclesAJ, 1 do
if IsModelInCdimage(GetHashKey(VehiclesAJ[i].model)) then
table.insert(vehiclesByCategory[VehiclesAJ[i].category], VehiclesAJ[i])
else
print(('[esx_advancedvehicleshop] [^3ERROR^7] Ambulance Vehicle "%s" does not exist'):format(VehiclesAJ[i].model))
end
end
for k,v in pairs(vehiclesByCategory) do
table.sort(v, function(a, b)
return a.name < b.name
end)
end
for i=1, #CategoriesAJ, 1 do
local category = CategoriesAJ[i]
local categoryVehicles = vehiclesByCategory[category.name]
local options = {}
for j=1, #categoryVehicles, 1 do
local vehicle = categoryVehicles[j]
if i == 1 and j == 1 then
firstVehicleData = vehicle
end
table.insert(options, ('%s <span style="color:green;">%s</span>'):format(vehicle.name, _U('generic_shopitem', ESX.Math.GroupDigits(vehicle.price))))
end
table.sort(options)
table.insert(elements, {
name = category.name,
label = category.label,
value = 0,
type = 'slider',
max = #CategoriesAJ[i],
options = options
})
end
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'ambulance_buy', {
title = _U('ambulance_dealer'),
align = 'right',
elements = elements
}, function(data, menu)
local vehicleData = vehiclesByCategory[data.current.name][data.current.value + 1]
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'ambulance_confirm', {
title = _U('buy_vehicle', vehicleData.name, ESX.Math.GroupDigits(vehicleData.price)),
align = 'right',
elements = {
{label = _U('no'), value = 'no'},
{label = _U('yes'), value = 'yes'}
}}, function(data2, menu2)
if data2.current.value == 'yes' then
local generatedPlate = GeneratePlate()
if ESX.PlayerData.job and ESX.PlayerData.job.name == 'ambulance' and ESX.PlayerData.job.grade_name == vehicleData.category then
if vehicleData.model == Config.Divisions.Ambulance.Heli1 or vehicleData.model == Config.Divisions.Ambulance.Heli2 then
ESX.TriggerServerCallback('esx_advancedvehicleshop:buyVehicleAJ', function(success, playerID)
if success then
IsInMainMenu = false
menu2.close()
menu.close()
DeleteDisplayVehicleInsideShop()
ESX.Game.SpawnVehicle(vehicleData.model, Config.Zones.ShopOutsideAmbulanceHeli.Pos, Config.Zones.ShopOutsideAmbulanceHeli.Heading, function(vehicle)
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
SetVehicleNumberPlateText(vehicle, generatedPlate)
>>>>>>>>>>>> TriggerServerEvent('esx_vehiclelock:registerkeysociety', generatedPlate, GetPlayerServerId(closestPlayer)) <<<<<<<<<<<<<<<
FreezeEntityPosition(playerPed, false)
SetEntityVisible(playerPed, true)
end)
else
ESX.ShowNotification(_U('not_enough_money'))
end
end, vehicleData.model, generatedPlate, vehicleData.name)
else
ESX.TriggerServerCallback('esx_advancedvehicleshop:buyVehicleAJ', function(success, playerID)
if success then
IsInMainMenu = false
menu2.close()
menu.close()
DeleteDisplayVehicleInsideShop()
ESX.Game.SpawnVehicle(vehicleData.model, Config.Zones.ShopOutsideAmbulance.Pos, Config.Zones.ShopOutsideAmbulance.Heading, function(vehicle)
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
SetVehicleNumberPlateText(vehicle, generatedPlate)
>>>>>>>>>>> TriggerServerEvent('esx_vehiclelock:registerkeysociety', generatedPlate, GetPlayerServerId(closestPlayer)) <<<<<<<<<<<<<<<
FreezeEntityPosition(playerPed, false)
SetEntityVisible(playerPed, true)
end)
else
ESX.ShowNotification(_U('not_enough_money'))
end
end, vehicleData.model, generatedPlate, vehicleData.name)
end
else
ESX.ShowNotification(_U('your_rank'))
end
else
menu2.close()
end
end, function(data2, menu2)
menu2.close()
end)
end, function(data, menu)
menu.close()
DeleteDisplayVehicleInsideShop()
local playerPed = PlayerPedId()
CurrentAction = 'ambulance_menu'
CurrentActionMsg = _U('ambulance_menu')
CurrentActionData = {}
FreezeEntityPosition(playerPed, false)
SetEntityVisible(playerPed, true)
SetEntityCoords(playerPed, Config.Zones.ShopEnteringAmbulance.Pos)
IsInMainMenu = false
end, function(data, menu)
local vehicleData = vehiclesByCategory[data.current.name][data.current.value + 1]
local playerPed = PlayerPedId()
DeleteDisplayVehicleInsideShop()
WaitForVehicleToLoad(vehicleData.model)
>>>>>>>>>>>>> if vehicleData.model ~= Config.Divisions.Ambulance.Heli1 or vehicleData.model ~= Config.Divisions.Ambulance.Heli2 then
ESX.Game.SpawnLocalVehicle(vehicleData.model, Config.Zones.ShopInsideAmbulance.Pos, Config.Zones.ShopInsideAmbulance.Heading, function(vehicle)
currentDisplayVehicle = vehicle
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
FreezeEntityPosition(vehicle, true)
SetModelAsNoLongerNeeded(vehicleData.model)
end)
else
ESX.Game.SpawnLocalVehicle(vehicleData.model, Config.Zones.ShopInsideAmbulanceHeli.Pos, Config.Zones.ShopInsideAmbulanceHeli.Heading, function(vehicle)
currentDisplayVehicle = vehicle
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
FreezeEntityPosition(vehicle, true)
SetModelAsNoLongerNeeded(vehicleData.model)
end)
end <<<<<<<<<<<<<<<<<<<
end)
DeleteDisplayVehicleInsideShop()
WaitForVehicleToLoad(firstVehicleData.model)
>>>>>>>>>>>>>>>> if firstVehicleData.model ~= Config.Divisions.Ambulance.Heli1 or firstVehicleData.model ~= Config.Divisions.Ambulance.Heli2 then
ESX.Game.SpawnLocalVehicle(firstVehicleData.model, Config.Zones.ShopInsideAmbulance.Pos, Config.Zones.ShopInsideAmbulance.Heading, function(vehicle)
currentDisplayVehicle = vehicle
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
FreezeEntityPosition(vehicle, true)
SetModelAsNoLongerNeeded(firstVehicleData.model)
end)
else
ESX.Game.SpawnLocalVehicle(firstVehicleData.model, Config.Zones.ShopInsideAmbulanceHeli.Pos, Config.Zones.ShopInsideAmbulanceHeli.Heading, function(vehicle)
currentDisplayVehicle = vehicle
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
FreezeEntityPosition(vehicle, true)
SetModelAsNoLongerNeeded(firstVehicleData.model)
end)
end <<<<<<<<<<<<<<<<<<<<<<
end
MARKERS
>>>>>>>>> if v.General.Type ~= -1 then <<<<<<<<<<<<<<<
>>>>>>>>>>>>> if v.General.ShopId == 1 then <<<<<<<<<<<<<
if Config.Ambulance.Shop then
if ESX.PlayerData.job and ESX.PlayerData.job.name == 'ambulance' then
>>>>>>>>>>>>>>> DrawMarker(v.General.Type, v.Pos, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, v.Color.r, v.Color.g, v.Color.b, v.Color.a, false, true, 2, v.General.Rotate, nil, nil, false) <<<<<<<<<<<<<<
end
end
end
if v.General.ShopId == 2 then
if Config.Police.Shop then
if ESX.PlayerData.job and ESX.PlayerData.job.name == 'police' then
DrawMarker(v.General.Type, v.Pos, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, v.Color.r, v.Color.g, v.Color.b, v.Color.a, false, true, 2, v.General.Rotate, nil, nil, false)
end
end
end
etc...
if distance < >>>>>>>>>> v.General.Range <<<<<<<<<< then
isInMarker, currentZone = true, k
end
The Event i call into the menu is
--Enregistrement d'une nouvelle paire de clés de Société
RegisterServerEvent('esx_vehiclelock:registerkeysociety')
AddEventHandler('esx_vehiclelock:registerkeysociety', function(plate, target)
local _source = source
local xPlayer = nil
if target == 'no' then
xPlayer = ESX.GetPlayerFromId(_source)
else
xPlayer = ESX.GetPlayerFromId(target)
end
MySQL.Async.execute(
'INSERT INTO open_car (label, value, NB, got, identifier, job, job_grade) VALUES (@label, @value, @NB, @got, @identifier, @job, @job_grade)',
{
['@label'] = 'Cles',
['@value'] = plate,
['@NB'] = 1,
['@got'] = 'true',
['@identifier'] = xPlayer.job.name,
['@job'] = xPlayer.job.name,
['@job_grade'] = xPlayer.job.grade
},
function(result)
TriggerClientEvent('esx:showNotification', xPlayer.source, 'Vous avez une ~g~nouvelle paire de clés société!~s~ ')
TriggerClientEvent('esx:showNotification', _source, '~y~Clés de société bien enregistrer !~s~')
end)
end)
SERVEUR.LUA (SAME CHANGES FOR THE POLICE/MECHANIC)
ESX.RegisterServerCallback('esx_advancedvehicleshop:buyVehicleAJ', function(source, cb, model, plate, name)
local xPlayer = ESX.GetPlayerFromId(source)
local modelPrice
for k,v in ipairs(vehiclesaj) do
if model == v.model then
modelPrice = v.price
break
end
end
if modelPrice and xPlayer.getMoney() >= modelPrice then
xPlayer.removeMoney(modelPrice)
if model == Config.Divisions.Ambulance.Heli1 or model == Config.Divisions.Ambulance.Heli2 then
>>>>>>>>> MySQL.Async.execute('INSERT INTO owned_vehicles (owner, plate, vehicle, type, job, category, name, job_grade) VALUES (@owner, @plate, @vehicle, @type, @job, @category, @name, @job_grade)', { <<<<<<<<<<
>>>>>>>> ['@owner'] = 'AMBULANCE', <<<<<<<<<<<<
['@plate'] = plate,
['@vehicle'] = json.encode({model = GetHashKey(model), plate = plate}),
['@type'] = 'aircraft',
['@job'] = 'ambulance',
['@category'] = 'helis',
['@name'] = name,
>>>>>>>>>> ['@job_grade'] = xPlayer.job.grade <<<<<<<<<<<<<<<<
}, function(rowsChanged)
xPlayer.showNotification(_U('ambulance_belongs', plate))
cb(true)
end)
else
>>>>>>>>>>>> MySQL.Async.execute('INSERT INTO owned_vehicles (owner, plate, vehicle, type, job, category, name, job_grade) VALUES (@owner, @plate, @vehicle, @type, @job, @category, @name, @job_grade)', { <<<<<<<<<<<
>>>>>>>> ['@owner'] = 'AMBULANCE', <<<<<<<<<<
['@plate'] = plate,
['@vehicle'] = json.encode({model = GetHashKey(model), plate = plate}),
['@type'] = 'car',
['@job'] = 'ambulance',
['@category'] = 'cars',
['@name'] = name,
>>>>>>>>>> ['@job_grade'] = xPlayer.job.grade <<<<<<<<<<
}, function(rowsChanged)
xPlayer.showNotification(_U('ambulance_belongs', plate))
cb(true)
end)
end
else
cb(false)
end
end)
ESX.RegisterServerCallback('esx_advancedvehicleshop:resellVehicleAJ', function(source, cb, plate, model)
local xPlayer, resellPrice, vehicleName = ESX.GetPlayerFromId(source)
-- calculate the resell price
for i=1, #vehiclesaj, 1 do
if GetHashKey(vehiclesaj[i].model) == model then
resellPrice = ESX.Math.Round(vehiclesaj[i].price / 100 * Config.Ambulance.ResellPerc)
vehicleName = vehiclesaj[i].model
break
end
end
if not resellPrice then
print(('[esx_advancedvehicleshop] [^3WARNING^7] %s attempted to sell an unknown vehicle!'):format(GetPlayerIdentifiers(source)[1]))
cb(false)
else
>>>>>>>>>>> MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND @plate = plate AND job_grade <= @job_grade', { <<<<<<<<<<
>>>>>>>>>> ['@owner'] = 'AMBULANCE', <<<<<<<<<<
['@plate'] = plate,
>>>>>>>> ['@job_grade'] = xPlayer.job.grade <<<<<<<<<<
}, function(result)
if result[1] then -- does the owner match?
local vehicle = json.decode(result[1].vehicle)
if vehicle.model == model then
if vehicle.plate == plate then
xPlayer.addMoney(resellPrice)
RemoveOwnedVehicle(plate)
cb(true)
else
print(('[esx_advancedvehicleshop] [^3WARNING^7] %s attempted to sell an vehicle with plate mismatch!'):format(xPlayer.identifier))
cb(false)
end
else
print(('[esx_advancedvehicleshop] [^3WARNING^7] %s attempted to sell an vehicle with model mismatch!'):format(xPlayer.identifier))
cb(false)
end
else
cb(false)
end
end)
end
end)
Have you looked through the Closed Topics?: Yes
Have you looked through the Wiki?: Yes
Are you using a Pre-Installed ESX? If Yes who?: No
Are you using es_extended? If Yes what Version? (Example: 1.2): V1-Final
Are you using Essentialmode?: No
Are you using ExtendedMode?: I don't think, it's confusing me with es_extended, so if we are not speaking about es_extended, NO i'm not using it.
Are you using OneSync?: No
Linux or Windows?: Windows
Solved ! Markers were too close from each others 👎