Simple functions doubles the amount.
#8

Quote:
Originally Posted by jessejanssen
Посмотреть сообщение
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
When will you use these functions repeatedly? Never.

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.
Reply


Messages In This Thread
Simple functions doubles the amount. - by CrazyChoco - 27.12.2015, 16:53
Re: Simple functions doubles the amount. - by SecretBoss - 27.12.2015, 17:03
Re: Simple functions doubles the amount. - by SickAttack - 27.12.2015, 17:06
Re: Simple functions doubles the amount. - by CrazyChoco - 27.12.2015, 18:16
Re: Simple functions doubles the amount. - by AmigaBlizzard - 27.12.2015, 23:24
Re: Simple functions doubles the amount. - by SickAttack - 28.12.2015, 00:52
Re: Simple functions doubles the amount. - by jessejanssen - 28.12.2015, 02:23
Re: Simple functions doubles the amount. - by SickAttack - 28.12.2015, 03:04
Re: Simple functions doubles the amount. - by AmigaBlizzard - 05.01.2016, 19:39

Forum Jump:


Users browsing this thread: 1 Guest(s)