local isMusicPlaying = false local sound = false local secondSound = false local guitarObject = false local guitarGUI = false -- Rock müziği çalma fonksiyonu local function playRockMusic() sound = playSound("sarki1.mp3") setSoundMaxDistance(sound, 20) return sound end -- Klasik müziği çalma fonksiyonu local function playClassicMusic() secondSound = playSound("sarki2.mp3") setSoundMaxDistance(secondSound, 20) return secondSound end -- Rock müziği durdurma fonksiyonu local function stopRockMusic() if isElement(sound) then stopSound(sound) destroyElement(sound) end end -- Klasik müziği durdurma fonksiyonu local function stopClassicMusic() if isElement(secondSound) then stopSound(secondSound) destroyElement(secondSound) end end -- Gitar objesini kaldırma fonksiyonu local function removeGuitarObject() if isElement(guitarObject) then destroyElement(guitarObject) guitarObject = false end end -- Gitar seçimini işleme fonksiyonu local function handleGuitarSelection(button) if button == "left" then if not isMusicPlaying then local selectedRow, selectedCol = guiGridListGetSelectedItem(guitarGridList) if selectedRow ~= -1 and selectedCol ~= -1 then local music = guiGridListGetItemText(guitarGridList, selectedRow, selectedCol) if music == "Orhan Gencebay - Dilenci" then triggerServerEvent("onPlayerPlayGuitar", localPlayer, "rock") elseif music == "Murat Göğebakan - Ayyüzlüm" then triggerServerEvent("onPlayerPlayGuitar", localPlayer, "classic") end end end end end -- Gitar komutunu işleme addCommandHandler("guitar", function() guitarGUI = guiCreateWindow(0.4, 0.4, 0.2, 0.2, "Vinicius - Gitar Sistemi 0.1", true) guitarGridList = guiCreateGridList(0.05, 0.1, 0.9, 0.6, true, guitarGUI) guiGridListAddColumn(guitarGridList, "Müzik Listesi", 0.9) guiGridListSetItemText(guitarGridList, guiGridListAddRow(guitarGridList), 1, "Orhan Gencebay - Dilenci", false, false) guiGridListSetItemText(guitarGridList, guiGridListAddRow(guitarGridList), 1, "Murat Göğebakan - Ayyüzlüm", false, false) addEventHandler("onClientGUIDoubleClick", guitarGridList, function() handleGuitarSelection("left") end) local closeButton = guiCreateButton(0.1, 0.8, 0.8, 0.1, "Kapat", true, guitarGUI) addEventHandler("onClientGUIClick", closeButton, function() stopRockMusic() stopClassicMusic() removeGuitarObject() isMusicPlaying = false guiSetVisible(guitarGUI, false) end) end) -- Diğer oyuncuların gitar çalmasını işleme addEvent("onPlayerPlayGuitarClient", true) addEventHandler("onPlayerPlayGuitarClient", root, function(player, musicType) if musicType == "rock" then playRockMusic() elseif musicType == "classic" then playClassicMusic() end isMusicPlaying = true guitarObject = createObject(2226, 0, 0, 0) attachElements(guitarObject, player, 0.50, -0.3, -0.3, 90, 100, 0) setPedAnimation(player, "crib", "ped_console_loop", -1, true, false, false) end)