2026-04-01 22:13:31 +03:00
|
|
|
--[[
|
|
|
|
|
rv-maphold — Red Valley
|
|
|
|
|
Adaptat din sm_map (ScriptsM) — animație + blip hiding
|
|
|
|
|
Radarul/minimap rămâne controlat de 17mov_Hud
|
|
|
|
|
|
|
|
|
|
Funcționalitate:
|
|
|
|
|
- Fără item 'map' → blipurile ascunse (harta goală), ESC merge normal
|
|
|
|
|
- Cu item 'map' → blipuri vizibile + animație hartă în mână la ESC
|
|
|
|
|
- Playerul se spawnează cu harta automat (server.lua)
|
|
|
|
|
]]
|
|
|
|
|
|
|
|
|
|
local hiddenBlips = {}
|
|
|
|
|
local mapActive = false
|
|
|
|
|
|
|
|
|
|
-----------------------------------------
|
|
|
|
|
-- Ia toate blipurile cu un sprite anume
|
|
|
|
|
-----------------------------------------
|
|
|
|
|
local function GetAllBlipsWithSprite(sprite)
|
|
|
|
|
local blips = {}
|
|
|
|
|
local blip = GetFirstBlipInfoId(sprite)
|
|
|
|
|
|
|
|
|
|
while DoesBlipExist(blip) do
|
|
|
|
|
blips[#blips + 1] = blip
|
|
|
|
|
blip = GetNextBlipInfoId(sprite)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return blips
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-----------------------------------------
|
|
|
|
|
-- Ascunde/arată blipurile de pe hartă
|
|
|
|
|
-----------------------------------------
|
|
|
|
|
local function SwitchBlips(hide)
|
|
|
|
|
if hide and next(hiddenBlips) == nil then
|
|
|
|
|
hiddenBlips = {}
|
|
|
|
|
for i = 1, 921 do
|
|
|
|
|
for _, blip in ipairs(GetAllBlipsWithSprite(i)) do
|
|
|
|
|
if DoesBlipExist(blip) then
|
|
|
|
|
SetBlipAlpha(blip, 0)
|
|
|
|
|
table.insert(hiddenBlips, blip)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if not hide and hiddenBlips then
|
|
|
|
|
for _, blip in ipairs(hiddenBlips) do
|
|
|
|
|
if DoesBlipExist(blip) then
|
|
|
|
|
SetBlipAlpha(blip, 255)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
hiddenBlips = {}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2026-04-01 22:42:06 +03:00
|
|
|
local QBCore = exports['qb-core']:GetCoreObject()
|
|
|
|
|
|
2026-04-01 22:13:31 +03:00
|
|
|
-----------------------------------------
|
|
|
|
|
-- Verifică dacă playerul are item 'map'
|
|
|
|
|
-----------------------------------------
|
|
|
|
|
local function HasMap()
|
2026-04-01 22:42:06 +03:00
|
|
|
local PlayerData = QBCore.Functions.GetPlayerData()
|
|
|
|
|
if not PlayerData or not PlayerData.items then return false end
|
|
|
|
|
for _, item in pairs(PlayerData.items) do
|
|
|
|
|
if item and item.name == 'map' and item.amount and item.amount > 0 then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return false
|
2026-04-01 22:13:31 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-----------------------------------------
|
|
|
|
|
-- Animație hartă în mână
|
|
|
|
|
-----------------------------------------
|
|
|
|
|
local function ActivateMap()
|
|
|
|
|
if mapActive then return end
|
|
|
|
|
|
|
|
|
|
-- Animația doar dacă are harta
|
|
|
|
|
if not HasMap() then return end
|
|
|
|
|
|
|
|
|
|
mapActive = true
|
|
|
|
|
local ped = PlayerPedId()
|
|
|
|
|
|
|
|
|
|
-- Holster animation (scoate harta din buzunar)
|
|
|
|
|
RequestAnimDict("melee@holster")
|
|
|
|
|
while not HasAnimDictLoaded("melee@holster") do Wait(10) end
|
|
|
|
|
TaskPlayAnim(ped, "melee@holster", "unholster", 4.0, -4.0, 300, 1, 1.0)
|
|
|
|
|
Wait(300)
|
|
|
|
|
|
|
|
|
|
-- Scenario: playerul ține harta fizică în mâini
|
|
|
|
|
TaskStartScenarioInPlace(ped, "WORLD_HUMAN_TOURIST_MAP", 0, true)
|
|
|
|
|
|
|
|
|
|
-- Monitorizează închiderea meniului
|
|
|
|
|
CreateThread(function()
|
|
|
|
|
while mapActive do
|
|
|
|
|
Wait(200)
|
|
|
|
|
if not IsPauseMenuActive() then
|
|
|
|
|
ClearPedTasks(ped)
|
|
|
|
|
TaskPlayAnim(ped, "melee@holster", "holster", 4.0, -4.0, 300, 1, 1.0)
|
|
|
|
|
mapActive = false
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-----------------------------------------
|
|
|
|
|
-- Detectează ESC / P → animație hartă
|
|
|
|
|
-- ESC NU se blochează niciodată
|
|
|
|
|
-----------------------------------------
|
|
|
|
|
CreateThread(function()
|
|
|
|
|
while true do
|
|
|
|
|
Wait(0)
|
|
|
|
|
if not IsPauseMenuActive() and (IsControlJustPressed(0, 200) or IsControlJustPressed(0, 199)) then
|
|
|
|
|
ActivateMap()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
-----------------------------------------
|
|
|
|
|
-- Loop: verifică dacă are hartă → blips
|
|
|
|
|
-- Doar ascunde blipurile, nu blochează ESC
|
|
|
|
|
-----------------------------------------
|
|
|
|
|
CreateThread(function()
|
|
|
|
|
while true do
|
|
|
|
|
Wait(1000)
|
|
|
|
|
local hasMap = HasMap()
|
|
|
|
|
SwitchBlips(not hasMap)
|
|
|
|
|
end
|
|
|
|
|
end)
|