~Gangsta~ Posted December 15, 2012 Share Posted December 15, 2012 how to create a top 5 player money in chat? Link to comment
Castillo Posted December 15, 2012 Share Posted December 15, 2012 Use: getElementsByType getPlayerMoney table.sort outputChatBox Link to comment
~Gangsta~ Posted December 15, 2012 Author Share Posted December 15, 2012 please show an example ..... I just started to learn scripting Link to comment
~Gangsta~ Posted December 15, 2012 Author Share Posted December 15, 2012 please show an example Link to comment
Castillo Posted December 15, 2012 Share Posted December 15, 2012 If you just started, then you may want to start with something simpler. Link to comment
Tete omar Posted December 15, 2012 Share Posted December 15, 2012 That's true , so you start learning small things to be understand as you're a beginner , but i won't mind giving you an example just a few minutes. edit: here you go local topMoney = {} function top(player) for i,v in ipairs(getElementsByType("player")) do -- get all players if(getPlayerMoney(v)>1000)then -- and the player who have more than 1 thousand topMoney[ getPlayerName(v) ] = " money: " .. getPlayerMoney(v) -- insert him into the table with his money end end for i,v in pairs(topMoney) do table.sort(topMoney) -- sorting outputChatBox("Top players who are having more than 1 thousand is " .. i .. " Money: " .. v,player) -- output to the player who typed this command the players who are having more than 1 thousand end end addCommandHandler("topMoney",top) I'm not sure if it's gonna work , but it should work. Link to comment
~Gangsta~ Posted December 16, 2012 Author Share Posted December 16, 2012 Tete omar, thank you! 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