Multiple new vs one new
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
Then neither. And if you think that is what you need to worry about in code, you don't understand optimisations at all.
Calm down, you didn't at one point.

and no @IdonTmiss that's the exact same thing, just more neat in a way.

If you want to use less variables you can use arrays, i.e.

PHP код:
new PlayerCash[MAX_PLAYERS]; 
This would make a variable that has 999 different, "slots" lets call them.

This means that you can do something like this.

PHP код:
if(PlayerCash[0] == 0)
{
    
SendClientMessage(0, -1"Ha Ha, you're poor.");

That above would check to see what integer is stored to PlayerCash for the "slot" 0 (slot 0 being Player ID 0 on the tab list)

Very basic but you get the idea.

This also does not improve optimisation, again it's just neater.

Variables have such a tiny tiny impact on the server, you shouldn't worry about the amount of variables you're using tbh.
Reply


Messages In This Thread
Multiple new vs one new - by IdonTmiss - 12.07.2018, 18:13
Re: Multiple new vs one new - by Florin48 - 12.07.2018, 18:24
Re: Multiple new vs one new - by IdonTmiss - 12.07.2018, 18:30
Re: Multiple new vs one new - by ItsRobinson - 12.07.2018, 18:42
Re: Multiple new vs one new - by Florin48 - 12.07.2018, 18:45
Re: Multiple new vs one new - by ItsRobinson - 12.07.2018, 18:57
Re: Multiple new vs one new - by GangstaSunny. - 12.07.2018, 22:16

Forum Jump:


Users browsing this thread: 1 Guest(s)