I'm trying to assign a string to an array provided by the buffer parameter of my native. Trying to get it to work had an unexpected side effect. What is the correct way to do it?
Prototype:
Code:
native int getSecretName(int clientIndex, const char[] buffer, int buffersize=MAX_NAME_LENGTH);
Implementation:
Code:
public int Native_getSecretName(Handle plugin, int numparams){
int clientID;
int buffersize;
any name[MAX_NAME_LENGTH];
clientID = GetNativeCell(1);
if (clientID < 1 || clientID > MAXPLAYERS){
return -1;
}
name = view_as<any>(secretNames[clientID]);
buffersize = GetNativeCell(3);
SetNativeArray(2, name, buffersize);
return 0;
}
__________________