Re-format strings instead of creating multiple ones for messages, for example:
Код:
new string[145];
GetPlayerName(targetid, string, 25);
format(string, sizeof (string), "[PM] To %s (%i): %s", string, targetid, params);
SendClientMessage(playerid, -1, string);
GetPlayerName(playerid, string, 25);
format(string, sizeof (string), "[PM] From %s (%i): %s", string, playerid, params);
SendClientMessage(targetid, -1, string);
// Do that instead of doing this:
new player_name[25], target_name[25], string1[145], string2[145];
GetPlayerName(playerid, player_name, 25);
GetPlayerName(targetid, target_name, 25);
format(string1, sizeof (string1), "[PM] To %s (%i): %s", target_name, targetid, params);
SendClientMessage(playerid, -1, string1);
format(string2, sizeof (string2), "[PM] From %s (%i): %s", player_name, playerid, params);
SendClientMessage(playerid, -1, string2);
Calculate how much cells you need for a string, instead of using a large size for no reason:
Код:
/*
String is:
%s (%i) has logged in.
To calculate how much cells (max.) it needs, replace the specifiers (%*) with their values:
%s = player name, which has a max length of 24
%i = playerid, which has a max length of 3 (because 999 is the limit)
() has logged in. = 18 characters
24 + 3 + 18 = 45
Add 1 to it for the NULL = 46
*/
new string[46];