Jump to content

Help me with my panel


ksTakor

Recommended Posts

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 

Link to comment

not yet.

I don't know why don't work maybe if you see the panel it's more easy

mtascreen20130416175609.png

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

Link to comment

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 

Link to comment
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.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...