Quote:
Originally Posted by KliPPy
To me it looks like it still copies 1 time (out of the called function)
|
Yes if it is a plugin function, but fmt writes directly to this array.
Quote:
Originally Posted by KliPPy
When assigning it copies 2 times.
|
Yes, we need to introduce an optimization for this.
GetPlayerName without copying:
Code:
#include <amxmodx>
#if !defined MAX_NAME
const MAX_NAME = 32;
#endif
const MaxNameLength = MAX_NAME - 1;
public client_connect(player) {
server_print("%s connecting", GetPlayerName(player));
}
native get_user_name2(a, b, c) = get_user_name;
GetPlayerName(player) {
static returnStringAddr;
#emit LOAD.S.PRI 0x10
#emit STOR.PRI returnStringAddr
get_user_name2(player, returnStringAddr, MaxNameLength);
#emit RETN
new name[MaxNameLength + 1];
return name;
}
__________________