Adde Posted January 4, 2014 Share Posted January 4, 2014 Hello, I got 1 line here that doesn´t do what it is ment to do. I have tried with "if ( guiGridListGetSelectedItem(teamGridlist) ) then" and "if guiGridListGetSelectedItem(teamGridlist) then" but non of them works. If the player haven´t selected anything in the gridlist then it should do "outputChatBox" instead of this "triggerClientEvent, showCursor and setGuiVisible". But it doesn´t work. It closes the gui even if I have selected a row in gridlist or not. Would be thankfull if I got a little help in this part. Here´s the function I need help with: function click () if guiGridListGetSelectedItem(teamGridlist) then local theRow, theCol = guiGridListGetSelectedItem(teamGridlist) local teamName = guiGridListGetItemText(teamGridlist, theRow, theCol) triggerServerEvent("chooseTeam", localPlayer, teamName) guiSetVisible(spawnWindow, false) showCursor(false) else outputChatBox("You have to choose a team before you press spawn", localPlayer, 220, 0, 0) end end addEventHandler("onClientGUIClick", spawnButton, click) Link to comment
iPrestege Posted January 4, 2014 Share Posted January 4, 2014 Hello, I got 1 line here that doesn´t do what it is ment to do. I have tried with "if ( guiGridListGetSelectedItem(teamGridlist) ) then" and "if guiGridListGetSelectedItem(teamGridlist) then" but non of them works.If the player haven´t selected anything in the gridlist then it should do "outputChatBox" instead of this "triggerClientEvent, showCursor and setGuiVisible". But it doesn´t work. It closes the gui even if I have selected a row in gridlist or not. Would be thankfull if I got a little help in this part. Here´s the function I need help with: function click () if guiGridListGetSelectedItem(teamGridlist) then local theRow, theCol = guiGridListGetSelectedItem(teamGridlist) local teamName = guiGridListGetItemText(teamGridlist, theRow, theCol) triggerServerEvent("chooseTeam", localPlayer, teamName) guiSetVisible(spawnWindow, false) showCursor(false) else outputChatBox("You have to choose a team before you press spawn", localPlayer, 220, 0, 0) end end addEventHandler("onClientGUIClick", spawnButton, click) Change it to : if guiGridListGetSelectedItem (teamGridlist) ~= -1 then And try it again. Link to comment
Adde Posted January 4, 2014 Author Share Posted January 4, 2014 Thank you, now it´s working. I think I´ve seen that solution before, but it´s easy to forget. Anyway I appreciate your help. 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