BriGhtx3 Posted April 8, 2012 Posted April 8, 2012 Hey, I have got another problem. I've create a GUI, now when I click the button HInv_BTN_Platzieren, the function textITT should get executed. But the function gets executed whenever I click on the GUI or the gridlist... HInv_Window = guiCreateWindow(354,252,362,272,"Inv",false) guiWindowSetSizable(HInv_Window,false) HInv_Grid = guiCreateGridList(38,69,290,157,false,HInv_Window) guiGridListSetSelectionMode(HInv_Grid,2) hinvName = guiGridListAddColumn(HInv_Grid,"Name",2) HInv_BTN_Platzieren = guiCreateButton(90,231,186,22,"Platzieren",false,HInv_Window) addEventHandler("onClientGUIClick",HInv_BTN_Platzieren,function() if source == HInv_BTN_Platzieren then guiSetVisible(HInv_Window,false) textITT() end end) function textITT() outputChatBox("TEXT") end Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
Moderators Sarrum Posted April 8, 2012 Moderators Posted April 8, 2012 AddEventHandler getPropagated = false
iFoReX Posted April 8, 2012 Posted April 8, 2012 Hey,I have got another problem. I've create a GUI, now when I click the button HInv_BTN_Platzieren, the function textITT should get executed. But the function gets executed whenever I click on the GUI or the gridlist... HInv_Window = guiCreateWindow(354,252,362,272,"Inv",false) guiWindowSetSizable(HInv_Window,false) HInv_Grid = guiCreateGridList(38,69,290,157,false,HInv_Window) guiGridListSetSelectionMode(HInv_Grid,2) hinvName = guiGridListAddColumn(HInv_Grid,"Name",2) HInv_BTN_Platzieren = guiCreateButton(90,231,186,22,"Platzieren",false,HInv_Window) addEventHandler("onClientGUIClick",HInv_BTN_Platzieren,function() if source == HInv_BTN_Platzieren then guiSetVisible(HInv_Window,false) textITT() end end) function textITT() outputChatBox("TEXT") end and It ? HInv_Window = guiCreateWindow(354,252,362,272,"Inv",false) guiWindowSetSizable(HInv_Window,false) HInv_Grid = guiCreateGridList(38,69,290,157,false,HInv_Window) guiGridListSetSelectionMode(HInv_Grid,2) hinvName = guiGridListAddColumn(HInv_Grid,"Name",2) HInv_BTN_Platzieren = guiCreateButton(90,231,186,22,"Platzieren",false,HInv_Window) function click() if (source == HInv_BTN_Platzieren) then guiSetVisible(HInv_Window,false) outputChatBox("TEXT") end end ) addEventHandler("onClientGUIClick", click) elMota/elFoReX De Vuelta En MTA *---------* Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3 https://www.youtube.com/user/KillersGPs
Kenix Posted April 8, 2012 Posted April 8, 2012 ElMota, ... Can you learn? I said you more times learn it, but you not want .. https://wiki.multitheftauto.com/wiki/AddEventHandler viewtopic.php?f=148&t=40809 https://wiki.multitheftauto.com/wiki/Scr ... troduction https://wiki.multitheftauto.com/wiki/Int ... ng_the_GUI http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
iFoReX Posted April 8, 2012 Posted April 8, 2012 kenix in the last weekend I learn about scripting introduction , introduction the gui and the addeventhandler elMota/elFoReX De Vuelta En MTA *---------* Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3 https://www.youtube.com/user/KillersGPs
Guest Guest4401 Posted April 8, 2012 Posted April 8, 2012 But the function gets executed whenever I click on the GUI or the gridlist... @BriGhtx3 Your code is absolutely fine. I tested it and it only executes when you click the button. Can you recheck it please?
Kenix Posted April 8, 2012 Posted April 8, 2012 (edited) kenix in the last weekend I learn about scripting introduction , introduction the gui and the addeventhandler You need learn again! addEventHandler("onClientGUIClick", click) What is it?!! function click() if (source == HInv_BTN_Platzieren) then guiSetVisible(HInv_Window,false) outputChatBox("TEXT") end end ) And it Edited April 8, 2012 by Guest http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
drk Posted April 8, 2012 Posted April 8, 2012 kenix in the last weekend I learn about scripting introduction , introduction the gui and the addeventhandler EPT Team Server Development: 0% Learning C++ | C++ is amazing
iFoReX Posted April 8, 2012 Posted April 8, 2012 thnx for the facepalm xDD but dont do OFFTOPIC elMota/elFoReX De Vuelta En MTA *---------* Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3 https://www.youtube.com/user/KillersGPs
drk Posted April 8, 2012 Posted April 8, 2012 That's not Off-Topic. "It's really sad when your own baby knows that you're a dumbass...." -> That's the pure true. EPT Team Server Development: 0% Learning C++ | C++ is amazing
Jaysds1 Posted April 8, 2012 Posted April 8, 2012 Did you guyz know it's about BriGhtX3, not about ElMota... BriGhtx3, check your script, it looks fine and karthik184 said he looked at it. My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
BriGhtx3 Posted April 8, 2012 Author Posted April 8, 2012 I checked it again. It still doesn't work I also set getPropagated to true, but it is still the same. I also tested it on another computer and it doesn't work there as well. Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
TwiX! Posted April 8, 2012 Posted April 8, 2012 I checked it again.It still doesn't work I also set getPropagated to true, but it is still the same. I also tested it on another computer and it doesn't work there as well. its will working.. /debugscript 3? - Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]
BriGhtx3 Posted April 8, 2012 Author Posted April 8, 2012 No errors. Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
Moderators Sarrum Posted April 8, 2012 Moderators Posted April 8, 2012 Try this: addEventHandler ( "onClientGUIClick", HInv_BTN_Platzieren, function ( ) guiSetVisible ( HInv_Window, false ) textITT ( ) end, false )
drk Posted April 8, 2012 Posted April 8, 2012 Just use: addEventHandler ( 'onClientGUIClick', root, function ( ) if ( source == HInv_BTN_Platzieren ) then guiSetVisible ( HInv_Window, false ) textITT() end end ) lol EPT Team Server Development: 0% Learning C++ | C++ is amazing
BriGhtx3 Posted April 8, 2012 Author Posted April 8, 2012 Doesn't work either. I changed the code a bit and it doesn't work either. Could someone fix it? HInv_Window = guiCreateWindow(354,252,362,272,"Haushaltsinventar",false) guiWindowSetSizable(HInv_Window,false) HInv_LBL_Welcome = guiCreateLabel(34,25,305,35,"Hallo. Das ist dein Haushaltsinventar.\nVon hier aus kannst du Möbel in dein Haus platzieren.",false,HInv_Window) guiSetFont(HInv_LBL_Welcome,"default-bold-small") HInv_Grid = guiCreateGridList(38,69,290,157,false,HInv_Window) guiGridListSetSelectionMode(HInv_Grid,2) hinvName = guiGridListAddColumn(HInv_Grid,"Name",2) HInv_BTN_Platzieren = guiCreateButton(90,231,186,22,"Platzieren",false,HInv_Window) centerWindow(HInv_Window) addEventHandler("onClientGUIClick",HInv_BTN_Platzieren,function() if source == HInv_BTN_Platzieren then guiSetVisible(HInv_Window,false) TextITT() end end,false) Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
drk Posted April 8, 2012 Posted April 8, 2012 Show the full code. EPT Team Server Development: 0% Learning C++ | C++ is amazing
BriGhtx3 Posted April 8, 2012 Author Posted April 8, 2012 This is the full code. The function TextITT is: function textITT() outputChatBox("TEXT") end Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
Jaysds1 Posted April 8, 2012 Posted April 8, 2012 (edited) Try this: HInv_Window = guiCreateWindow(354,252,362,272,"Haushaltsinventar",false) guiWindowSetSizable(HInv_Window,false) --Label HInv_LBL_Welcome = guiCreateLabel(34,25,305,35,"Hallo. Das ist dein Haushaltsinventar.\nVon hier aus kannst du Möbel in dein Haus platzieren.",false,HInv_Window) guiSetFont(HInv_LBL_Welcome,"default-bold-small") --Grid HInv_Grid = guiCreateGridList(38,69,290,157,false,HInv_Window) guiGridListSetSelectionMode(HInv_Grid,2) hinvName = guiGridListAddColumn(HInv_Grid,"Name",2) --Button HInv_BTN_Platzieren = guiCreateButton(90,231,186,22,"Platzieren",false,HInv_Window) centerWindow(HInv_Window) addEventHandler("onClientGUIClick",HInv_BTN_Platzieren,function() if(source == HInv_BTN_Platzieren)then guiSetVisible(HInv_Window,false) textITT() end end,false) Edited April 8, 2012 by Guest My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
drk Posted April 8, 2012 Posted April 8, 2012 Where is centerWindow function? Jaysds1, your code will never work EPT Team Server Development: 0% Learning C++ | C++ is amazing
Jaysds1 Posted April 8, 2012 Posted April 8, 2012 Where is centerWindow function?Jaysds1, your code will never work CenterWindow My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
BriGhtx3 Posted April 8, 2012 Author Posted April 8, 2012 centerWindow is a useful function (wiki) Jay ill test your code Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
Jaysds1 Posted April 8, 2012 Posted April 8, 2012 centerWindow is a useful function (wiki) Jay ill test your code ok My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
drk Posted April 8, 2012 Posted April 8, 2012 centerWindow isn't a MTASA built-in function -.- You need put it in your code. EPT Team Server Development: 0% Learning C++ | C++ is amazing
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now