Whats better , static or new ?
#1

Hey,
Whats better for sending format messages (SendClientMessage) .

static or new ?

I understand that static value will forgotten after the code was done.
like :

Code:
if(dialogid == DIALOG_Login)
{
	static string[MAX_PLAYER_NAME];
	format(string, sizeof(string),"%s",GetName(playerid));
	SendClientMessageToAll(-1,string);
}
Reply
#2

Quote:
Originally Posted by ******
View Post
It depends - "new" is the one that is forgotten, but is allocated on the stack, not in global memory so it doesn't contribute to the AMX size.
So for the exmple that I showed here,
Do you prefer to use new and not static ?


By looking at SA:MP Wiki - https://sampwiki.blast.hk/wiki/Scripting...s#static_local

static_local seems to be more effective than 'new' ,
because its forgets it's old value..

And by my way of thinking -
Less values = Less memory (?) ;
Reply
#3

Thanks alot ******.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)