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