WASSIm. Posted May 15, 2013 Share Posted May 15, 2013 hi guys. i have problem to row if click button exm (buttonMan) and after click click button exm (buttonWoman) is add i want change dont add : / local marker = createMarker( 773.5, -0, 999.7, 'Cylinder', 1.5, 100, 255, 100, 170 ) setElementInterior(marker, 5) Wnd = guiCreateWindow ( 0.2, 0.2, 0.50, 0.50, "Walking Style", true ) button = guiCreateButton ( 0.83, 0.06, 0.15, 0.05, "Close", true, Wnd ) button1 = guiCreateButton ( 0.83, 0.12, 0.15, 0.05, "Accepted", true, Wnd ) buttonDefault = guiCreateButton ( 0.83, 0.20, 0.15, 0.05, "Default", true, Wnd ) buttonMan = guiCreateButton ( 0.83, 0.26, 0.15, 0.05, "Man", true, Wnd ) buttonWoman = guiCreateButton ( 0.83, 0.32, 0.15, 0.05, "Woman", true, Wnd ) buttonOther = guiCreateButton ( 0.83, 0.38, 0.15, 0.05, "Other", true, Wnd ) wstyleG = guiCreateGridList(0.03, 0.06, 0.79, 0.50, true, Wnd) guiGridListAddColumn(wstyleG, "Walking Style", 0.25) guiCreateLabel ( 0.05, 0.9, 0.5, 0.2, "By WASSIm.", true, Wnd ) showCursor(false) guiSetVisible( Wnd, false ) guiWindowSetSizable( Wnd, false ) guiWindowSetMovable( Wnd, false ) Default = { {"DEFAULT", 0}, {"Normal", 54}, {"Fat", 55}, {"Muscle", 56}, } Man = { {"Man", 118}, {"Fat Man", 124}, {"Jogger Man", 125}, {"Old Man", 120}, {"Old Fat Man", 123}, } Woman = { {"Woman", 129}, {"Busy Woman", 131}, {"Sexy Woman", 132}, {"Pro Sexy Woman", 133}, {"Fat Woman", 135}, {"Jogger Woman", 136}, {"Old Woman", 134}, {"Old Fat Woman", 137}, } Other = { {"Swat", 128}, {"Gang 1", 121}, {"Gang 2", 122}, {"drinking", 126}, {"Shuffle", 119}, {"Sneak", 69}, {"Blind", 127}, } function list() if (source == buttonDefault) then for i,Default in ipairs(Default) do local row = guiGridListAddRow(wstyleG) guiGridListSetItemText(wstyleG, row, 1, tostring(Default[1]), false, false) guiGridListSetItemData(wstyleG, row, 1, tostring(Default[2])) guiSetEnabled ( buttonDefault, false ) guiSetEnabled ( buttonMan, true ) guiSetEnabled ( buttonWoman, true ) guiSetEnabled ( buttonOther, true ) end elseif (source == buttonMan) then for i,Man in ipairs(Man) do local row = guiGridListAddRow(wstyleG) guiGridListSetItemText(wstyleG, row, 1, tostring(Man[1]), false, false) guiGridListSetItemData(wstyleG, row, 1, tostring(Man[2])) guiSetEnabled ( buttonDefault, true ) guiSetEnabled ( buttonMan, false ) guiSetEnabled ( buttonWoman, true ) guiSetEnabled ( buttonOther, true ) end elseif (source == buttonWoman) then for i,Woman in ipairs(Woman) do local row = guiGridListAddRow(wstyleG) guiGridListSetItemText(wstyleG, row, 1, tostring(Woman[1]), false, false) guiGridListSetItemData(wstyleG, row, 1, tostring(Woman[2])) guiSetEnabled ( buttonDefault, true ) guiSetEnabled ( buttonMan, true ) guiSetEnabled ( buttonWoman, false ) guiSetEnabled ( buttonOther, true ) end elseif (source == buttonOther) then for i,Other in ipairs(Other) do local row = guiGridListAddRow(wstyleG) guiGridListSetItemText(wstyleG, row, 1, tostring(Other[1]), false, false) guiGridListSetItemData(wstyleG, row, 1, tostring(Other[2])) guiSetEnabled ( buttonDefault, true ) guiSetEnabled ( buttonMan, true ) guiSetEnabled ( buttonWoman, true ) guiSetEnabled ( buttonOther, false ) end end end function markerhit(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(Wnd) then guiSetVisible(Wnd, true) showCursor(true) end end end function select() if (source == button1) then local row, col = guiGridListGetSelectedItem(wstyleG) if (row and col and row ~= -1 and col ~= -1) then local models = tonumber(guiGridListGetItemData(wstyleG, row, 1)) if model ~= "" then triggerServerEvent("walking", localPlayer, models) guiSetVisible(Wnd,false) showCursor(false) end end end end function close() if (source == button) then guiSetVisible(Wnd,false) showCursor(false) end end addEventHandler("onClientGUIClick", root, list) addEventHandler("onClientGUIClick", root, close) addEventHandler("onClientGUIClick", root, select, false) addEventHandler("onClientMarkerHit", marker, markerhit) Link to comment
iPrestege Posted May 15, 2013 Share Posted May 15, 2013 -- # Client Side function list() if (source == buttonDefault) then guiGridListClear (wstyleG) for i,Default in ipairs(Default) do local row = guiGridListAddRow(wstyleG) guiGridListSetItemText(wstyleG, row, 1, tostring(Default[1]), false, false) guiGridListSetItemData(wstyleG, row, 1, tostring(Default[2])) guiSetEnabled ( buttonDefault, false ) guiSetEnabled ( buttonMan, true ) guiSetEnabled ( buttonWoman, true ) guiSetEnabled ( buttonOther, true ) end elseif (source == buttonMan) then guiGridListClear (wstyleG) for i,Man in ipairs(Man) do local row = guiGridListAddRow(wstyleG) guiGridListSetItemText(wstyleG, row, 1, tostring(Man[1]), false, false) guiGridListSetItemData(wstyleG, row, 1, tostring(Man[2])) guiSetEnabled ( buttonDefault, true ) guiSetEnabled ( buttonMan, false ) guiSetEnabled ( buttonWoman, true ) guiSetEnabled ( buttonOther, true ) end elseif (source == buttonWoman) then guiGridListClear (wstyleG) for i,Woman in ipairs(Woman) do local row = guiGridListAddRow(wstyleG) guiGridListSetItemText(wstyleG, row, 1, tostring(Woman[1]), false, false) guiGridListSetItemData(wstyleG, row, 1, tostring(Woman[2])) guiSetEnabled ( buttonDefault, true ) guiSetEnabled ( buttonMan, true ) guiSetEnabled ( buttonWoman, false ) guiSetEnabled ( buttonOther, true ) end elseif (source == buttonOther) then guiGridListClear (wstyleG) for i,Other in ipairs(Other) do local row = guiGridListAddRow(wstyleG) guiGridListSetItemText(wstyleG, row, 1, tostring(Other[1]), false, false) guiGridListSetItemData(wstyleG, row, 1, tostring(Other[2])) guiSetEnabled ( buttonDefault, true ) guiSetEnabled ( buttonMan, true ) guiSetEnabled ( buttonWoman, true ) guiSetEnabled ( buttonOther, false ) end end end Link to comment
WASSIm. Posted May 15, 2013 Author Share Posted May 15, 2013 thx so much and i have problem two button (button1) not working Link to comment
iPrestege Posted May 15, 2013 Share Posted May 15, 2013 Try to make a event for each button that's would be better . -- # Client Side addEventHandler("onClientGUIClick",buttonDefault, function ( ) guiGridListClear (wstyleG) for i,Default in ipairs(Default) do local row = guiGridListAddRow(wstyleG) guiGridListSetItemText(wstyleG, row, 1, tostring(Default[1]), false, false) guiGridListSetItemData(wstyleG, row, 1, tostring(Default[2])) guiSetEnabled ( buttonDefault, false ) guiSetEnabled ( buttonMan, true ) guiSetEnabled ( buttonWoman, true ) guiSetEnabled ( buttonOther, true ) end end,false ) addEventHandler("onClientGUIClick",buttonMan, function ( ) guiGridListClear (wstyleG) for i,Woman in ipairs(Woman) do local row = guiGridListAddRow(wstyleG) guiGridListSetItemText(wstyleG, row, 1, tostring(Woman[1]), false, false) guiGridListSetItemData(wstyleG, row, 1, tostring(Woman[2])) guiSetEnabled ( buttonDefault, true ) guiSetEnabled ( buttonMan, true ) guiSetEnabled ( buttonWoman, false ) guiSetEnabled ( buttonOther, true ) end end,false ) addEventHandler("onClientGUIClick",buttonWoman, function ( ) guiGridListClear (wstyleG) for i,Woman in ipairs(Woman) do local row = guiGridListAddRow(wstyleG) guiGridListSetItemText(wstyleG, row, 1, tostring(Woman[1]), false, false) guiGridListSetItemData(wstyleG, row, 1, tostring(Woman[2])) guiSetEnabled ( buttonDefault, true ) guiSetEnabled ( buttonMan, true ) guiSetEnabled ( buttonWoman, false ) guiSetEnabled ( buttonOther, true ) end end,false ) addEventHandler("onClientGUIClick",buttonOther, function ( ) guiGridListClear (wstyleG) for i,Other in ipairs(Other) do local row = guiGridListAddRow(wstyleG) guiGridListSetItemText(wstyleG, row, 1, tostring(Other[1]), false, false) guiGridListSetItemData(wstyleG, row, 1, tostring(Other[2])) guiSetEnabled ( buttonDefault, true ) guiSetEnabled ( buttonMan, true ) guiSetEnabled ( buttonWoman, true ) guiSetEnabled ( buttonOther, false ) end end,false ) Link to comment
WASSIm. Posted May 15, 2013 Author Share Posted May 15, 2013 Try to make a event for each button that's would be better . -- # Client Side addEventHandler("onClientGUIClick",buttonDefault, function ( ) guiGridListClear (wstyleG) for i,Default in ipairs(Default) do local row = guiGridListAddRow(wstyleG) guiGridListSetItemText(wstyleG, row, 1, tostring(Default[1]), false, false) guiGridListSetItemData(wstyleG, row, 1, tostring(Default[2])) guiSetEnabled ( buttonDefault, false ) guiSetEnabled ( buttonMan, true ) guiSetEnabled ( buttonWoman, true ) guiSetEnabled ( buttonOther, true ) end end,false ) addEventHandler("onClientGUIClick",buttonMan, function ( ) guiGridListClear (wstyleG) for i,Woman in ipairs(Woman) do local row = guiGridListAddRow(wstyleG) guiGridListSetItemText(wstyleG, row, 1, tostring(Woman[1]), false, false) guiGridListSetItemData(wstyleG, row, 1, tostring(Woman[2])) guiSetEnabled ( buttonDefault, true ) guiSetEnabled ( buttonMan, true ) guiSetEnabled ( buttonWoman, false ) guiSetEnabled ( buttonOther, true ) end end,false ) addEventHandler("onClientGUIClick",buttonWoman, function ( ) guiGridListClear (wstyleG) for i,Woman in ipairs(Woman) do local row = guiGridListAddRow(wstyleG) guiGridListSetItemText(wstyleG, row, 1, tostring(Woman[1]), false, false) guiGridListSetItemData(wstyleG, row, 1, tostring(Woman[2])) guiSetEnabled ( buttonDefault, true ) guiSetEnabled ( buttonMan, true ) guiSetEnabled ( buttonWoman, false ) guiSetEnabled ( buttonOther, true ) end end,false ) addEventHandler("onClientGUIClick",buttonOther, function ( ) guiGridListClear (wstyleG) for i,Other in ipairs(Other) do local row = guiGridListAddRow(wstyleG) guiGridListSetItemText(wstyleG, row, 1, tostring(Other[1]), false, false) guiGridListSetItemData(wstyleG, row, 1, tostring(Other[2])) guiSetEnabled ( buttonDefault, true ) guiSetEnabled ( buttonMan, true ) guiSetEnabled ( buttonWoman, true ) guiSetEnabled ( buttonOther, false ) end end,false ) thank you BUT NOW I FIXED IT Link to comment
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