GTX Posted July 27, 2015 Share Posted July 27, 2015 Tested your script. It works fine. local x, y = 1,1 window = guiCreateWindow(519*x,214*y,347*x,282*y,"24/7 Shop",false) sevenShopList = guiCreateGridList(11*x,25*y,326*x,218*y,false,window) guiGridListSetSelectionMode(sevenShopList,0) guiGridListAddColumn(sevenShopList,"ID:",0.19,window) guiGridListAddColumn(sevenShopList,"Name:",0.48,window) guiGridListAddColumn(sevenShopList,"Price",0.18,window) buy = guiCreateButton(13*x,249*y,134*x,23*y,"Buy",false,window) reject = guiCreateButton(199*x,249*y,134*x,23*y,"Close ",false,window) guiWindowSetSizable(window,false) --guiSetVisible (window,false) local client = getLocalPlayer() Weapons = { {1,1,400}, {2,2,1500}, {5,5,550}, {6,6,700}, {7,7,850}, {8,8,1500}, {9,9,2000}, {10,10,800}, {12,12,800}, {12,12,800},{12,12,800},{12,12,800},{12,12,800},{12,12,800},{12,12,800},{12,12,800},{12,12,800} } function DD() for k,v in ipairs (Weapons) do local row = guiGridListAddRow(sevenShopList) guiGridListSetItemText(sevenShopList, row, 1,v[1], false, false) guiGridListSetItemText(sevenShopList, row, 2, getWeaponNameFromID(v[2]), false, false) guiGridListSetItemText (sevenShopList, row, 3,tostring(v[3]).."$" , false, false) end end function weaponGUI(Weapons) guiGridListClear(sevenShopList) DD() guiSetVisible(window, true) showCursor(true) end addEvent("sevenShopshowGUI",true) addEventHandler("sevenShopshowGUI",root,weaponGUI) addEventHandler("onClientGUIClick",root, function () if (source == reject) then guiSetVisible(window, false) showCursor(false) elseif (source == buy) then if (guiGridListGetSelectedItem (sevenShopList)) then local weapID = guiGridListGetItemText ( sevenShopList, guiGridListGetSelectedItem (sevenShopList) , 1 ) local weapName = guiGridListGetItemText ( sevenShopList, guiGridListGetSelectedItem (sevenShopList) , 2 ) local weapPrice = Weapons[guiGridListGetSelectedItem (sevenShopList)+1][3] local row = guiGridListAddRow ( sevenShopList ) local rowCount = guiGridListGetRowCount ( sevenShopList ) guiSetVisible(window, false) showCursor(false) triggerServerEvent("weapon_Name",getLocalPlayer(),weapID,weapName,weapPrice) end end end) -- function arr(key) outputDebugString("execute: function arr()") -- debug if isElement(sevenShopList) then local scrollPos = guiGridListGetVerticalScrollPosition(sevenShopList) outputDebugString("scrollPos: " .. tostring(scrollPos)) -- debug if key == "arrow_d" then guiGridListSetVerticalScrollPosition(sevenShopList, scrollPos+10) else guiGridListSetVerticalScrollPosition(sevenShopList, scrollPos-10) end else outputDebugString("sevenShopList isn't an element.") -- debug end end bindKey("arrow_d", "down", arr) bindKey("arrow_u", "down", arr) Link to comment
Hero192 Posted July 27, 2015 Author Share Posted July 27, 2015 OH thanks alot GTX for your efforts but you understood me by wrong i want to navigate from row to other Link to comment
GTX Posted July 27, 2015 Share Posted July 27, 2015 Oh then, guiGridListSetSelectedItem Link to comment
Hero192 Posted July 27, 2015 Author Share Posted July 27, 2015 Oh then, guiGridListSetSelectedItem I don't know how to use it, i have no experiences on that Link to comment
GTX Posted July 27, 2015 Share Posted July 27, 2015 There are many other people that need help. You should open wiki and read, if you don't know how to use it. I can't support your laziness. function arr(key) if isElement(sevenShopList) then if key == "arrow_d" then if guiGridListGetSelectedItem(sevenShopList) == guiGridListGetRowCount(sevenShopList) then return end guiGridListSetSelectedItem(sevenShopList, guiGridListGetSelectedItem(sevenShopList)+1, 1) else if guiGridListGetSelectedItem(sevenShopList) == 0 then return end guiGridListSetVerticalScrollPosition(sevenShopList, guiGridListGetSelectedItem(sevenShopList)-1, 1) end end end bindKey("arrow_d", "down", arr) bindKey("arrow_u", "down", arr) 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