28.12.2015, 03:04
Quote:
May I ask why you guys both decide to go for an extra function while that's not needed at all? It might not make a huge difference in performance in this case but it will when you for example do it in a really fast timer or what ever, you should always try to optimize your code as good as you can.
In this case he shouldn't use 'ResetPlayerMoney(playerid)' but simply 'GivePlayerMoney(playerid, amount)', his code was optimized and perfectly fine. Best regards, Jesse |
I find using "ResetPlayerMoney(...)" most suitable as the players' actual amount of money is stored in a variable and when you use a vending machine, a pay n' spray, a transfender, etc. your money on your hud will differ from your actual cash amount. Your money will be "corrected" (displayed correctly on your hud) when one of these functions is executed for you again.
"You should always try to optimize your code as good as you can."
You should always try to think about the possible flaws your code could cause as best as you can.