forked from Simnation/Main
Zone Einstellung geändert, da ohne Funktion
This commit is contained in:
parent
5af07673d7
commit
9c4920eaf5
3 changed files with 16 additions and 15 deletions
|
@ -3,6 +3,7 @@ QBCore = exports['qb-core']:GetCoreObject()
|
|||
Player = nil
|
||||
local npcHandle = nil
|
||||
local isNPCSpawned = false
|
||||
CurrentZone = nil
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while Player == nil do
|
||||
|
@ -79,10 +80,12 @@ CreateThread(function()
|
|||
local spawnDistance = v.NPC.distance
|
||||
|
||||
if dist < spawnDistance and not isNPCSpawned then
|
||||
CurrentZone = v
|
||||
SpawnGuardNPC(v.NPC)
|
||||
Wait(300)
|
||||
AddTargetOptions(v)
|
||||
AddTargetOptions()
|
||||
elseif dist > spawnDistance and isNPCSpawned then
|
||||
CurrentZone = nil
|
||||
exports['qb-target']:RemoveTargetEntity(npcHandle)
|
||||
RemoveGuardNPC()
|
||||
end
|
||||
|
@ -92,7 +95,7 @@ CreateThread(function()
|
|||
end
|
||||
end)
|
||||
|
||||
function AddTargetOptions(zone)
|
||||
function AddTargetOptions())
|
||||
|
||||
local opt = {
|
||||
{
|
||||
|
@ -100,14 +103,12 @@ function AddTargetOptions(zone)
|
|||
event = "mh_garage:storeVehicle",
|
||||
icon = "fas fa-parking",
|
||||
label = "Fahrzeug einparken",
|
||||
args = zone
|
||||
},
|
||||
{
|
||||
type = "client",
|
||||
event = "mh_garage:retrieveVehicle",
|
||||
icon = "fas fa-car",
|
||||
label = "Fahrzeug ausparken",
|
||||
args = zone
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,9 +127,9 @@ function AddTargetOptions(zone)
|
|||
})
|
||||
end
|
||||
|
||||
function Notification(text, type, zone)
|
||||
function Notification(text, type)
|
||||
lib.notify({
|
||||
title = "Garage - "..zone,
|
||||
title = "Garage - "..CurrentZone.name,
|
||||
description = text,
|
||||
type = type,
|
||||
position = 'top',
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
RegisterNetEvent('mh_garage:retrieveVehicle')
|
||||
AddEventHandler('mh_garage:retrieveVehicle', function(zone)
|
||||
AddEventHandler('mh_garage:retrieveVehicle', function()
|
||||
local ped = PlayerPedId()
|
||||
local coords = GetEntityCoords(ped)
|
||||
local random = SelectName()
|
||||
|
@ -26,5 +26,5 @@ AddEventHandler('mh_garage:retrieveVehicle', function(zone)
|
|||
})
|
||||
|
||||
lib.showContext("retrieveVehicle")
|
||||
end, zone.name)
|
||||
end, CurrentZone.name)
|
||||
end)
|
|
@ -1,5 +1,5 @@
|
|||
RegisterNetEvent('mh_garage:storeVehicle')
|
||||
AddEventHandler('mh_garage:storeVehicle', function(zone)
|
||||
AddEventHandler('mh_garage:storeVehicle', function()
|
||||
local ped = PlayerPedId()
|
||||
local coords = GetEntityCoords(ped)
|
||||
local vehicles = GetGamePool('CVehicle')
|
||||
|
@ -16,15 +16,15 @@ AddEventHandler('mh_garage:storeVehicle', function(zone)
|
|||
description = GetRandomCarDescription(),
|
||||
icon = "car",
|
||||
onSelect = function()
|
||||
print(zone.price)
|
||||
if zone.price ~= false then
|
||||
print(CurrentZone.price)
|
||||
if CurrentZone.price ~= false then
|
||||
lib.hideContext("StoredVehicles")
|
||||
|
||||
lib.registerContext({
|
||||
id = "thisVehicle",
|
||||
title = random.name,
|
||||
options = {
|
||||
{title = "Kosten: "..zone.price},
|
||||
{title = "Kosten: "..CurrentZone.price},
|
||||
{title = ""},
|
||||
{
|
||||
title = "Akzeptieren",
|
||||
|
@ -34,14 +34,14 @@ AddEventHandler('mh_garage:storeVehicle', function(zone)
|
|||
QBCore.Functions.TriggerCallback('mh_garage:storedVehicle', function(cb)
|
||||
if cb.status then
|
||||
DeleteVehicle(vehicles[i])
|
||||
Notification(cb.text, cb.type, zone.name)
|
||||
Notification(cb.text, cb.type, CurrentZone.name)
|
||||
else
|
||||
if cb.police and Config.EnabledPolice then
|
||||
exports["roadphone"]:sendDispatch("Hier hat grade jemand versucht, ein Fahrzeug einzuparken.\nDas Zündschloss sah Beschädigt aus.\nKennzeichen: "..veh.plate, 'police', nil)
|
||||
end
|
||||
Notification(cb.text, cb.type)
|
||||
end
|
||||
end, veh, zone)
|
||||
end, veh, CurrentZone)
|
||||
end
|
||||
},
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ AddEventHandler('mh_garage:storeVehicle', function(zone)
|
|||
|
||||
lib.showContext("thisVehicle")
|
||||
else
|
||||
StoredVehicle(vehicles[i], zone)
|
||||
StoredVehicle(vehicles[i], CurrentZone)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue