help onplayertext server crashed :s
#6

Take a look here carefully:
Quote:

[03:34:02]+ [chat] [Drake_Bones]: уH#шŽъKg$иЕ:лWэ§ыД˜|JaђŽ…›>™™hъиОЯd7вX7Xq№¦“
[03:34:02]+ [chat] [Drake_Bones]:
[03:34:02]+ [debug] Server crashed while executing JLadmin.amx

As you can see, he typed nothing (second line) and pressed enter. OnPlayerText was called and it passed an empty string in CallLocalFunction.

You can fix it by checking if the text is not empty/null:
pawn Code:
#if !defined isnull
    #define isnull(%1) \
                ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
pawn Code:
public OnPlayerText(playerid, text[])
{
    if (isnull(text)) return 0;
   
    CallLocalFunction("StoreChatLine", "ds", playerid, text);
// rest of code..
If it's null, it doesn't send anything and it prevents the server from being crashed.

However, there isn't any reason to use StoreChatLine with foward/public if you don't want to call it in another script or by a timer, you can use stock instead and just call it directly:
pawn Code:
StoreChatLine(playerid, text);
Reply


Messages In This Thread
help onplayertext server crashed :s - by Mahde - 04.02.2014, 10:25
Re: help onplayertext server crashed :s - by Mahde - 04.02.2014, 11:03
Re: help onplayertext server crashed :s - by EmilLykke - 04.02.2014, 11:08
Re: help onplayertext server crashed :s - by Konstantinos - 04.02.2014, 11:18
Re: help onplayertext server crashed :s - by Mahde - 04.02.2014, 11:20
Re: help onplayertext server crashed :s - by Konstantinos - 04.02.2014, 11:30
Re: help onplayertext server crashed :s - by Mahde - 04.02.2014, 11:50
Re: help onplayertext server crashed :s - by Konstantinos - 04.02.2014, 11:52
Re: help onplayertext server crashed :s - by Mahde - 04.02.2014, 11:56
Re: help onplayertext server crashed :s - by Konstantinos - 04.02.2014, 12:25

Forum Jump:


Users browsing this thread: 2 Guest(s)