You cant use
SendChat in FilterScript or GameMode. You can use in only NPC script.
You cant use callback
OnPlayerText in NPC script. Use
OnPlayerText in FilterScript or GameMode and replace
SendChat to
SendPlayerMessageToAll.
Код:
public OnPlayerText(playerid, text[])
{
if (strfind(text, "text") != -1)
{
SendPlayerMessageToAll(gPlayerID("BotName"), "Bot text.");
}
}
stock gPlayerID(const Name[])
{
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(i, pName, sizeof(pName));
if(strcmp(Name, pName, true) == 0)
{
return i;
}
}
}
return -1;
}