CallLocalFunction crashes Server
#1

Hey.

Since I use the new Includes from 0.3e RC5 my server crashes, when I try to call a local function in my script with the function from above. Is somebody also experiencing this?
Reply
#2

I'm using CallLocalFunction in my script and it works fine. Never had crashes with it.


Show us your code (where you call the local function), that may help at some point.
Reply
#3

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new function[32];
    format(function, sizeof function, "dialog_%d", dialogid);
    printf("call %s", function);
    CallLocalFunction(function, "iiis", playerid, response, listitem, inputtext);
    OnDialogResponseEx(playerid, dialogid, response, listitem, inputtext);
    ShowPlayerNextDialog(playerid);
    return 1;
}
It crashes after CallLocalFunction (I debugged it).
Reply
#4

Maybe you should give CallLocalFunction a dialogid parameter too.
Reply
#5

It crashes when inputtext is empty and I don't know why thats a problem.

pawn Код:
#define DIALOG:%0(%1,%2,%3,%4) forward dialog_%0(%1,%2,%3,%4); public dialog_%0(%1,%2,%3,%4)
pawn Код:
DIALOG:0(playerid, response, listitem, inputtext[])
{
    printf("Input: %s", inputtext);
    return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new function[32];
    format(function, sizeof function, "dialog_%d", dialogid);
    CallLocalFunction(function, "iiis", playerid, response, listitem, inputtext[0]);
    OnDialogResponseEx(playerid, dialogid, response, listitem, inputtext);
    ShowPlayerNextDialog(playerid);
    return 1;
}
Reply
#6

tried the crashdetect plugin?
Reply
#7

Does it only crashes when inputtext is empty or it also crashes with a text inside?


You can check if there is no inputtext, like:

pawn Код:
if(!strlen(inputtext)) return SendClientMessage(playerid, -1, "Please enter something");
Reply
#8

Код:
if( !strlen( inputtext ) ) return 1;
Reply
#9

I already check if there Is any content or not.
When there is a content, then everything works nice,
but when there is no content, then it crashes.

I know that I could make a if-check for inputtext, but it should work also so, shouldn't it?

» Edit: I will use '\1\0' for the param, when it's empty. But what does that '\1' character mean, what is it for?
Reply
#10

I think he might be right.
I've been scripting a command processor inside zcmd for specific commands since 0.3d and yes, I had the same results.
Reply
#11

pawn Код:
#if !defined null
    #define null(%0) !strcmp(%0, "\1\0")
    // or
    #define null(%0) ((!%0[1]) && (%0[0] == '1'))
#endif

if(!null(inputtext)) CallLocalFunction(...);
else CallLocalFunction(..., "\1\0");
Reply
#12

You should also provide a server crash log from crashinfo.txt
Reply
#13

Here you go:

Код:
--------------------------

SA-MP Server: 0.3e-RC5



Exception At Address: 0x77BDDFE4



Registers:

EAX: 0x00000008	EBX: 0x00000010	ECX: 0x0018FBD8	EDX: 0x0000000C

ESI: 0x01FC0000	EDI: 0x00000000	EBP: 0x0018E72C	ESP: 0x0018E71C

EFLAGS: 0x00010246



Stack:

+0000: 0x00000010   0x004B5A04   0x0018FCB0   0x00000000

+0010: 0x0018E740   0x776B14DD   0x01FC0000   0x00000000

+0020: 0x00000010   0x0018E77C   0x00490D91   0x01FC0000

+0030: 0x00000000   0x00000010   0x004B5A04   0xFFFFFFFF

+0040: 0x0018FCB0   0x0D0D3443   0x0018E754   0x0018E2F0

+0050: 0x0018E7D4   0x00495198   0x004B0128   0xFFFFFFFF

+0060: 0x0018FCBC   0x0044E0C9   0x00000010   0x0049B587

+0070: 0x004B5A04   0xFFFFFFFF   0x0018E7A4   0x004B59E4

+0080: 0x0018FCB0   0x0018FCBC   0x0018E7E4   0x0049AD28

+0090: 0x004A2470   0x0018FCB0   0x00000103   0x19930520

+00A0: 0x004B5A04   0x00000000   0xFFFFFFFF   0x00000000

+00B0: 0x0018E7B8   0x0018E2F0   0x0018E854   0x00495198

+00C0: 0x004B4338   0x00000001   0x0018E804   0x0049B496

+00D0: 0x0018FCB0   0x0018E94C   0x004B5A04   0xFFFFFFFF

+00E0: 0x00000000   0x00000000   0x0018E83C   0x00492ADC

+00F0: 0x0018E8AC   0x0018FCB0   0x0018E958   0x0018E94C

+0100: 0x004B5A04   0x00000000   0x00000000   0x00000000

+0110: 0x00000000   0x00000000   0x00000000   0x004B5A04

+0120: 0x0018E860   0x77C0B459   0x0018E8AC   0x0018FCB0

+0130: 0x0018E958   0x0018E94C   0x0018FCB0   0x77C0B494



--------------------------

SA-MP Server: 0.3e-RC5



Exception At Address: 0x004721CC



Registers:

EAX: 0x00000000	EBX: 0x020FE628	ECX: 0x0018F0D0	EDX: 0x00000000

ESI: 0x00000000	EDI: 0x046A44D8	EBP: 0x0018F500	ESP: 0x0018F098

EFLAGS: 0x00010246



Stack:

+0000: 0x020FE628   0x0018F0D0   0x00000000   0x00000000

+0010: 0x00000000   0x00000000   0x73696969   0x00471F00

+0020: 0x6C616964   0x305F676F   0x00471F00   0x020FE628

+0030: 0x020FE628   0x040305CC   0x00000000   0x00000000

+0040: 0x00000000   0x00000000   0x00000000   0x00000000

+0050: 0x00000000   0x00000000   0x00000000   0x00000000

+0060: 0x00000000   0x00000000   0x00000000   0x00000000

+0070: 0x00000000   0x00000000   0x77BDE38C   0x76CAACBD

+0080: 0x0018FAC8   0x00390194   0x00390000   0x00452926

+0090: 0x0018F1BC   0x00700007   0x72776177   0x00000000

+00A0: 0x00453D57   0x00000008   0x020F4BC0   0x006E0008

+00B0: 0x72776177   0x00000002   0x0018F1B0   0x02080358

+00C0: 0x0044E659   0x00000007   0x0018FAC8   0x00000000

+00D0: 0x003913A0   0x02080048   0x0208015C   0x020A2348

+00E0: 0x020803D8   0x00000010   0x0018F114   0x0039DF80

+00F0: 0x0018F238   0x77C271D5   0x016F8F7D   0xFFFFFFFE

+0100: 0x77BDE38C   0x77BDE0F2   0x0018FAC8   0x00000007

+0110: 0x0209EF90   0x0039C3C8   0x00000010   0x00000010

+0120: 0x00000010   0x00000800   0x00000000   0x0018F1C9

+0130: 0x002BA901   0x13C21A01   0x0D68AEBA   0x04227AE6
Reply
#14

you cannot use empty strings through the CallLocalFunction or CallRemoteFunction, this "bug" doesn't happens only in 0.3e RC's, my server uses 0.3d and we had to include some codes checking if the string is empty before send it by parameter in these functions to finish up our server crashes.

the code is a simple thing like this;

Код:
if(strlen(string) == 0) { // or if(!strlen(string)), whatever..
       format(string, sizeof(string), "-");
}
and in the function that receive this string as a parameter, you can revert the value to an empty string again.
Reply
#15

Check for if the string is null. If yes, so inputtext should be like "\1".

From my dialog response processor include:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new bdialstr[24];
    format(bdialstr, 24, "dial_%d", dialogid);
    if((!(inputtext[0])) || (((inputtext[0]) == '\1') && (!(inputtext[1])))) return (CallLocalFunction(bdialstr, "dlds", playerid, !!response, listitem, "\1") == 0 ? (DIAL_ODR ? CallLocalFunction("Dial_OnDialogResponse", "dddds", playerid, dialogid, response, listitem, "\1") : 0) : 1);
    return (CallLocalFunction(bdialstr, "dlds", playerid, !!response, listitem, inputtext) == 0 ? (DIAL_ODR ? CallLocalFunction("Dial_OnDialogResponse", "dddds", playerid, dialogid, response, listitem, inputtext) : 0) : 1);
}
Reply
#16

You should delete their posts and not mine.
They made spam, because the answer is already on the begin of this page.
Moderation fail.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)