1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-07-11 22:36:21 +02:00
parent 441f16f8b3
commit e2de9b688d
2 changed files with 53 additions and 0 deletions

View file

@ -35,6 +35,43 @@ if not Strings then
end
local magnetFishing = false
local lastDispatchTime = 0
-- Funktion für Polizeimeldungen
local function SendPoliceAlert(coords, itemName)
if not Config.policeAlert.enabled then return end
-- Prüfe Cooldown
local currentTime = GetGameTimer()
if (currentTime - lastDispatchTime) < Config.policeAlert.cooldown then
return
end
-- Bestimme die Chance basierend auf dem Item
local alertChance = Config.policeAlert.chance
if Config.suspiciousItems[itemName] then
alertChance = Config.suspiciousItems[itemName]
end
-- Zufallschance für Meldung
if math.random(1, 100) > alertChance then
return
end
-- Setze Cooldown-Timer
lastDispatchTime = currentTime
-- Sende Meldung über ps-dispatch
local streetName = GetStreetNameFromHashKey(GetStreetNameAtCoord(coords.x, coords.y, coords.z))
exports['ps-dispatch']:MagnetFishing({
coords = coords,
streetName = streetName,
gender = IsPedMale(cache.ped) and 'männlich' or 'weiblich',
model = GetEntityModel(cache.ped),
itemName = itemName
})
end
if Config.sellShop.enabled then
CreateThread(function()
@ -165,6 +202,8 @@ local function StartMagnetFishingProcess(selectedMagnet, waterLoc)
TaskPlayAnim(cache.ped, 'amb@world_human_hammering@male@base', 'base', 8.0, -8.0, -1, 16, 0, false, false, false)
Wait(1500)
TryMagnetFind(findData)
-- Sende Polizeimeldung nach erfolgreichem Fund
SendPoliceAlert(GetEntityCoords(cache.ped), findData.item)
TaskPlayAnim(cache.ped, 'amb@world_human_hang_out_street@male_c@base', 'base', 8.0, -8.0, -1, 1, 0, false, false, false)
-- Check for magnet loss

View file

@ -84,3 +84,17 @@ AddEventHandler('nordi_magnetfishing:notify', function(title, message, msgType)
})
end
end)
Config.policeAlert = {
enabled = true, -- Aktiviere/Deaktiviere Polizeimeldungen
chance = 15, -- Prozentuale Chance (15%), dass eine Meldung ausgelöst wird
cooldown = 5 * 60000, -- Cooldown zwischen Meldungen (5 Minuten)
requiredJob = {"police"} -- Jobs, die die Meldung erhalten sollen
}
-- Verschiedene Wahrscheinlichkeiten für verdächtige Gegenstände
Config.suspiciousItems = {
["old_gun"] = 75, -- 75% Chance für eine Meldung bei einer alten Pistole
["old_ammunition"] = 50, -- 50% Chance bei alter Munition
["safe"] = 90 -- 90% Chance bei einem Tresor
}