04.07.2020, 21:47
Quote:
'YSI/y_va' |
Quote:
It's more simple and i don't need to count and dont need to use EOS. |
pawn Code:
new myArray[15];
format(myArray, 15, "Hello world!"); //Note that in this situation, using [myArray = "Hello world!";] would be a much better choice
Code:
{'H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!', EOS, '', '', EOS}
As for being afraid of wasting memory. Just make sure you don't use way too much cells like some people do (eg. using 512 cells for a client message).
Here's a pretty safe SendClientMessageFormatted(ToAll) function:
pawn Code:
SendClientMessageFormatted(playerid, color, const format[], va_args<>)
{
new __scmfStr[144];
va_format(__scmfStr, 144, format, va_start<3>);
if (playerid == INVALID_PLAYER_ID)
return SendClientMessage(playerid, color, __scmfStr);
else return SendClientMessageToAll(color, __scmfStr);
}
#define SendClientMessageToAllFormatted(%0) SendClientMessage(INVALID_PLAYER_ID, %0)
Anyway, to go to your question:
Quote:
I want to know if 'y_va' will use more CPU MEM than EOS. |
pawn Code:
new myArray[] = "Hello there cruel cruel beautifull world!";
myArray[5] = EOS; //[5] is the space after Hello
printf("Length of myArray is %d", strlen(myArray));
print(myArray);
Code:
Length of myArray is 5 Hello
I do get what you mean though, and remember this:
Y_L3ss is all about optimalisations. In general you're best of using YSI's library, so just go for it. Also, GTA SA/SAMP is pretty old. Systems these days should not have problems with it (unless if you're using a VPS with crap CPUs -large gamemodes could then run into problems).
Also I'm a bit tired at this moment so if there are typo's or perhaps some information that's a tad wrong I offer you my humble and sincere apologies.