SA-MP Forums Archive
[BUG]CallRemoteFunction ends up the server - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [BUG]CallRemoteFunction ends up the server (/showthread.php?tid=201042)



[SOLVED]CallRemoteFunction ends up the server - leong124 - 20.12.2010

SOLVED

I'm using 0.3c RC6 and I added some new functions for my server today.
I found that when CallRemoteFunction transfers strings,
the server will terminate.
Here's the test script and it crashes the server:
The script with the remote function to be called:
Код:
#define FILTERSCRIPT

#include <a_samp>

new name[MAX_PLAYERS][128];

forward test(playerid,const string[]);

public test(playerid,const string[])
{
    name[playerid] = "";
    strcat(name[playerid],string);
	return 1;
}
The script to call the remote function:
Код:
#define FILTERSCRIPT

#include <a_samp>

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	CallRemoteFunction("test","ds",0,"");
	return 1;
}
I don't know if it's my mistake or a bug.
Please help.


Re: [BUG]CallRemoteFunction ends up the server - mick88 - 20.12.2010

Server will always crash when you pass an empty string in CallRemoteFunction, CallLocalFunction and possibly SetTimer(Ex). This is not a SA-MP bug. Make sure the string you use in the parameter is not empty ("\0").
If you need to pass an empty string, you can use "\1\0".


Re: [BUG]CallRemoteFunction ends up the server - leong124 - 20.12.2010

Okay thanks
I found it on ******'s topic on code optimization and I'm going to stop asking it.