--[[ Music Marker - Client Cand jucatorul intra in marker -> porneste MP3-ul + animatia barilor Cand MP3-ul s-a terminat -> dispare animatia ]] local markerCoords = vector3(381.7529, -1076.4215, 29.5827) local markerHeading = 274.1444 -- pastrat pentru referinta local markerRange = 1.5 local isPlaying = false local wasInside = false -- Asteapta ESX sa fie incarcat (optional, dar util pe servere ESX) CreateThread(function() while GetResourceState('es_extended') ~= 'started' do Wait(500) end -- Loop principal: deseneaza marker + detecteaza intrarea while true do local sleep = 1000 local pPed = PlayerPedId() local pCoords = GetEntityCoords(pPed) local dist = #(pCoords - markerCoords) if dist < 25.0 then sleep = 0 DrawMarker( 27, -- marker type (cilindru) markerCoords.x, markerCoords.y, markerCoords.z - 0.97, 0.0, 0.0, 0.0, -- direction 0.0, 0.0, 0.0, -- rotation 1.5, 1.5, 1.0, -- scale 255, 255, 255, 100, -- color RGBA (rosu, semi-transparent) false, true, 2, false, nil, nil, false ) local inside = dist < markerRange if inside and not wasInside then wasInside = true if not isPlaying then isPlaying = true SendNUIMessage({ action = 'play' }) end elseif not inside and wasInside then wasInside = false end end Wait(sleep) end end) -- Callback de la NUI cand MP3-ul s-a terminat RegisterNUICallback('audioEnded', function(_, cb) isPlaying = false cb('ok') end) -- La oprirea resursei: opreste audio-ul curat AddEventHandler('onResourceStop', function(resource) if resource == GetCurrentResourceName() then SendNUIMessage({ action = 'stop' }) end end)