SA-MP Forums Archive
NPC crash when it tries to read text - 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)
+--- Thread: NPC crash when it tries to read text (/showthread.php?tid=360082)



NPC crash when it tries to read text - omario - 16.07.2012

each time i try to use either strcmp or strfind in either OnClientMessage or OnPlayerText callback in NPC script the npc crashes

for example :

pawn Код:
public OnPlayerText(playerid, text[])
{
    if (strfind(text, "Hey Bot") != -1)
    {
        new string[80], name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "Hey %s", name);
        SendChat(string);
    }
    return 1;
}
when i chat hi bot the bot should answer me , but it dont answer and crashes ( leave server )

same happens when i use strfind or strcmp in OnClientMessage or in OnPlayerText
so the bot crashes when it tries to read any text

any one can help me ??