Seba500PLK Posted August 14, 2014 Author Share Posted August 14, 2014 not trying to have something to work Link to comment
Max+ Posted August 14, 2014 Share Posted August 14, 2014 not trying to have something to work i added some timer for update , function acc ( ) for _, account in pairs( getElementsByType ('player')) do account = getAccountName(getPlayerAccount( account )) triggerClientEvent('onAccountsSend',root, account ) end end addEventHandler('onPlayerLogin',root, acc ) function mmm( ) setTimer ( acc, 1000, 1 ) end addEventHandler('onPlayerJoin', root, mmm ) addEventHandler('onResourceStart', root, mmm ) Link to comment
Seba500PLK Posted August 14, 2014 Author Share Posted August 14, 2014 I did something like that but my nickname is repeated as many times as there are players --Client function gridacc (account) local playerList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) local column = guiGridListAddColumn( playerList, "Player", 0.85 ) if ( column ) then for id, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( playerList ) guiGridListSetItemText(playerList, row, column, account, false, false ) end end end addEvent("onAccountsSend",true) addEventHandler("onAccountsSend",root, gridacc) addEventHandler ( 'onClientResourceStart', resourceRoot, gridacc ) Link to comment
Max+ Posted August 14, 2014 Share Posted August 14, 2014 I did something like that but my nickname is repeated as many times as there are players --Client function gridacc (account) local playerList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) local column = guiGridListAddColumn( playerList, "Player", 0.85 ) if ( column ) then for id, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( playerList ) guiGridListSetItemText(playerList, row, column, account, false, false ) end end end addEvent("onAccountsSend",true) addEventHandler("onAccountsSend",root, gridacc) addEventHandler ( 'onClientResourceStart', resourceRoot, gridacc ) i didn't get what you need you want players name in the gridlist or account names ? this is for account Names , --Client --Client function gridacc (account) local playerList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) local column = guiGridListAddColumn( playerList, "Player", 0.85 ) if ( column ) then local row = guiGridListAddRow ( playerList ) guiGridListSetItemText(playerList, row, column, account, false, false ) end end addEvent("onAccountsSend",true) addEventHandler("onAccountsSend",root, gridacc) ---server function acc ( ) for _, account in pairs( getElementsByType ('player')) do account = getAccountName(getPlayerAccount( account )) triggerClientEvent('onAccountsSend',root, account ) end end addEventHandler('onPlayerLogin',root, acc ) function mmm( ) setTimer ( acc, 1000, 1 ) end addEventHandler('onPlayerJoin', root, mmm ) addEventHandler('onResourceStart', root, mmm ) Link to comment
Seba500PLK Posted August 14, 2014 Author Share Posted August 14, 2014 1 shows only one person 2 Because on my server instead of nick which is set in the settings, it has a nickname of login Link to comment
Max+ Posted August 14, 2014 Share Posted August 14, 2014 1 shows only one person 2 Because on my server instead of nick which is set in the settings, it has a nickname of login Send me your server ip , port PM , Link to comment
DNL291 Posted August 15, 2014 Share Posted August 15, 2014 Try this (i haven't tested): Client addEventHandler( "onClientResourceStart", resourceRoot, function() playerList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) column = guiGridListAddColumn( playerList, "Player", 0.85 ) triggerServerEvent("onClientRequestAccounts", localPlayer) end ) addEvent("doAddAccountsToGridList", true) addEventHandler( "doAddAccountsToGridList", root, function (accountsTable) for i=1, #accountsTable do guiGridListSetItemText(playerList, guiGridListAddRow(playerList), column, accountsTable[i], false, false) end end ) addEvent("onAccountsSend", true) addEventHandler( "onAccountsSend", root, function (accountName) guiGridListSetItemText(playerList, guiGridListAddRow(playerList), column, accountName, false, false) end ) addEvent("refreshGridListItems", true) addEventHandler( "refreshGridListItems", root, function (accountName) gridListRemoveAccName(tostring(accountName), column) end ) function gridListRemoveAccName(itemName, column) for i=0, #guiGridListGetRowCount(playerList) do accName = guiGridListGetItemText(playerList, i, column) if accName == itemName then guiGridListRemoveRow(playerList, 2) break end end end Server addEventHandler( "onPlayerLogin", root, function (prevAcc, currAcc) for _, player in pairs(getElementsByType("player")) do triggerClientEvent(player, "onAccountsSend", player, getAccountName(currAcc)) end end ) addEventHandler( "onPlayerLogout", root, function (previousAcc) for _, player in pairs(getElementsByType("player")) do triggerClientEvent(player, "refreshGridListItems", player, getAccountName(previousAcc)) end end ) addEventHandler( "onPlayerQuit", root, function() local account = getPlayerAccount(source) if account and (isGuestAccount(account) ~= false) then for _, player in pairs(getElementsByType("player")) do triggerClientEvent(player, "refreshGridListItems", player, getAccountName(account)) end end ) addEvent("onClientRequestAccounts", true) addEventHandler( "onClientRequestAccounts", root, function() local tAccounts = {} for _, player in pairs(getElementsByType("player")) do local account = getPlayerAccount(player) if account and (isGuestAccount(account) ~= false) then table.insert(tAccounts, getAccountName(account)) end end triggerClientEvent(client, "doAddAccountsToGridList", client, tAccounts) end ) Link to comment
Seba500PLK Posted August 15, 2014 Author Share Posted August 15, 2014 no work in grid show: Player ________________________ Link to comment
Et-win Posted August 15, 2014 Share Posted August 15, 2014 --Server-Side: function gAccountsToSend() local gAccounts = {} local gPlayers = getElementsByType("player") if (gPlayers ~= false) and (gPlayers ~= nil) then for placeNumber, playerData in ipairs(gPlayers) do local gAccount = getPlayerAccount(playerData) if (gAccount ~= false) and (gAccount ~= nil) then local gAccountName = getAccountName(gAccount) if (gAccountName ~= false) and (gAccountName ~= nil) then table.insert(gAccounts, gAccountName) end end end end triggerClientEvent(source, "onSendAccountNamesToClient", getRootElement(), gAccounts) end addEvent("onClientRequestAccountNames", true) addEventHandler("onClientRequestAccountNames", getRootElement(), gAccountsToSend) --Client-Side: local tab = {} local tabpanel = {} local label = {} local button = {} local edit = {} local player = localPlayer function fGridList(gAccounts) if (isElement(accountGrid)) then for placeNumber, stringData in ipairs(gAccounts) do guiGridListSetItemText(accountGrid, guiGridListAddRow(accountGrid), accountColumn, stringData, false, false) end end end addEvent("onSendAccountNamesToClient", true) addEventHandler("onSendAccountNamesToClient", getRootElement(), fGridList) function gridlist() local screenWidth, screenHeight = guiGetScreenSize() window1 = guiCreateWindow(screenWidth * 0.24, screenHeight * 0.2, 771, 457, "TEST", false) guiWindowSetSizable(window1, false) guiSetVisible(window1,false) accountGrid = guiCreateGridList(9, 23, 249, 228, false, window1) guiGridListSetSelectionMode(accountGrid, 2) accountColumn = guiGridListAddColumn(accountGrid, "Player", 0.85) triggerServerEvent("onClientRequestAccountNames", player) end addEventHandler("onClientResourceStart", resourceRoot, gridlist) addEventHandler("onClientResourceStart",resourceRoot, function() if not isElement(window1) then gridlist() end bindKey ( "F3", "down", openGui ) end ) function openGui() if not isElement(window1) then gridlist() end if not guiGetVisible(window1) then --stats() guiSetVisible ( window1, true ) showCursor(true) else guiSetVisible ( window1, false ) showCursor(false) end end If not working, use debugscript 3 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