Wysłany: 2019-06-26, 00:50
Yami
Mapper / Uczeń LUA
Wiek: 25 Na forum: 3059 dni Posty: 379
Piwa : 97
Siema
Mam pytanie dotycz?ce GUI
Je?li tworz? obraz za pomoc?: guiCreateStaticImage
To czy da siesi? zrobi? tak aby po najechaniu na GUIEditor.staticimage[1] ale nie klikaniu na niego to ?eby zmieni? kolor na jaki? tam ustalony albo ?eby zamiast niego pojawi? sie staticimage[2]?
Tak jak najedzie sie myszk? na zwykly button to on sie tak pod?wietla jakby, to czy da sie zamieni? obraz po najechaniu?
Za pomoc daje piwko i respekt
Wysłany: 2019-06-26, 12:19
Ragnarok
Wiek: 24 Na forum: 2732 dni Posty: 20
Piwa : 306
Trzymaj
local gui = guiCreateStaticImage ( 3 , 30 , 30 , 30 , 'image.png' , false )
showCursor ( true )
local images = {
[ 'hover' ] = {
[ gui ] = 'image2.png'
},
[ 'leave' ] = {
[ gui ] = 'image.png'
},
}
addEventHandler ( 'onClientMouseEnter' , resourceRoot ,function()
if images [ 'hover' ][ source ] then
guiStaticImageLoadImage ( source , images [ 'hover' ][ source ])
end
end )
addEventHandler ( 'onClientMouseLeave' , resourceRoot ,function()
if images [ 'leave' ][ source ] then
guiStaticImageLoadImage ( source , images [ 'leave' ][ source ])
end
end )
Więcej szczegółów
Wystawiono 1 piw(a):Yami
Wysłany: 2019-06-27, 19:34
Yami
Mapper / Uczeń LUA
Wiek: 25 Na forum: 3059 dni Posty: 379
Piwa : 97
To dzia?a lecz niestety jak mam funkcje aby po klikni?ciu buttona, w tym przypadku tego staticimage to nic si? nie dziej?
Wiesz jak zrobi? aby pogodzi? te dwie rzeczy?
Aby podmienia?o to zdj i po klikni?ciu go wykonywa?o funkcje kt?r? powinno?
Za pomoc daje respekt
Normalnie jest tak, i nie dzia?a to:
addEventHandler ( "onClientGUIClick" , GUIEditor . staticimage [ 1 ], NazwaFunkcji )
Tak te? nie dzia?a:
addEventHandler ( "onClientGUIClick" , gui , NazwaFunkcji )
gui- zmienna tego zdjecia co dales kod u gory
Jakie? pomys?y?
Wysłany: 2019-06-27, 22:17
Ragnarok
Wiek: 24 Na forum: 2732 dni Posty: 20
Piwa : 306
O ile Cie dobrze zrozumia?em, to:
local gui = guiCreateStaticImage ( 3 , 30 , 30 , 30 , 'image.png' , false )
showCursor ( true )
local images = {
[ 'hover' ] = {
[ gui ] = 'image2.png' ,
},
[ 'leave' ] = {
[ gui ] = 'image.png' ,
},
[ 'functions' ] = {
[ gui ] = function()
-- kod
end ,
},
}
addEventHandler ( 'onClientMouseEnter' , resourceRoot ,function()
if images [ 'hover' ][ source ] then
outputChatBox ( images [ 'hover' ][ source ])
end
end )
addEventHandler ( 'onClientMouseLeave' , resourceRoot ,function()
if images [ 'leave' ][ source ] then
guiStaticImageLoadImage ( source , images [ 'leave' ][ source ])
end
end )
addEventHandler ( 'onClientGUIClick' , resourceRoot ,function()
if functions [ source ] then
images [ 'functions' ][ source ]()
end
end )
Wysłany: 2019-06-28, 00:49
Yami
Mapper / Uczeń LUA
Wiek: 25 Na forum: 3059 dni Posty: 379
Piwa : 97
Niestety error w db3:
ERROR: PanelSAPD/c.lua:206: attempt to index global 'functions' (a nil value)
linijka 206:
if functions [ source ] then
Wysłany: 2019-06-28, 07:02
Ragnarok
Wiek: 24 Na forum: 2732 dni Posty: 20
Piwa : 306
Kod: if functions[source] then
zmie? na Kod: if images['functions'][source] then
Więcej szczegółów
Wystawiono 1 piw(a):Yami
Wysłany: 2019-06-30, 23:55
Yami
Mapper / Uczeń LUA
Wiek: 25 Na forum: 3059 dni Posty: 379
Piwa : 97
Niestety nie dzia?a
Ma kto? jaki? pomys??
Wysłany: 2019-07-01, 07:50
Ragnarok
Wiek: 24 Na forum: 2732 dni Posty: 20
Piwa : 306
Kod testowa?em, u mnie wszystko ?adnie dzia?a?o Poka? kod to dowiemy si? gdzie robisz b??d
Wysłany: 2019-07-01, 09:01
Yami
Mapper / Uczeń LUA
Wiek: 25 Na forum: 3059 dni Posty: 379
Piwa : 97
-- Te window1 , button1 , button2
ButtonOFF = guiCreateStaticImage ( 14 , 432 , 175 , 54 , "ButtonOFF.png" , false , Window1 )
local images = {
[ 'hover' ] = {
[ ButtonOFF ] = 'ButtonON' ,
},
[ 'leave' ] = {
[ ButtonOFF ] = ButtonOFF ,
},
[ 'functions' ] = {
[ ButtonOFF ] = function()
if hitPlayer ~= localPlayer then return end
guiSetVisible ( Window1 , false )
guiSetVisible ( Button1 , false )
guiSetVisible ( Button2 , false )
guiSetVisible ( ButtonOFF , false )
showCursor ( false )
end ,
},
}
addEventHandler ( 'onClientMouseEnter' , resourceRoot ,function()
if images [ 'hover' ][ source ] then
outputChatBox ( images [ 'hover' ][ source ])
end
end )
addEventHandler ( 'onClientMouseLeave' , resourceRoot ,function()
if images [ 'leave' ][ source ] then
guiStaticImageLoadImage ( source , images [ 'leave' ][ source ])
end
end )
addEventHandler ( 'onClientGUIClick' , resourceRoot ,function()
if functions [ source ] then
images [ 'functions' ][ source ]()
end
end )
Wysłany: 2019-07-01, 14:02
Ragnarok
Wiek: 24 Na forum: 2732 dni Posty: 20
Piwa : 306
-- Te window1 , button1 , button2
ButtonOFF = guiCreateStaticImage ( 14 , 432 , 175 , 54 , "ButtonOFF.png" , false , Window1 )
local images = {
[ 'hover' ] = {
[ ButtonOFF ] = 'ButtonON' ,
},
[ 'leave' ] = {
[ ButtonOFF ] = ButtonOFF ,
},
[ 'functions' ] = {
[ ButtonOFF ] = function()
guiSetVisible ( Window1 , false )
guiSetVisible ( Button1 , false )
guiSetVisible ( Button2 , false )
guiSetVisible ( ButtonOFF , false )
showCursor ( false )
end ,
},
}
addEventHandler ( 'onClientMouseEnter' , resourceRoot ,function()
if images [ 'hover' ][ source ] then
guiStaticImageLoadImage ( source , images [ 'hover' ][ source ])
end
end )
addEventHandler ( 'onClientMouseLeave' , resourceRoot ,function()
if images [ 'leave' ][ source ] then
guiStaticImageLoadImage ( source , images [ 'leave' ][ source ])
end
end )
addEventHandler ( 'onClientGUIClick' , resourceRoot ,function()
if functions [ source ] then
images [ 'functions' ][ source ]()
end
end )
Więcej szczegółów
Wystawiono 1 piw(a):Yami
Wysłany: 2019-07-05, 18:23
Yami
Mapper / Uczeń LUA
Wiek: 25 Na forum: 3059 dni Posty: 379
Piwa : 97
Niestety to nadal nie dzia?a, zmienia zdj?cie ale nie wykonuj? tych rzeczy co ma i jest error w db3:
ERROR : skrypt\c . lua : 217 : attempt to index global 'functions' ( a nil value )
ta linijka to
if functions [ source ] then
Wysłany: 2019-07-05, 18:47
NotPaladyn
Wiek: 23 Na forum: 2790 dni Posty: 866
Nick w MP: NotPaladyn
Piwa : 3135
Vice Admin: Jeśli potrzebujesz pomocy w sprawach organizacyjnych lub technicznych - skontaktuj się ze mną .
Zamie? na to i b?dzie git, u mnie dzia?a?o
if images [ 'functions' ][ source ] then
Więcej szczegółów
Wystawiono 1 piw(a):Yami
Wysłany: 2019-07-05, 18:53
Yami
Mapper / Uczeń LUA
Wiek: 25 Na forum: 3059 dni Posty: 379
Piwa : 97
NotPaladyn , dzia?a!
Dzi?ki bardzo
Dla was obu leci piwko
Tagi: gui
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: