[BUG]CallRemoteFunction ends up the server
#1

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.
Reply
#2

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".
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)