~Gangsta~ Posted December 15, 2012 Posted December 15, 2012 how to create a top 5 player money in chat?
Castillo Posted December 15, 2012 Posted December 15, 2012 Use: getElementsByType getPlayerMoney table.sort outputChatBox
~Gangsta~ Posted December 15, 2012 Author Posted December 15, 2012 please show an example ..... I just started to learn scripting
Castillo Posted December 15, 2012 Posted December 15, 2012 If you just started, then you may want to start with something simpler.
Tete omar Posted December 15, 2012 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.
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