S3Nn4oXx Posted November 11, 2015 Share Posted November 11, 2015 I need help, I created a script but I don't know how to make that all the players appears in the gridlist and if I click on them and press on the button so it affect on them Link to comment
SpecT Posted November 11, 2015 Share Posted November 11, 2015 Firstly show your code. To get full online player list (with nickname) use this: for i,player in ipairs(getElementsByType("player")) do getPlayerNametagText(player) end Note: This is just an example! Link to comment
S3Nn4oXx Posted November 11, 2015 Author Share Posted November 11, 2015 toni012899 said: Firstly show your code.To get full online player list (with nickname) use this: for i,player in ipairs(getElementsByType("player")) do getPlayerNametagText(player) end Note: This is just an example! gridlist = guiCreateGridList(565, 309, 249, 268, false) guiGridListAddColumn(gridlist, "Players", 0.9) This is the gridlist script how to add the players to this gridlist? Link to comment
SpecT Posted November 11, 2015 Share Posted November 11, 2015 function fillTable() playerTable = {} for i,player in ipairs(getElementsByType("player")) do table.insert(playerTable,getPlayerNametagText(player)) end for k,v in pairs(playerTable) do local row = guiGridListAddRow(gridlist) guiGridListSetItemText(gridlist, row,1, tostring(v[1]), false, false) end end Link to comment
Walid Posted November 11, 2015 Share Posted November 11, 2015 S3Nn4oXx said: Not working function addPlayersToGridlist() guiGridListClear(gridlist) for index, players in pairs(getElementsByType("player")) do local row = guiGridListAddRow(gridlist) local name = getPlayerName(players) guiGridListSetItemText(gridlist, row,1, name, false, false) end end Link to comment
S3Nn4oXx Posted November 11, 2015 Author Share Posted November 11, 2015 function ChokingSystem() local screenW, screenH = guiGetScreenSize() Window = guiCreateWindow((screenW - 329) / 2, (screenH - 227) / 2, 329, 227, "Choking System @SpRoXx", false) guiWindowSetSizable(Window, false) StartC = guiCreateButton(238, 187, 82, 31, "StartC", false, Window) guiSetProperty(StartC, "NormalTextColour", "FFAAAAAA") gridlist = guiCreateGridList(10, 41, 176, 174, false, Window) guiGridListAddColumn(gridlist, "Players", 0.9) label = guiCreateLabel(216, 41, 94, 37, "Select a player", false, Window) guiSetFont(label, "default-bold-small") StopC = guiCreateButton(238, 146, 82, 31, "StopC", false, Window) guiSetProperty(StopC, "NormalTextColour", "FFAAAAAA") CloseB = guiCreateButton(238, 105, 82, 31, "Close", false, Window) guiSetProperty(CloseB, "NormalTextColour", "FFAAAAAA") showCursor(true) addEventHandler ( "onClientGUIClick", CloseB, closeL, false ) end addCommandHandler("c", ChokingSystem) function fillTable() playerTable = {} for i,player in ipairs(getElementsByType("player")) do table.insert(playerTable,getPlayerNametagText(player)) end for k,v in pairs(playerTable) do local row = guiGridListAddRow(gridlist) guiGridListSetItemText(gridlist, row,1, tostring(v[1]), false, false) end end function closeL( button ) if button == "left" then guiSetVisible(Window ,false) showCursor(false) end end addEventHandler ( "onClientGUIClick", CloseB, closeL, false ) No Debug but the players doesn't appear in the gridlist Link to comment
Walid Posted November 11, 2015 Share Posted November 11, 2015 lol addEventHandler("onClientResourceStart", resourceRoot, function() local screenW, screenH = guiGetScreenSize() Window = guiCreateWindow((screenW - 329) / 2, (screenH - 227) / 2, 329, 227, "Choking System @SpRoXx", false) guiWindowSetSizable(Window, false) guiSetAlpha(Window, 1.00) guiSetVisible(Window, false) gridlist = guiCreateGridList(10, 41, 176, 174, false, Window) guiGridListAddColumn(gridlist, "Players", 0.9) label = guiCreateLabel(216, 41, 94, 37, "Select a player", false, Window) guiSetFont(label, "default-bold-small") StartC = guiCreateButton(238, 187, 82, 31, "StartC", false, Window) StopC = guiCreateButton(238, 146, 82, 31, "StopC", false, Window) CloseB = guiCreateButton(238, 105, 82, 31, "Close", false, Window) buttons = {StartC,StopC,CloseB} for i,v in pairs (buttons) do guiSetProperty(v, "NormalTextColour", "FFAAAAAA") end -- Events addEventHandler ( "onClientGUIClick", CloseB, closeL, false ) end ) function openPanel() if ( guiGetVisible(Window) ) then guiSetVisible(Window, false ) showCursor( false ) else guiSetVisible(Window, true ) showCursor( true ) addPlayersToGridlist() end end addCommandHandler("c", openPanel) function addPlayersToGridlist() guiGridListClear(gridlist) for index, players in pairs(getElementsByType("player")) do local row = guiGridListAddRow(gridlist) local name = getPlayerName(players) guiGridListSetItemText(gridlist, row,1, name, false, false) end end function closeL( buttons,state ) if button == "left" and state == "up" then guiSetVisible(Window ,false) showCursor(false) end end 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