forked from Simnation/Main
[Garage]
This commit is contained in:
parent
0e0f3736ba
commit
2edc94b699
6 changed files with 54 additions and 8 deletions
|
@ -67,7 +67,7 @@ CreateThread(function()
|
||||||
if dist < spawnDistance and not isNPCSpawned then
|
if dist < spawnDistance and not isNPCSpawned then
|
||||||
SpawnGuardNPC(v.NPC)
|
SpawnGuardNPC(v.NPC)
|
||||||
Wait(300)
|
Wait(300)
|
||||||
AddTargetOptions()
|
AddTargetOptions(v)
|
||||||
elseif dist > spawnDistance and isNPCSpawned then
|
elseif dist > spawnDistance and isNPCSpawned then
|
||||||
exports['qb-target']:RemoveTargetEntity(npcHandle)
|
exports['qb-target']:RemoveTargetEntity(npcHandle)
|
||||||
RemoveGuardNPC()
|
RemoveGuardNPC()
|
||||||
|
@ -78,20 +78,22 @@ CreateThread(function()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function AddTargetOptions()
|
function AddTargetOptions(zone)
|
||||||
exports['qb-target']:AddTargetEntity(npcHandle, {
|
exports['qb-target']:AddTargetEntity(npcHandle, {
|
||||||
options = {
|
options = {
|
||||||
{
|
{
|
||||||
type = "client",
|
type = "client",
|
||||||
event = "garage:storeVehicle",
|
event = "mh_garage:storeVehicle",
|
||||||
icon = "fas fa-parking",
|
icon = "fas fa-parking",
|
||||||
label = "Fahrzeug einparken"
|
label = "Fahrzeug einparken",
|
||||||
|
item = zone
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "client",
|
type = "client",
|
||||||
event = "garage:retrieveVehicle",
|
event = "mh_garage:retrieveVehicle",
|
||||||
icon = "fas fa-car",
|
icon = "fas fa-car",
|
||||||
label = "Fahrzeug ausparken"
|
label = "Fahrzeug ausparken",
|
||||||
|
item = zone
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
distance = 2.5
|
distance = 2.5
|
||||||
|
|
3
resources/[carscripts]/mh_garage/client/retrieve.lua
Normal file
3
resources/[carscripts]/mh_garage/client/retrieve.lua
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
RegisterNetEvent('mh_garage:retrieveVehicle')
|
||||||
|
AddEventHandler('mh_garage:retrieveVehicle', function()
|
||||||
|
end)
|
37
resources/[carscripts]/mh_garage/client/stored.lua
Normal file
37
resources/[carscripts]/mh_garage/client/stored.lua
Normal 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)
|
|
@ -1,6 +1,7 @@
|
||||||
Config = {}
|
Config = {}
|
||||||
|
|
||||||
Config.Debug = true
|
Config.Debug = true
|
||||||
|
Cofig.PriceModel = false
|
||||||
Config.Zonen = {
|
Config.Zonen = {
|
||||||
{
|
{
|
||||||
name = "Meetingpoint",
|
name = "Meetingpoint",
|
3
resources/[carscripts]/mh_garage/config/price.lua
Normal file
3
resources/[carscripts]/mh_garage/config/price.lua
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
cprice = {
|
||||||
|
["asea"] = 3,
|
||||||
|
}
|
|
@ -7,12 +7,12 @@ lua54 'yes'
|
||||||
client_scripts {
|
client_scripts {
|
||||||
'@NativeUI/NativeUI.lua',
|
'@NativeUI/NativeUI.lua',
|
||||||
'@ox_lib/init.lua',
|
'@ox_lib/init.lua',
|
||||||
'config.lua',
|
'config/*.lua',
|
||||||
'client/*.lua'
|
'client/*.lua'
|
||||||
}
|
}
|
||||||
|
|
||||||
server_scripts {
|
server_scripts {
|
||||||
'@oxmysql/lib/MySQL.lua',
|
'@oxmysql/lib/MySQL.lua',
|
||||||
'config.lua',
|
'config/*.lua',
|
||||||
'server/*.lua'
|
'server/*.lua'
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue