iFoReX Posted April 29, 2012 Posted April 29, 2012 I have a problem with a row , I dont know how put a event onClientGUIClick here my code cl-side GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Window[1] = guiCreateWindow(0,0.0017,0.3575,0.8917,"",true) GUIEditor_Grid[1] = guiCreateGridList(10,28,108,193,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) column1 = guiGridListAddColumn(GUIEditor_Grid[1],"Ciudades",0.-- s8) --> row1 = guiGridListAddRow(GUIEditor_Grid[1]) row2 = guiGridListAddRow(GUIEditor_Grid[1]) row3 = guiGridListAddRow(GUIEditor_Grid[1]) row4 = guiGridListAddRow(GUIEditor_Grid[1]) GUIEditor_Grid[2] = guiCreateGridList(11,242,125,193,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[2],2) column2 = guiGridListAddColumn(GUIEditor_Grid[2],"Categorias",0.-- s8) --> row5 = guiGridListAddRow(GUIEditor_Grid[2]) row6 = guiGridListAddRow(GUIEditor_Grid[2]) row7 = guiGridListAddRow(GUIEditor_Grid[2]) row8 = guiGridListAddRow(GUIEditor_Grid[2]) row9 = guiGridListAddRow(GUIEditor_Grid[2]) row10 = guiGridListAddRow(GUIEditor_Grid[2]) row11 = guiGridListAddRow(GUIEditor_Grid[2]) row12 = guiGridListAddRow(GUIEditor_Grid[2]) GUIEditor_Grid[3] = guiCreateGridList(146,241,131,195,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[3],2) guiGridListAddColumn(GUIEditor_Grid[3],"Personajes",0.-- s8) --> GUIEditor_Memo[1] = guiCreateMemo(123,52,157,168,"",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Label[1] = guiCreateLabel(160,29,72,15,"Informacion",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Button[1] = guiCreateButton(146,482,131,44,"Spawn",false,GUIEditor_Window[1]) GUIEditor_Label[2] = guiCreateLabel(11,504,127,17,"GUI Creada por ElMota",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(17,445,35,22,"<",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(77,445,35,22,">",false,GUIEditor_Window[1]) GUIEditor_Edit[1] = guiCreateEdit(54,444,22,22,"",false,GUIEditor_Window[1]) guiEditSetReadOnly(GUIEditor_Edit[1],true) guiSetVisible(GUIEditor_Window[1],false) showCursor(false) addEvent("onVisibleGUI", true) addEventHandler("onVisibleGUI", getLocalPlayer(), function() guiSetVisible(GUIEditor_Window[1],true) showCursor(true) end ) addEventHandler("onClientGUIClick", root, function() if source == GUIEditor_Button[1] then guiSetVisible(GUIEditor_Window[1],false) showCursor(false) setCameraTarget( localPlayer ) end end ) addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() guiGridListSetItemText(GUIEditor_Grid[2],row5,column2,"Policia", false, false) guiGridListSetItemText(GUIEditor_Grid[2],row6,column2,"Militar", false, false) guiGridListSetItemText(GUIEditor_Grid[2],row7,column2,"Taxista", false, false) guiGridListSetItemText(GUIEditor_Grid[2],row8,column2,"Medico", false, false) guiGridListSetItemText(GUIEditor_Grid[2],row9,column2,"Ladron", false, false) guiGridListSetItemText(GUIEditor_Grid[2],row10,column2,"NarcoTraficante", false, false) guiGridListSetItemText(GUIEditor_Grid[2],row11,column2,"Motosiclista", false, false) guiGridListSetItemText(GUIEditor_Grid[2],row12,column2,"Traficante de autos", false, false) guiGridListSetItemText(GUIEditor_Grid[1],row1,column1,"LS", false, false) guiGridListSetItemText(GUIEditor_Grid[1],row2,column1,"LV", false, false) guiGridListSetItemText(GUIEditor_Grid[1],row3,column1,"SF", false, false) guiGridListSetItemText(GUIEditor_Grid[1],row4,column1,"Clanes Privados", false, false) end ) addEventHandler("onClientGUIClick", root, function() if source == GUIEditor_Grid[1] then if source == row1 then triggerServerEvent("onCameraM1", getLocalPlayer()) elseif source == row2 then triggerServerEvent("onCameraM2", getLocalPlayer()) end end end ) sv-side addEventHandler("onPlayerLogin", getRootElement(), function() triggerClientEvent(source,"onVisibleGUI", source) setCameraMatrix( source, 1819.5910644531, -1151.7647705078, 319.04830932617, 1640.6226806641, -1260.4881591797, 309.66555786133 ) end ) addEvent("onCameraM1", true) addEventHandler("onCameraM1", getRootElement(), function() setCameraMatrix( source, 1819.5910644531, -1151.7647705078, 319.04830932617, 1640.6226806641, -1260.4881591797, 309.66555786133 ) end ) addEvent("onCameraM2", true) addEventHandler("onCameraM2", getRootElement(), function() setCameraMatrix( source, 2197.7358398438, 1907.6943359375, 116.85298919678, 2033.5368652344, 1914.2219238281, 95.694976806641 ) end ) the camera matrix doesnt work when I press it row 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 29, 2012 Posted April 29, 2012 guiGridListAddRow return number value, not element. if source == row1 then This condition is not satisfied. http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
iFoReX Posted April 29, 2012 Author Posted April 29, 2012 Ok.. and what function I need use for select a row ? 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 29, 2012 Posted April 29, 2012 Maybe you need this guiGridListGetSelectedItem ? http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
iFoReX Posted April 29, 2012 Author Posted April 29, 2012 But how it know what Row I select ? 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 29, 2012 Posted April 29, 2012 But how it know what Row I select ? Look in mta sources and you answer yourself this question. Read this Returns the row and column indexes of the selected item if the specified grid list is valid and has a selected item, (-1, -1) if no item is selected, false otherwise. First returned value is NUMBER of ROW. Second returned value is NUMBER of COLUMN. http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
iFoReX Posted April 29, 2012 Author Posted April 29, 2012 I dont know if it is Good I undestand a little of returns addEventHandler("onClientGUIClick", root, function() local select1 = guiGridListGetSelectedItem (GUIEditor_Grid[1], row1, column1) if (select1) then triggerServerEvent("onCameraM1", getLocalPlayer()) local select2 = guiGridListGetSelectedItem( GUIEditor_Grid[1], row2, column1 ) elseif (select2) then triggerServerEvent("onCameraM2", getLocalPlayer()) end end ) 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 29, 2012 Posted April 29, 2012 local select1 = guiGridListGetSelectedItem (GUIEditor_Grid[1], row1, column1) It's arguments ( GUIEditor_Grid[1], row1, column1 ). Not returned value! addEventHandler("onClientGUIClick", root, function() local select1 = guiGridListGetSelectedItem (GUIEditor_Grid[1], row1, column1) if (select1) then triggerServerEvent("onCameraM1", getLocalPlayer()) local select2 = guiGridListGetSelectedItem( GUIEditor_Grid[1], row2, column1 ) elseif (select2) then triggerServerEvent("onCameraM2", getLocalPlayer()) end end ) All your code wrong. You should learn lua. You not understand what you are doing! addEventHandler( 'onClientGUIClick', guiRoot, function( ) if source == GUIEditor_Grid[1] then local nRow = guiGridListGetSelectedItem( GUIEditor_Grid[1] ) if nRow ~= -1 then if nRow == 0 then triggerServerEvent( 'onCameraM1', localPlayer ) elseif nRow == 1 then triggerServerEvent( 'onCameraM2', localPlayer ) end end end end ) http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
iFoReX Posted April 29, 2012 Author Posted April 29, 2012 Kenix.. == = is = and ~= = is diferent ? 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 29, 2012 Posted April 29, 2012 Yes. Learn lua! viewtopic.php?f=148&t=40809 http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
iFoReX Posted April 29, 2012 Author Posted April 29, 2012 sorry for my ask but Exist a lua manual in spanish ? 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 29, 2012 Posted April 29, 2012 Sure http://www.lua.org/manual/5.1/es/ http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
iFoReX Posted April 29, 2012 Author Posted April 29, 2012 thank you I dont know about it lua manual *-* 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 29, 2012 Posted April 29, 2012 No problem. Learn. http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
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