Sign in to follow this  
toxicsmoke11

simple gui problem

Recommended Posts

hi i am developing my own admin panel and i've run into a simple problem

e.g when banning a player by pressing a button

  
--i want only that a player gets banned if he (his row) is selected in a gridlist 
  
-- i am using this check 
   if guiGridListGetSelectedItem(playerList) then 
  
--event 
addEventHandler("onClientGUIClick",root,onAdminClick) 
  

problem is that i can ban a player even if i didn't select anyone on the gridlist -- in that case a random player gets banned

am i using this function wrongly or do i need to do additional check or what?

please help

Share this post


Link to post

compare it with what?

local row = guiGridListGetSelectedItem(playerList) 
local gridText = guiGridListGetItemText(playerList,row,playerColumn) 
   if row and gridText then 

i got nothing selected and it still passes through

Share this post


Link to post
local row = guiGridListGetSelectedItem(playerList) 
if row then 
    local gridText = guiGridListGetItemText(playerList,row,playerColumn) 
    if gridText ~= "" then 

Share this post


Link to post

If it's a grid list then you don't need to compare the item text with anything. -1 is the selected item if no item is selected, so you just need to make sure that the selected item index is not -1.

if guiGridListGetSelectedItem(playerList) ~= -1 then 

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.