SA-MP Forums Archive
Please help, NPCTALK!! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Please help, NPCTALK!! (/showthread.php?tid=110611)



Please help, NPCTALK!! - patchkinson - 27.11.2009

Whats wrong with this? the NPC doesnt reply to the text!!
http://pastebin.com/m63c609f4
thanks
when i say stupid bot etc.. he doesnt reply!


Re: Please help, NPCTALK!! - DaKill - 27.11.2009

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;
}



Re: Please help, NPCTALK!! - patchkinson - 27.11.2009

tbh it started working

like it is