Wysłany: 2017-01-24, 18:13
saller123
Dopiero się ucze ;)
Wiek: 25 Na forum: 4680 dni Posty: 95
Nick w MP: Davitek
Piwa : 212
Witam. Jestem pocz?tkuj?cym skrypterem lua.
Tworz? panel gracza z informacjami pod przycisk "F1".
Panel wyswietla si? oraz zamyka sprawdzaj?c czy jest on otwarty lub zamkni?ty.
Doda?em na dole przycisk "Wyjd?".
Problem w tym ?e po klikni?ciu nic si? nie dzieje.
Odrazu dodam ?e przycisk u?ywa tej samej funkcji co klawisz "F1".
Prosz? o pomoc.
Kod:
Kod:
GUIEditor = {
tab = {},
tabpanel = {},
button = {},
window = {},
memo = {}
}
addEventHandler("onClientResourceStart", resourceRoot, function()
local screenW, screenH = guiGetScreenSize()
GUIEditor.window[1] = guiCreateWindow((screenW - 758) / 2, (screenH - 467) / 2, 758, 467, "Panel gracza - Informacje", false)
guiWindowSetSizable(GUIEditor.window[1], false)
GUIEditor.button[1] = guiCreateButton(635, 414, 113, 43, "Wyjd?", false, GUIEditor.window[1])
GUIEditor.tabpanel[1] = guiCreateTabPanel(10, 28, 738, 376, false, GUIEditor.window[1])
GUIEditor.tab[1] = guiCreateTab("Nazwa serwera", GUIEditor.tabpanel[1])
GUIEditor.memo[1] = guiCreateMemo(10, 10, 718, 332, "Opisz sw?j serwer", false, GUIEditor.tab[1])
guiMemoSetReadOnly(GUIEditor.memo[1], true)
GUIEditor.tab[2] = guiCreateTab("Jak zacz?? gr??", GUIEditor.tabpanel[1])
GUIEditor.memo[2] = guiCreateMemo(10, 10, 718, 332, "Tutaj napisz jak nowy gracz ma zacz?? gr?. Opisz np. ceny samochod?w, gdzie zda? prawo jazdy itp.", false, GUIEditor.tab[2])
guiMemoSetReadOnly(GUIEditor.memo[2], true)
GUIEditor.tab[3] = guiCreateTab("Regulamin", GUIEditor.tabpanel[1])
GUIEditor.memo[3] = guiCreateMemo(10, 10, 718, 332, "Tu napisz regulamin.", false, GUIEditor.tab[3])
guiMemoSetReadOnly(GUIEditor.memo[3], true)
GUIEditor.tab[4] = guiCreateTab("Komendy", GUIEditor.tabpanel[1])
GUIEditor.memo[4] = guiCreateMemo(10, 10, 718, 332, "Tu daj liste komend dla nowego gracza.", false, GUIEditor.tab[4])
guiMemoSetReadOnly(GUIEditor.memo[4], true)
GUIEditor.tab[5] = guiCreateTab("Animacje", GUIEditor.tabpanel[1])
GUIEditor.memo[5] = guiCreateMemo(10, 10, 718, 332, "Wpisz list? komend na animacje je?li s?.", false, GUIEditor.tab[5])
guiMemoSetReadOnly(GUIEditor.memo[5], true)
GUIEditor.tab[6] = guiCreateTab("Premium", GUIEditor.tabpanel[1])
GUIEditor.tab[7] = guiCreateTab("Profil", GUIEditor.tabpanel[1])
end
)
local panelwlaczony = 0
function PanelGracza()
if(panelwlaczony == 0) then
guiSetVisible(GUIEditor.window[1], true)
guiSetVisible(GUIEditor.button[1], true)
showCursor(true)
panelwlaczony = 1
elseif(panelwlaczony == 1) then
guiSetVisible(GUIEditor.window[1], false)
guiSetVisible(GUIEditor.button[1], false)
showCursor(false)
panelwlaczony = 0
end
end
bindKey("F1","down",PanelGracza)
addEventHandler ( "onClientGUIClick", GUIEditor.button[1], PanelGracza)
addEventHandler ( "onClientGUIClick", GUIEditor.button[1], PanelGracza, true )
Wysłany: 2017-01-24, 19:11
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
GUIEditor = {
tab = {},
tabpanel = {},
button = {},
window = {},
memo = {}
}
addEventHandler ( "onClientResourceStart" , resourceRoot , function()
local screenW , screenH = guiGetScreenSize ()
GUIEditor . window [ 1 ] = guiCreateWindow (( screenW - 758 ) / 2 , ( screenH - 467 ) / 2 , 758 , 467 , "Panel gracza - Informacje" , false )
guiWindowSetSizable ( GUIEditor . window [ 1 ], false )
GUIEditor . button [ 1 ] = guiCreateButton ( 635 , 414 , 113 , 43 , "Wyjd?" , false , GUIEditor . window [ 1 ])
GUIEditor . tabpanel [ 1 ] = guiCreateTabPanel ( 10 , 28 , 738 , 376 , false , GUIEditor . window [ 1 ])
GUIEditor . tab [ 1 ] = guiCreateTab ( "Nazwa serwera" , GUIEditor . tabpanel [ 1 ])
GUIEditor . memo [ 1 ] = guiCreateMemo ( 10 , 10 , 718 , 332 , "Opisz sw?j serwer" , false , GUIEditor . tab [ 1 ])
guiMemoSetReadOnly ( GUIEditor . memo [ 1 ], true )
GUIEditor . tab [ 2 ] = guiCreateTab ( "Jak zacz?? gr??" , GUIEditor . tabpanel [ 1 ])
GUIEditor . memo [ 2 ] = guiCreateMemo ( 10 , 10 , 718 , 332 , "Tutaj napisz jak nowy gracz ma zacz?? gr?. Opisz np. ceny samochod?w, gdzie zda? prawo jazdy itp." , false , GUIEditor . tab [ 2 ])
guiMemoSetReadOnly ( GUIEditor . memo [ 2 ], true )
GUIEditor . tab [ 3 ] = guiCreateTab ( "Regulamin" , GUIEditor . tabpanel [ 1 ])
GUIEditor . memo [ 3 ] = guiCreateMemo ( 10 , 10 , 718 , 332 , "Tu napisz regulamin." , false , GUIEditor . tab [ 3 ])
guiMemoSetReadOnly ( GUIEditor . memo [ 3 ], true )
GUIEditor . tab [ 4 ] = guiCreateTab ( "Komendy" , GUIEditor . tabpanel [ 1 ])
GUIEditor . memo [ 4 ] = guiCreateMemo ( 10 , 10 , 718 , 332 , "Tu daj liste komend dla nowego gracza." , false , GUIEditor . tab [ 4 ])
guiMemoSetReadOnly ( GUIEditor . memo [ 4 ], true )
GUIEditor . tab [ 5 ] = guiCreateTab ( "Animacje" , GUIEditor . tabpanel [ 1 ])
GUIEditor . memo [ 5 ] = guiCreateMemo ( 10 , 10 , 718 , 332 , "Wpisz list? komend na animacje je?li s?." , false , GUIEditor . tab [ 5 ])
guiMemoSetReadOnly ( GUIEditor . memo [ 5 ], true )
GUIEditor . tab [ 6 ] = guiCreateTab ( "Premium" , GUIEditor . tabpanel [ 1 ])
GUIEditor . tab [ 7 ] = guiCreateTab ( "Profil" , GUIEditor . tabpanel [ 1 ])
end
)
local panelwlaczony = 0
function PanelGracza ()
if( panelwlaczony == 0 ) then
guiSetVisible ( GUIEditor . window [ 1 ], true )
guiSetVisible ( GUIEditor . button [ 1 ], true )
showCursor ( true )
panelwlaczony = 1
elseif( panelwlaczony == 1 ) then
guiSetVisible ( GUIEditor . window [ 1 ], false )
guiSetVisible ( GUIEditor . button [ 1 ], false )
showCursor ( false )
panelwlaczony = 0
end
end
bindKey ( "F1" , "down" , PanelGracza )
addEventHandler ( "onClientGUIClick" , getRootElement (), function()
if source ~= GUIEditor . button [ 1 ] then return end
guiSetVisible ( GUIEditor . window [ 1 ], false )
showCursor ( false )
end )
Tagi: onclientguiclick :: nie :: działa.
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: