xXGhostXx Posted December 13, 2019 Share Posted December 13, 2019 Hello guys. I want idea for get the largest player money on server. Please help me. Link to comment
Ceeser Posted December 13, 2019 Share Posted December 13, 2019 (edited) Please expain a bit more: Are you using a db? Are you using accountData? Are you using elementData? Do you wanna use something else? Edited December 13, 2019 by Ceeser Link to comment
xXGhostXx Posted December 13, 2019 Author Share Posted December 13, 2019 4 minutes ago, Ceeser said: Please expain a bit more: Are you using a db? Are you using accountData? Are you using elementData? Do you wanna use something else? Does not count, because i want know. for example i use elementData. Please answer me. Link to comment
Ceeser Posted December 13, 2019 Share Posted December 13, 2019 That actually makes a difference.. Well for elementData you could do that: funciton getRichestPlayer() local tblPlayersMoney = {}; for _, player in pairs(getElementsByType("player")) do table.insert(tblPlayerMoney, {player = getPlayerName(player), money = getElementData(player, "money")}); end table.sort(tblPlayersMoney, function (a, b) return a.money > b.money end); for i, v in pairs(tblPlayersMoney) do outputChatbox("Place " .. i .. " is " .. v.player .. " with " .. v.money .. "$", 255, 255, 255, true); 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