Using SA-MP server's internal arrays
#1

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");".
Reply


Messages In This Thread
Using SA-MP server's internal arrays - by Yashas - 31.07.2016, 09:47

Forum Jump:


Users browsing this thread: 1 Guest(s)