Gtagasje Posted November 15, 2011 Share Posted November 15, 2011 Ok, first off all, before you read this script, there might be alot wrong in it, this is my first script with money. I want the script to check everybody's money, and output it in the Scoreboard ( added the column ). The timer works, but the other things, dont.. I dont know how to fix this. Please help. . local players = "" function getMoney () getPlayerMoney ( players ) setElementData ( players, "Money", getPlayerMoney ( players ) ) end setTimer ( getMoney, 5000, 0 ) addEventHandler("onResourceStart", getRootElement(), getMoney) Regards, Gtagasje. Link to comment
12p Posted November 15, 2011 Share Posted November 15, 2011 SERVER-ONLY: function getMoney () for i, p in ipairs ( getElementsByType ( "player" ) ) do --We get a table with all players setElementData ( p, "Money", getPlayerMoney ( p ) ) --To every player, we get its money and set it as element data end end setTimer ( getMoney, 5000, 0 ) getMoney ( ) Btw this is not very efficient and uses very much server CPU. You could try to make another system, like, instead of using default GTA money, use element data for it. And create custom functions to work with the element data. Link to comment
Gtagasje Posted November 15, 2011 Author Share Posted November 15, 2011 Thanks man! It works! 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