Jump to content

[HELP]guiSetText


Cubingo

Recommended Posts

Hello, i have a problem which i tried to fix many many times, but really idk where the problem is coming from

function clickbtn ( button, state, absoluteX, absoluteY, thePlayer) 
    local getselected = guiGridListGetSelectedItem ( player_namesgrd ) 
    if ( source == slap_btn ) then 
    if getselected then 
    if not guiGetVisible ( slap_wnd ) then 
    guiSetVisible (slap_wnd, true) 
    guiBringToFront ( slap_wnd ) 
    else 
    if not getselected then 
    guiSetText ( slap_edit, "Please, select a player first" ) 
end 
end 
end 
end 
end 

( this is just a part from the script )

i think the problem is from here

    local getselected = guiGridListGetSelectedItem ( player_namesgrd ) 
  

idk how to check if he's selecting any element at the gridlist or not,, the window is showing even if i am selecting something or not...

Link to comment
function clickbtn ( button, state, absoluteX, absoluteY, thePlayer) 
    local row, col = guiGridListGetSelectedItem ( player_namesgrd ) 
    if ( source == slap_btn ) then 
        if ( row and col and row ~= -1 and col ~= -1 ) then 
            if ( not guiGetVisible ( slap_wnd ) ) then 
                guiSetVisible ( slap_wnd, true ) 
                guiBringToFront ( slap_wnd ) 
            end 
        else 
            guiSetText ( slap_edit, "Please, select a player first" ) 
        end 
    end 
end 

Try it.

Link to comment

Yea, i understand now,, i've read this in the wiki,

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.

but actually i didn't perceive what it means,, Thank you castillo

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...