#Paper Posted August 8, 2011 Posted August 8, 2011 Is there a way to use getAccountData() in Client Side? My skype: skiper964 I helped you? Help me! ^^ Help me bro! ^^
Castillo Posted August 8, 2011 Posted August 8, 2011 No, but you can use triggerServerEvent, triggerClientEvent. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
#Paper Posted August 9, 2011 Author Posted August 9, 2011 I want to make a ranking in a gridList but i need to take the data from the table returned by getAccounts() Any example? My skype: skiper964 I helped you? Help me! ^^ Help me bro! ^^
JR10 Posted August 9, 2011 Posted August 9, 2011 Server side: local accounts = getAccounts() triggerClientEvent("event", player, accounts) Client side: addEvent("event", true) addEventHandler("event", root, function(accounts) --code end) Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
Dev Posted August 9, 2011 Posted August 9, 2011 Just trying to elaborate what JR10 said, Server Side: -- Server Side function fetchAccounts( ) local accounts = getAccounts() triggerClientEvent(source, "giveAccounts", source, accounts) end addEvent("fetchAccounts", true) addEventHandler("fetchAccounts", true) -- Client Side local gridList -- Lets consider you already have a gridList made function giveAccounts( accounts ) -- Now we'll loop and populate the gridList with account names, -- PS: I don't know the what each index holds in the 'getAccounts()' table, -- so consider the first index to be storing the account name for i = 1, #accounts do local row = guiGridListAddRow(gridList) guiGridListSetItemText(gridList, row, 1, tostring(accounts[i]), false, false) end end addEvent("giveAccounts", true) addEventHandler("giveAccounts", getLocalPlayer(), giveAccounts) If there is any more detail you need, reply back to this topic. "First they ignore you, then they laugh at you, then they fight you, then you win." - Mahatma Gandhi (1869-1948)
#Paper Posted August 9, 2011 Author Posted August 9, 2011 Server side: local accounts = getAccounts() triggerClientEvent("event", player, accounts) Client side: addEvent("event", true) addEventHandler("event", root, function(accounts) --code end) thanks but i need to get some datas from that account, i have already an idea, but then how can i put the table in ascending order? My skype: skiper964 I helped you? Help me! ^^ Help me bro! ^^
JR10 Posted August 9, 2011 Posted August 9, 2011 You can make a (server side) loop that will get the data from each account, and trigger a client event with that data. And in the client event add a one grid list row. Ascending, why?, won't matter sorting the table. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
Dev Posted August 9, 2011 Posted August 9, 2011 thanks but i need to get some datas from that account, i have already an idea, but then how can i put the table in ascending order? Do you mean ascending order by the creation of account? I believe it will automatically populate in an ascending order if you use an ipairs loop or the one I suggested. You can make a (server side) loop that will get the data from each account, and trigger a client event with that data.And in the client event add a one grid list row. I wouldn't call that a very efficient method JR10, because constant server-client calls can result in lag as well as increased bandwidth use, so I'd suggest sending the whole table at once and then using it client side. "First they ignore you, then they laugh at you, then they fight you, then you win." - Mahatma Gandhi (1869-1948)
#Paper Posted August 9, 2011 Author Posted August 9, 2011 Ascending, why?, won't matter sorting the table. I want to make a ranking... So @ the 1° place tha player who have more cash than all etc etc, btw i have another question: table.sort function what does? My skype: skiper964 I helped you? Help me! ^^ Help me bro! ^^
JR10 Posted August 9, 2011 Posted August 9, 2011 http://lua-users.org/wiki/TableLibraryTutorial You will find table.sort Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
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