SA-MP Forums Archive
Can someone explain this code to me please - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Can someone explain this code to me please (/showthread.php?tid=662264)



Can someone explain this code to me please - aKnoxx - 27.12.2018

PHP код:
     new MAX_OBJ+1;
     for(new 
0MAX_OBJa++) 
PHP код:
     new str[128], i;
     for (
0strlen(str); i++) if (str[i] == '_'str[i] = ' '
What I understand:

1st one:
f = MAX OBJECTS + 1
a = MAX OBJECTS


2nd one:
i = length of str
if str[i] has a _ replace it with a SPACE

Is that right? Or am I missing something?

And what would these be used for? Why would someone want to use these?

Because from what I can see "a" basically equals "MAX_OBJ" so why would someone want to use "a" instead of "MAX_OBJ"? And if they did want to use "a" instead why not just do this:

PHP код:
new MAX_OBJ
Thank you I'm new to scripting, just curious.