Why using native from string.inc crash samp-npc
#1

Using this command make 0.3x samp-npc to crash on any typed text Why?

pawn Код:
//source https://sampwiki.blast.hk/wiki/NPC:OnPlayerText
public OnPlayerText(playerid, text[])
{
    if (strfind(text, "stupid bot") != -1)
    {
        new string[80], name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "Hey %s! Don't say those things! We, bots, are cool!", name);
        SendChat(string);
    }
    return 1;
}
And here brake point of this :


Any help apprised.
Reply
#2

And the crash doesn't happen when you comment it out?
Reply
#3

yes no errors when /* */
And if i try to use if (strfind(text, "stupid bot") != -1) or any else string comparator the crash happen.

Edit: I will attach whole code to see it.

pawn Код:
//
// NPC Test Script
// Kye 2009
//

#include <a_npc>

//------------------------------------------

main()
{
    printf("npcidle: running");
}

//------------------------------------------
//------------ Talk TEST -------------------
public OnPlayerText(playerid, text[])
{

    if (strfind(text, "stupid bot") != -1)
    {
        new string[80], name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "Hey %s! Don't say those things! We, bots, are cool!", name);
        SendChat(string);
    }
    return 1;
}
//////////////////////////////////////////////
Compiler say everything is OK. And any chat from player samp-npc crash.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)