feat(rv-maphold): resursa standalone harta fizica + item map in inventar
- Animatie hartă în mână (WORLD_HUMAN_TOURIST_MAP) la ESC - Blipuri ascunse fara item map in inventar - Item map adaugat in qb-core + qs-inventory items.lua - StarterItems: harta se da la crearea personajului nou - Imagine map.png GTA-style in inventar
This commit is contained in:
120
resources/[framework]/[addons]/rv-maphold/client.lua
Normal file
120
resources/[framework]/[addons]/rv-maphold/client.lua
Normal file
@@ -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)
|
||||||
10
resources/[framework]/[addons]/rv-maphold/fxmanifest.lua
Normal file
10
resources/[framework]/[addons]/rv-maphold/fxmanifest.lua
Normal file
@@ -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'
|
||||||
8
resources/[framework]/[addons]/rv-maphold/server.lua
Normal file
8
resources/[framework]/[addons]/rv-maphold/server.lua
Normal file
@@ -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
|
||||||
@@ -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'},
|
['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'},
|
['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'},
|
['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'},
|
['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'},
|
['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'},
|
['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'},
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ local NumberCharset = {}
|
|||||||
|
|
||||||
QBShared.StarterItems = {
|
QBShared.StarterItems = {
|
||||||
['phone'] = { amount = 1, item = 'phone' },
|
['phone'] = { amount = 1, item = 'phone' },
|
||||||
|
['map'] = { amount = 1, item = 'map' },
|
||||||
-- id_card: se primește la mugshot (0r_idcard) nu la spawn
|
-- 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)
|
-- * 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' },
|
-- ['spawn_mask'] = { amount = 1, item = 'spawn_mask' },
|
||||||
|
|||||||
BIN
resources/[framework]/[core]/qs-inventory/html/images/map.png
Normal file
BIN
resources/[framework]/[core]/qs-inventory/html/images/map.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 217 KiB |
@@ -2369,6 +2369,19 @@ ItemList = {
|
|||||||
['object'] = 'prop_cs_swipe_card',
|
['object'] = 'prop_cs_swipe_card',
|
||||||
['description'] = 'Weapon License'
|
['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'] = {
|
['creditcard'] = {
|
||||||
['name'] = 'creditcard',
|
['name'] = 'creditcard',
|
||||||
['label'] = 'Credit Card',
|
['label'] = 'Credit Card',
|
||||||
|
|||||||
Reference in New Issue
Block a user