SA-MP Forums Archive
Using SA-MP server's internal arrays - 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)
+---- Forum: Discussion (https://sampforum.blast.hk/forumdisplay.php?fid=84)
+---- Thread: Using SA-MP server's internal arrays (/showthread.php?tid=613747)



Using SA-MP server's internal arrays - Yashas - 31.07.2016

Was looking for opinions regarding usage of SA-MP's internal arrays which appear in SA-MP callbacks.

For example,
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
     strins(cmdtext, "cmd_", 1, 144);
     return 1;
}
The above code assumes that cmdtext array is large enough to hold the data which I believe is a reasonable assumption. Of course, Kalcor wouldn't be using dynamically allocated arrays since it would impact the performance so cmdtext should be a static array with the size of the longest client message that can be sent (haven't disassembled yet, not confirmed).

Just wanted to have your opinion on it since I could be overlooking potential problems. I have already run into problems when you call OnPlayerCommandText manually with a small array, for example, "OnPlayerCommandText(0, "/test");".