Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2012-03-18, 12:53


Adrian1545







Wiek: 30
Na forum: 5646 dni
Posty: 78
Nick w MP: [sXc]Lexon

Piwa: 125

Respekt: 55

Witam. Chcia? bym zrobic skrypt do muzyki aby sz?o w gui robic g?o?niej i ciszej muzyke. Problem polega w tym ze nie wiem jak zrobic Volume 0d 0 do 100.
Prosz? o pomoc

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-03-18, 13:41


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Adrian masz Skrypt

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-03-19, 11:19


Adrian1545







Wiek: 30
Na forum: 5646 dni
Posty: 78
Nick w MP: [sXc]Lexon

Piwa: 125

Respekt: 55

luki. Napisa?em ?e chcia? bym zrobi? a nie gotowca.

Moja praca zatrzyma?a sie na tym ze nie wiem jak przypisac przycisk gui do tego:
setSoundVolume(sound, + 0.25)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-03-19, 14:07


Jacob

Głupiomądry






Wiek: 28
Na forum: 5502 dni
Posty: 967
Nick w MP: Jacob

Piwa: 786

Respekt: 212,3
Respekt: 212,3Respekt: 212,3

Dodajesz event do buttona onClientGUIClick do funkcji
Kod:

function nazwa ()
local get = getSoundVolume(sound)
if (get) then
setSoundVolume(sound, get+0.25)
end
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-03-19, 18:50


Adrian1545







Wiek: 30
Na forum: 5646 dni
Posty: 78
Nick w MP: [sXc]Lexon

Piwa: 125

Respekt: 55

M?g? by? da? przyk?ad ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-03-19, 19:28


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Kod:

function dodaj (cmd player)
local get = getSoundVolume(sound)
if (get) then
setSoundVolume(sound, get+0.5)
end
end



Jacob ale pytanie

"Jacob" napisał/a:


Kod:


if (get) then


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-03-19, 19:44


Adrian1545







Wiek: 30
Na forum: 5646 dni
Posty: 78
Nick w MP: [sXc]Lexon

Piwa: 125

Respekt: 55

Prosze o pomoc.
Kod:

function pokaz()
okno = guiCreateWindow(0.3379,0.3164,0.3682,0.263,"music",true)
glo = guiCreateButton(16,97,161,29,"g?osniej",false,okno)
ci = guiCreateButton(199,97,161,29,"ciszej",false,okno)
wyjdz = guiCreateButton(100,150,161,29,"Wyjdz",false,okno)
showCursor(true)
end


addCommandHandler( "music",pokaz)
addEvent("music",true)
addEventHandler("music",getRootElement(),pokaz)

song = playSound("music.mp3",true)



function nazwa ()
local get = getSoundVolume(song)
if (source == glo) then
setSoundVolume(song, -0.25)
end
end
addEventHandler ("onClientGUIClick", glo, nazwa)


function onGuiClick (button, state, absoluteX, absoluteY)
if (source == wyjdz) then
guiSetVisible(okno,false)
showCursor(false)
end
end
addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-03-19, 20:13


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Kod:

okno = guiCreateWindow(0.3379,0.3164,0.3682,0.263,"music",true)
glo = guiCreateButton(16,97,161,29,"g?osniej",false,okno)
ci = guiCreateButton(199,97,161,29,"ciszej",false,okno)
wyjdz = guiCreateButton(100,150,161,29,"Wyjdz",false,okno)
showCursor(true)


function open()
if(guiGetVisible(main) == false)then
guiSetVisible(main, true)
showCursor(true)
end
end
addCommandHandler("open", open)



function piosenka ()
local sound = playSound("sounds/wasted.mp3") setSoundVolume(sound, 0.5)end

addEventHandler("onClientPlayerWasted", getLocalPlayer(), wasted)


function buttons()
if(source == ci)then
if(id == 0)then
outputChatBox("Nie mo?e spa?? poni?ej0 !", 255, 0, 0)
else
id = id - 1
playSoundFrontEnd(tonumber(id))
guiSetText(sound_id, tostring(id))
end
elseif(source == glo)then
if(id == 101)then
outputChatBox("Nie mo?na przej?? powy?ej 101!", 255, 0, 0)
else
id = id + 1
playSoundFrontEnd(tonumber(id))
guiSetText(sound_id, tostring(id))
end
end
end
addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), buttons)


cos z
id = id -1
i
id = id + 1

Ostatnio zmieniony przez luki123luki123 2012-03-19, 20:35, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-03-19, 20:15


Adrian1545







Wiek: 30
Na forum: 5646 dni
Posty: 78
Nick w MP: [sXc]Lexon

Piwa: 125

Respekt: 55

Tak mam.
Napisz mi na gg:
2222277X
x-9

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-03-19, 20:27


Jacob

Głupiomądry






Wiek: 28
Na forum: 5502 dni
Posty: 967
Nick w MP: Jacob

Piwa: 786

Respekt: 212,3
Respekt: 212,3Respekt: 212,3

Kod:

gui_okno = {}
gui_butt = {}

