1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Miho931 2025-06-08 16:20:16 +02:00
parent 0e0f3736ba
commit 2edc94b699
6 changed files with 54 additions and 8 deletions

View file

@ -67,7 +67,7 @@ CreateThread(function()
if dist < spawnDistance and not isNPCSpawned then
SpawnGuardNPC(v.NPC)
Wait(300)
AddTargetOptions()
AddTargetOptions(v)
elseif dist > spawnDistance and isNPCSpawned then
exports['qb-target']:RemoveTargetEntity(npcHandle)
RemoveGuardNPC()
@ -78,20 +78,22 @@ CreateThread(function()
end
end)
function AddTargetOptions()
function AddTargetOptions(zone)
exports['qb-target']:AddTargetEntity(npcHandle, {
options = {
{
type = "client",
event = "garage:storeVehicle",
event = "mh_garage:storeVehicle",
icon = "fas fa-parking",
label = "Fahrzeug einparken"
label = "Fahrzeug einparken",
item = zone
},
{
type = "client",
event = "garage:retrieveVehicle",
event = "mh_garage:retrieveVehicle",
icon = "fas fa-car",
label = "Fahrzeug ausparken"
label = "Fahrzeug ausparken",
item = zone
}
},
distance = 2.5

View file

@ -0,0 +1,3 @@
RegisterNetEvent('mh_garage:retrieveVehicle')
AddEventHandler('mh_garage:retrieveVehicle', function()
end)

View file

@ -0,0 +1,37 @@
RegisterNetEvent('mh_garage:storeVehicle')
AddEventHandler('mh_garage:storeVehicle', function(zone)
local coords = GetEntityCoords(PlayerPedId())
local vehicles = GetGamePool('CVehicle')
local opt = {}
for i = 1, #vehicles, 1 do
local veh_coords = GetEntityCoords(vehicles[1])
local distance = #(veh_coords - coords)
if distance < 40.0 then
local mods = QBCore.Functions.GetVehicleProperties(vehicles[i])
table.insert(opt, {
title = "Kennzeichen: "..mods.plate,
description = "Soll dieses Fahrzeug eingeparkt werden?",
icon = "car",
onSelect = function()
if zone.price == nil then
else
local alert = lib.alertDialog({
header = "Parkplatz kosten",
content = "Parkplatkosten pro Fahrzeug: "..zone.price.."\n\nWillst du das Parkplatz trotzdem Einparken?",
centered = true,
cancel = true
})
print(alert)
print(json.encode(alert))
end
end
})
end
end
end)

View file

@ -1,6 +1,7 @@
Config = {}
Config.Debug = true
Cofig.PriceModel = false
Config.Zonen = {
{
name = "Meetingpoint",

View file

@ -0,0 +1,3 @@
cprice = {
["asea"] = 3,
}

View file

@ -7,12 +7,12 @@ lua54 'yes'
client_scripts {
'@NativeUI/NativeUI.lua',
'@ox_lib/init.lua',
'config.lua',
'config/*.lua',
'client/*.lua'
}
server_scripts {
'@oxmysql/lib/MySQL.lua',
'config.lua',
'config/*.lua',
'server/*.lua'
}