About string size cell numbers. -
wallen - 10.03.2018
Does it affect bad on your gamemode, if you for example have wrong numbers of cells?
Re: About string size cell numbers. -
rfr - 10.03.2018
cell to small - sentence will be cut
cell to big - normal sentence, amx file will increase
Re: About string size cell numbers. -
wallen - 10.03.2018
Yeah, but as far as i see it doesnt affect anything, why would people struggle on counting cells.
Re: About string size cell numbers. -
RogueDrifter - 10.03.2018
Quote:
Originally Posted by wallen
Does it affect bad on your gamemode, if you for example have wrong numbers of cells?
|
Yes,
Here's a simple compare:
1-
BAD:
PHP Code:
new PlayerName[128];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
2-
GOOD:
PHP Code:
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
Because you're leaving that big array unused taking up space irrelevantly, why? it's really messy when people do random string[256] or string[128] for no absolute reason when it only needs 20/80 at the most.
It does, accumulating the unused variables/arrays building up is going to leave you with a big compiled file and longer time to compile, why?
Re: About string size cell numbers. -
wallen - 10.03.2018
Thanks got the point now, appreciated
Re: About string size cell numbers. -
Meller - 10.03.2018
im just gonna go made a memory located variable with 899999999999999999999999 null cells, my cpu won't die at all.
srsly, what even is this questions, it doesnt even have to do anything with samp scriptin
Re: About string size cell numbers. -
wallen - 10.03.2018
Quote:
Originally Posted by Meller
im just gonna go made a memory located variable with 899999999999999999999999 null cells, my cpu won't die at all.
srsly, what even is this questions, it doesnt even have to do anything with samp scriptin
|
Self knowledge
Re: About string size cell numbers. -
Spmn - 10.03.2018
Quote:
Originally Posted by Meller
im just gonna go made a memory located variable with 899999999999999999999999 null cells, my cpu won't die at all.
|
CPU will be fine tho.
Re: About string size cell numbers. -
VeryTallMidget - 10.03.2018
This PlayerName is static array ?
Is it possible to create dynamic array that sets the size from the: sizeof(PlayerName) ?
Re: About string size cell numbers. -
Sew_Sumi - 10.03.2018
What was a problem long ago was the old
Code:
SendClientMessage(playerid, 1, string);
Same as the name example above... Where playername is only 32+1 or something, SendClientMessage can only send 144 characters, so the 256 is a waste of space, unless you do some breaking up of long-lines function.
Re: About string size cell numbers. -
SyS - 11.03.2018
Quote:
Originally Posted by VeryTallMidget
Is it possible to create dynamic array that sets the size from the: sizeof(PlayerName) ?
|
Pawn doesn't support dynamic allocation. There are some tricky library like ymalloc or any vector plugin can do this. But as far as I know dynamic allocation is not necessary in samp scripting.
Re: About string size cell numbers. -
AmigaBlizzard - 05.05.2018
It's the same as going to buy a 2-seat sofa.
When you use a Smart vehicle, the sofa won't fit in the trunk of that Smart. Same as trying to store a playername in a string of size 5, it won't fit in there as a playername can be up to 24 chars long.
On the other hand, using a string of size 128 to store that playername (which is max 24 chars long), is the same as renting a truck + trailer (like the GTA Roadtrain + Article trailer) to buy that sofa, while you would do fine with your car and a trailer.
Using that Roadtrain+trailer will do the job too, but it's just overkill.