Max+ Posted April 16, 2013 Posted April 16, 2013 Try This , function give(button,state) if button == "left" and state == "down" then local row,col = guiGridListGetSelectedItem(paineldayz.gridlist[1]) if (row and col and row ~= -1 and col ~= -1) then local itemName = guiGridListGetItemText(paineldayz.gridlist[1], row,col, 1) if itemName then local text = guiGetText(paineldayz.edit[1]) setElementData(localPlayer, text, itemName, true) -- code end else outputChatBox("Please select a item from the list.",220,0,0) end end end
ksTakor Posted April 16, 2013 Author Posted April 16, 2013 not yet. I don't know why don't work maybe if you see the panel it's more easy The code to give items in dayz gamemode is Ex. I wanna give an M4 setElementData(getPlayerFromName("[D.A]ksTakor"),"M4",1) and from my panel i wanna get the item name from the gridlist and the number of items from my edit box
DNL291 Posted April 17, 2013 Posted April 17, 2013 Try with: setElementData(localPlayer, itemName, text)
ksTakor Posted April 17, 2013 Author Posted April 17, 2013 I have debugged the script and I find this error: WARNING: DayzPanel\dayz_panel:154: Bad argument @ 'guiGridListGetSelectedItem' [Expected gui element at argument 1,got table] My script is this: function give (button,state) if button == "left" and state == "up" then local row,col = guiGridListGetSelectedItem(paineldayz.gridlist) if (row and col and row ~= -1 and col ~= -1) then local itemName = guiGridListGetItemText(paineldayz.gridlist, row,col, 1) if itemName then local text = guiGetText(paineldayz.edit[1]) setElementData(localPlayer, itemName, text) -- code end else outputChatBox("Please select a item from the list.",220,0,0) end end end
DNL291 Posted April 17, 2013 Posted April 17, 2013 function give (button,state) if button == "left" and state == "up" then local row,col = guiGridListGetSelectedItem(paineldayz.gridlist[1]) if (row and col and row ~= -1 and col ~= -1) then local itemName = guiGridListGetItemText(paineldayz.gridlist[1], row,col, 1) if itemName then local text = guiGetText(paineldayz.edit[1]) setElementData(localPlayer, itemName, text) -- code end else outputChatBox("Please select a item from the list.",220,0,0) end end end I forgot the table index.
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