I am trying to edit the garages script so each garage has a marker and spawner location like in vehshop.
Here is what I been doing:
local currentPos
--local garage_location = {-806.205749511719,-1506.02380371094,-0.474672883749008}
local garage_location = {{entering = {-806.611633300781,-1496.48486328125,1.5952171087265}, inside = {-801.3056640625,-1503.71069335938,-0.47460201382637,122.1953}, outside = {-806.205749511719,-1506.02380371094,0.474672883749008}}}
local garage_location2 = {-956.40515136719, -2704.7595214844, 13.831034660339}
local vente_location = {-3458.64111328125,930.047119140625,0.264918923377991}
local inrangeofgarage = false
local currentlocation = nil
local garage = {title = "dock", currentpos = nil, marker = { r = 0, g = 155, b = 255, a = 200, type = 1 }}
Then at thread creation I made it so that the position grabs the location from the entering array, using the entering location to create a marker and blip then using entering on garage to check distance for activation… at end I make currentPos.outside for the final part (spawning)
Citizen.CreateThread(function()
local loc = pos
pos = garage_location.entering
local blip = AddBlipForCoord(pos[1],pos[2],pos[3])
SetBlipSprite(blip,357)
SetBlipColour(blip, 3)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString('Dock')
EndTextCommandSetBlipName(blip)
SetBlipAsShortRange(blip,true)
SetBlipAsMissionCreatorBlip(blip,true)
checkgarage = 0
while true do
Wait(0)
DrawMarker(1,garage_location.entering[1],garage_location.entering[2],garage_location.entering[3],0,0,0,0,0,0,4.001,4.0001,0.5001,0,155,255,200,0,0,0,0)
if GetDistanceBetweenCoords(garage_location.entering[1],garage_location.entering[2],garage_location.entering[3],GetEntityCoords(LocalPed())) < 5 and IsPedInAnyVehicle(LocalPed(), true) == false then
drawTxt('~g~E~s~ to open the menu',0,1,0.5,0.8,0.6,255,255,255,255)
if IsControlJustPressed(1, 86) then
MenuGarage()
Menu.hidden = not Menu.hidden
currentPos = garage_location.outside
end
Menu.renderGUI()
end
end
end)
AddEventHandler('garages:SpawnVehicle', function(vehicle, plate, state, primarycolor, secondarycolor)
local ped
local car = GetHashKey(vehicle)
local plate = plate
local state = state
local primarycolor = tonumber(primarycolor)
local secondarycolor = tonumber(secondarycolor)
Citizen.CreateThread(function()
Citizen.Wait(3000)
local caisseo = GetClosestVehicle(currentPos[1], currentPos[2], currentPos[3], 3.000, 0, 70)
if DoesEntityExist(caisseo) then
drawNotification("The area is too crowded.")
else
if state == "Outside" then
drawNotification("That boat is not in the dock.")
else
RequestModel(car)
while not HasModelLoaded(car) do
Citizen.Wait(0)
end
veh = CreateVehicle(car, currentPos.outside[1], currentPos[2], currentPos[3], 122.1553, true, false)
SetVehicleNumberPlateText(veh, plate)
SetVehicleOnGroundProperly(veh)
SetVehicleHasBeenOwnedByPlayer(veh,true)
local id = NetworkGetNetworkIdFromEntity(veh)
SetNetworkIdCanMigrate(id, true)
SetVehicleColours(veh, primarycolor, secondarycolor)
SetEntityInvincible(veh, false)
TaskWarpPedIntoVehicle(LocalPed(),veh,-1)
drawNotification("The boat has been docked out.")
-- TriggerServerEvent('garages:SetVehOut', vehicle, plate, car)
-- TriggerServerEvent("garages:CheckGarageForVeh")
end
end
end)
end)
Can someone point me out the right direction please? I can’t get it working it will not draw a marker or create the map blip