gui_okno[1] = guiCreateWindow(0.3379,0.3164,0.3682,0.263,"music",true)
guiSetVisible(gui_okno[1], false)
gui_butt[1] = guiCreateButton(16,97,161,29,"g?osniej",false,okno)
gui_butt[2] = guiCreateButton(199,97,161,29,"ciszej",false,okno)
gui_butt[3] = guiCreateButton(100,150,161,29,"Wyjdz",false,okno)

addCommandHandler("music",
function ()
guiSetVisible(gui_okno[1], false)
showCursor(true)
end)

song = playSound("music.mp3",true)

function nazwa ()
local get = getSoundVolume(song)
if (source == gui_butt[2]) then
setSoundVolume(song, get-0.25)
end
end
addEventHandler ("onClientGUIClick", gui_butt[2], nazwa)

function nazwa2 ()
local get = getSoundVolume(song)
if (source == gui_butt[1]) then
setSoundVolume(song, get+0.25)
end
end
addEventHandler ("onClientGUIClick", gui_butt[1], nazwa2)


function onGuiClick ()
if (source == gui_butt[3]) then
guiSetVisible(gui_okno[1], false)
showCursor(false)
end
end
addEventHandler ("onClientGUIClick", gui_butt[3], onGuiClick)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-03-19, 20:36


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

jacob twoje te? z?e zobacz na to

Kod:

okno = guiCreateWindow(0.3379,0.3164,0.3682,0.263,"music",true)
glo = guiCreateButton(16,97,161,29,"g?osniej",false,okno)
ci = guiCreateButton(199,97,161,29,"ciszej",false,okno)
wyjdz = guiCreateButton(100,150,161,29,"Wyjdz",false,okno)
showCursor(true)


function open()
if(guiGetVisible(main) == false)then
guiSetVisible(main, true)
showCursor(true)
end
end
addCommandHandler("open", open)



function piosenka ()
local sound = playSound("sounds/wasted.mp3") setSoundVolume(sound, 0.5)end

addEventHandler("onClientPlayerWasted", getLocalPlayer(), wasted)


function buttons()
if(source == ci)then
if(id == 0)then
outputChatBox("Nie mo?e spa?? poni?ej0 !", 255, 0, 0)
else
id = id - 1
playSoundFrontEnd(tonumber(id))
guiSetText(sound_id, tostring(id))
end
elseif(source == glo)then
if(id == 101)then
outputChatBox("Nie mo?na przej?? powy?ej 101!", 255, 0, 0)
else
id = id + 1
playSoundFrontEnd(tonumber(id))
guiSetText(sound_id, tostring(id))
end
end
end
addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), buttons)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-03-19, 20:43


Adrian1545







Wiek: 30
Na forum: 5646 dni
Posty: 78
Nick w MP: [sXc]Lexon

Piwa: 125

Respekt: 55

Jacobs, nie dziala. nawet sie panel nie zamyka

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-03-19, 21:14


Jacob

Głupiomądry






Wiek: 28
Na forum: 5502 dni
Posty: 967
Nick w MP: Jacob

Piwa: 786

Respekt: 212,3
Respekt: 212,3Respekt: 212,3

luki123luki123, gdzie masz zdefiniowane sound_id i id to jest ?ci?gni?ty kod, kt?rego nawet nie rozumiesz.

Adrian1545, co jest w debugu?

@EDIT:
Znalaz?em b??d w komendzie music da?em funkcje zamykania okna -.-
Kod:

gui_okno = {}
gui_butt = {}

gui_okno[1] = guiCreateWindow(0.3379,0.3164,0.3682,0.263,"music",true)
guiSetVisible(gui_okno[1], false)
gui_butt[1] = guiCreateButton(16,97,161,29,"g?osniej",false,okno)
gui_butt[2] = guiCreateButton(199,97,161,29,"ciszej",false,okno)
gui_butt[3] = guiCreateButton(100,150,161,29,"Wyjdz",false,okno)

addCommandHandler("music",
function ()
guiSetVisible(gui_okno[1], true)
showCursor(true)
end)

song = playSound("music.mp3",true)

function nazwa ()
local get = getSoundVolume(song)
if (source == gui_butt[2]) then
setSoundVolume(song, get-0.25)
end
end
addEventHandler ("onClientGUIClick", gui_butt[2], nazwa)

function nazwa2 ()
local get = getSoundVolume(song)
if (source == gui_butt[1]) then
setSoundVolume(song, get+0.25)
end
end
addEventHandler ("onClientGUIClick", gui_butt[1], nazwa2)


function onGuiClick ()
if (source == gui_butt[3]) then
guiSetVisible(gui_okno[1], false)
showCursor(false)
end
end
addEventHandler ("onClientGUIClick", gui_butt[3], onGuiClick)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-03-19, 21:20


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Haha to m?j kod w?asny

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-03-19, 21:38


Jacob

Głupiomądry






Wiek: 28
Na forum: 5502 dni
Posty: 967
Nick w MP: Jacob

Piwa: 786

Respekt: 212,3
Respekt: 212,3Respekt: 212,3

Ta, tylko w tym kodzie nic do niczego nie pasuje.

Postaw piwo autorowi tego posta
 

 
Tagi: muzyka :: volume
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Muzyka Volume Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku