toxicsmoke11 Posted April 1, 2015 Share Posted April 1, 2015 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 Link to comment
WhoAmI Posted April 1, 2015 Share Posted April 1, 2015 Get text of selected item and compate it with == "" Link to comment
toxicsmoke11 Posted April 1, 2015 Author Share Posted April 1, 2015 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 Link to comment
WhoAmI Posted April 1, 2015 Share Posted April 1, 2015 local row = guiGridListGetSelectedItem(playerList) if row then local gridText = guiGridListGetItemText(playerList,row,playerColumn) if gridText ~= "" then Link to comment
JR10 Posted April 1, 2015 Share Posted April 1, 2015 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 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