04.02.2014, 11:30
Take a look here carefully:
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:
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:
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 |
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..
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);