diff --git a/resources/[framework]/[addons]/rv-maphold/client.lua b/resources/[framework]/[addons]/rv-maphold/client.lua new file mode 100644 index 00000000..0ebc6ac1 --- /dev/null +++ b/resources/[framework]/[addons]/rv-maphold/client.lua @@ -0,0 +1,120 @@ +--[[ + 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 + +----------------------------------------- +-- Verifică dacă playerul are item 'map' +----------------------------------------- +local function HasMap() + return exports['qb-inventory']:HasItem('map', 1) +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) diff --git a/resources/[framework]/[addons]/rv-maphold/fxmanifest.lua b/resources/[framework]/[addons]/rv-maphold/fxmanifest.lua new file mode 100644 index 00000000..c8831049 --- /dev/null +++ b/resources/[framework]/[addons]/rv-maphold/fxmanifest.lua @@ -0,0 +1,10 @@ +fx_version 'cerulean' +game 'gta5' +lua54 'yes' + +author 'Red Valley' +description 'Hartă fizică: animație + blip hiding fără item' +version '1.0.0' + +client_script 'client.lua' +server_script 'server.lua' diff --git a/resources/[framework]/[addons]/rv-maphold/server.lua b/resources/[framework]/[addons]/rv-maphold/server.lua new file mode 100644 index 00000000..7a92d172 --- /dev/null +++ b/resources/[framework]/[addons]/rv-maphold/server.lua @@ -0,0 +1,8 @@ +--[[ + rv-maphold — Server + Harta se dă prin QBShared.StarterItems (qb-core/shared/main.lua) + Acest fișier e păstrat pentru eventuale comenzi admin sau shop +]] + +-- Nimic de făcut aici — harta se dă la crearea personajului prin StarterItems +-- Fișierul poate fi extins mai târziu cu shop/comenzi admin diff --git a/resources/[framework]/[core]/qb-core/shared/items.lua b/resources/[framework]/[core]/qb-core/shared/items.lua index 48cf9be5..17dcf079 100644 --- a/resources/[framework]/[core]/qb-core/shared/items.lua +++ b/resources/[framework]/[core]/qb-core/shared/items.lua @@ -258,6 +258,7 @@ QBShared.Items = { ['driver_license'] = {['name'] = 'driver_license', ['label'] = 'Drivers License', ['weight'] = 0, ['type'] = 'item', ['image'] = 'driver_license.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil, ['description'] = 'Permit to show you can drive a vehicle'}, ['lawyerpass'] = {['name'] = 'lawyerpass', ['label'] = 'Lawyer Pass', ['weight'] = 0, ['type'] = 'item', ['image'] = 'lawyerpass.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil, ['description'] = 'Pass exclusive to lawyers to show they can represent a suspect'}, ['weaponlicense'] = {['name'] = 'weaponlicense', ['label'] = 'Weapon License', ['weight'] = 0, ['type'] = 'item', ['image'] = 'weapon_license.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Weapon License'}, + ['map'] = {['name'] = 'map', ['label'] = 'Harta', ['weight'] = 100, ['type'] = 'item', ['image'] = 'map.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'O hartă a orașului Los Santos'}, ['visa'] = {['name'] = 'visa', ['label'] = 'Visa Card', ['weight'] = 0, ['type'] = 'item', ['image'] = 'visacard.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil, ['description'] = 'Visa can be used via ATM'}, ['mastercard'] = {['name'] = 'mastercard', ['label'] = 'Master Card', ['weight'] = 0, ['type'] = 'item', ['image'] = 'mastercard.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil, ['description'] = 'MasterCard can be used via ATM'}, ['security_card_01'] = {['name'] = 'security_card_01', ['label'] = 'Security Card A', ['weight'] = 0, ['type'] = 'item', ['image'] = 'security_card_01.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'A security card... I wonder what it goes to'}, diff --git a/resources/[framework]/[core]/qb-core/shared/main.lua b/resources/[framework]/[core]/qb-core/shared/main.lua index d369910e..184d3f1e 100644 --- a/resources/[framework]/[core]/qb-core/shared/main.lua +++ b/resources/[framework]/[core]/qb-core/shared/main.lua @@ -5,6 +5,7 @@ local NumberCharset = {} QBShared.StarterItems = { ['phone'] = { amount = 1, item = 'phone' }, + ['map'] = { amount = 1, item = 'map' }, -- id_card: se primește la mugshot (0r_idcard) nu la spawn -- * TODO: spawn_mask — item custom cu script usable care aplică masca specifică (134/2 male, 134/3 female) -- ['spawn_mask'] = { amount = 1, item = 'spawn_mask' }, diff --git a/resources/[framework]/[core]/qs-inventory/html/images/map.png b/resources/[framework]/[core]/qs-inventory/html/images/map.png new file mode 100644 index 00000000..fb04b5d6 Binary files /dev/null and b/resources/[framework]/[core]/qs-inventory/html/images/map.png differ diff --git a/resources/[framework]/[core]/qs-inventory/shared/items.lua b/resources/[framework]/[core]/qs-inventory/shared/items.lua index 117ac3ee..2ebdd1c1 100644 --- a/resources/[framework]/[core]/qs-inventory/shared/items.lua +++ b/resources/[framework]/[core]/qs-inventory/shared/items.lua @@ -2369,6 +2369,19 @@ ItemList = { ['object'] = 'prop_cs_swipe_card', ['description'] = 'Weapon License' }, + ['map'] = { + ['name'] = 'map', + ['label'] = 'Hartă', + ['weight'] = 100, + ['type'] = 'item', + ['image'] = 'map.png', + ['unique'] = false, + ['useable'] = true, + ['shouldClose'] = true, + ['combinable'] = nil, + ['object'] = 'prop_tourist_map_01', + ['description'] = 'O hartă a orașului Los Santos' + }, ['creditcard'] = { ['name'] = 'creditcard', ['label'] = 'Credit Card',