Seba500PLK Posted August 14, 2014 Share Posted August 14, 2014 hi I know I need to use the trigger, but do not know how --Client local tab = {} local tabpanel = {} local label = {} local button = {} local edit = {} local player = localPlayer 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) 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 function gridacc () --Create the grid list element --local playerList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) --Create a players column in the list local column = guiGridListAddColumn( accountGrid, "Player", 0.85 ) if ( column ) then --If the column has been created, fill it with players for id, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( accountGrid ) guiGridListSetItemText ( accountGrid, row, column, getPlayerName( player ), false, false ) end end end addEventHandler ( "onClientResourceStart", getResourceRootElement(), gridacc ) Link to comment
Drakath Posted August 14, 2014 Share Posted August 14, 2014 triggerClientEvent triggerServerEvent triggerEvent Link to comment
DNL291 Posted August 14, 2014 Share Posted August 14, 2014 You can use elementData to store the the player's account name when he log in. And update it on the events: onPlayerQuit/onPlayerLogout. And then only use getElementData function to get the account name of the player. Link to comment
Seba500PLK Posted August 14, 2014 Author Share Posted August 14, 2014 What did I do wrong? --Client function gridacc (acc) --Create the grid list element --local playerList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) --Create a players column in the list local column = guiGridListAddColumn( accountGrid, "Player", 0.85 ) if ( column ) then --If the column has been created, fill it with players for id, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( accountGrid ) guiGridListSetItemText ( accountGrid, row, column, acc( player ), false, false ) end end end addEventHandler ( "onClientResourceStart", getResourceRootElement(), gridacc ) addEvent("updateGuis", true) addEventHandler("updateGuis", root, gridacc) --Server function update(client) local who = getPlayerFromName (client); local account = getPlayerAccount( who ); triggerClientEvent ( "updateGuis", getRootElement(), getAccountName ( account ) ) end Link to comment
Et-win Posted August 14, 2014 Share Posted August 14, 2014 guiGridListSetItemText ( accountGrid, row, column, acc( player ), false, false ) To: guiGridListSetItemText ( accountGrid, row, column, acc, false, false ) Also remove event 'onClientResourceStart' because it won't have an account triggered with. Link to comment
Seba500PLK Posted August 14, 2014 Author Share Posted August 14, 2014 Now there is nothing in the gridlist Link to comment
Et-win Posted August 14, 2014 Share Posted August 14, 2014 Use debugscript 3 ............... Link to comment
Seba500PLK Posted August 14, 2014 Author Share Posted August 14, 2014 help me anyone? Link to comment
Drakath Posted August 14, 2014 Share Posted August 14, 2014 You could try this. function update(thePreviousAccount, theCurrentAccount) triggerClientEvent ( "updateGuis", getRootElement(), theCurrentAccount ) end addEventHandler("onPlayerLogin", root, update) Link to comment
Seba500PLK Posted August 14, 2014 Author Share Posted August 14, 2014 Bad argument @ 'guiGridListSetItemText'[Expected string at argument 4, got nil] Link to comment
Max+ Posted August 14, 2014 Share Posted August 14, 2014 (edited) --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) addEventHandler ( 'onClientResourceStart', resourceRoot, gridacc ) ---server addEventHandler('onPlayerLogin',root, function ( ) for _, account in pairs( getAccounts( ) ) do account = getAccountName( account ) triggerClientEvent( 'onAccountsSend',root, account ) end end ) Make sure your logged in before start the script . Edited @ Edited August 14, 2014 by Guest Link to comment
Seba500PLK Posted August 14, 2014 Author Share Posted August 14, 2014 logged and grid just shows : Player ________________________ Link to comment
Seba500PLK Posted August 14, 2014 Author Share Posted August 14, 2014 Bad argument @ 'guiGridListSetItemText'[Expected string at argument 4, got resource-data] Link to comment
Max+ Posted August 14, 2014 Share Posted August 14, 2014 logged and grid just shows :Player ________________________ Copy My Post again Login - > start the script . Link to comment
Seba500PLK Posted August 14, 2014 Author Share Posted August 14, 2014 0.o in grid: AbbSS what is it? Link to comment
Max+ Posted August 14, 2014 Share Posted August 14, 2014 0.o in grid: AbbSSwhat is it? what do you mean ? it's get all the accounts in the server and add them to the gridlist as you want . Link to comment
Seba500PLK Posted August 14, 2014 Author Share Posted August 14, 2014 http://seba500plk.bl.ee/mta1.png Link to comment
Max+ Posted August 14, 2014 Share Posted August 14, 2014 http://seba500plk.bl.ee/mta1.png Change Server to this , addEventHandler('onPlayerLogin',root, function ( ) for _, account in pairs( getElementsByType ('player')) do account = getAccountName(getPlayerAccount( account )) triggerClientEvent( 'onAccountsSend',root, account ) end end ) Link to comment
Et-win Posted August 14, 2014 Share Posted August 14, 2014 addEventHandler('onPlayerLogin',root, function ( ) local accounts = {} for _, account in pairs( getAccounts( ) ) do account = getAccountName( account ) table.insert(accounts, account) end triggerClientEvent( 'onAccountsSend',root, accounts ) end ) Don't trigger it for every player Link to comment
Seba500PLK Posted August 14, 2014 Author Share Posted August 14, 2014 addEventHandler('onPlayerLogin',root, function ( ) local accounts = {} for _, account in pairs( getAccounts( ) ) do account = getAccountName( account ) table.insert(accounts, account) end triggerClientEvent( 'onAccountsSend',root, accounts ) end ) Don't trigger it for every player grid show: Payer ____________________________ Link to comment
Seba500PLK Posted August 14, 2014 Author Share Posted August 14, 2014 Bad argument @ 'guiGridListSetItemText'[Expected string at argument 4, got resource-data] Bad argument @ 'guiGridListSetItemText'[Expected string at argument 4, got table] Link to comment
Et-win Posted August 14, 2014 Share Posted August 14, 2014 1. Use +Max's new code. 2. I have the feeling that you are just letting do us the work and you are doing nothing? 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