23.08.2009, 06:29
Hi,
I'm trying to use a string as a reference parameter in a plugin I'm creating.
So far I have this:
I'm pretty sure It's wrong, because when I try to do this in a gamemode:
That code causes the server to crash.
If anyone knows how to get this working, or can tell me what I'm doing wrong, I'd be appreciative of any help.
Thanks in advance,
CodeMatrix
EDIT: It does crash the server.
I'm trying to use a string as a reference parameter in a plugin I'm creating.
So far I have this:
Code:
//native Test(string[], size); static cell AMX_NATIVE_CALL n_Test( AMX* amx, cell* params ) { char * string; sprintf(string,"test: %d", 1234); cell *buf; amx_GetAddr(amx, params[1], &buf); amx_SetString(buf, string, 0, 0, params[2]); return 1; }
pawn Code:
new teststring[16];
Test(teststring,sizeof(teststring));
SendClientMessage(playerid,0xFF000000, teststring);
If anyone knows how to get this working, or can tell me what I'm doing wrong, I'd be appreciative of any help.
Thanks in advance,
CodeMatrix
EDIT: It does crash the server.