SA-MP Forums Archive
NPC doesn't answer anymore - 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 doesn't answer anymore (/showthread.php?tid=381177)



NPC doesn't answer anymore - Timmeyable - 28.09.2012

Hi,

since yesterday i have a problem. My NPC doenst answer if i write for example "Hi Npc".
I think this is the problem:

public OnPlayerText(playerid, text[])
{
new strong[700];
format(strong, sizeof(strong), "(%d) %s:{FFFFFF} %s",playerid, SpielerName(playerid), text);
SendClientMessageToAll(GetPlayerColor(playerid), strong);
return 0;
}

The npc sends his text with SendChat.
I think SendChat doesnt work if OnPlayerText returns 0.
What can i do?

-Tim


Re: NPC doesn't answer anymore - xMCx - 28.09.2012

try this ive made
pawn Код:
if(!strcmp(text, "Hi Bot", true))
    {
      new string[128]; GetPlayerName(playerid,string,sizeof(string));
      format(string,sizeof(string),"%s[%d]: %s",string,playerid, text);
      SendClientMessageToAll(GetPlayerColor(playerid), string);
      SendClientMessageToAll(red, "[BOT]: Hey , Welcome!");
      return 0;
    }
and in your text, change strong to string..


AW: NPC doesn't answer anymore - Timmeyable - 28.09.2012

Hm, but i want to use SendChat in the NPC script and not SendClientMessageToAll :/

Quote:

and in your text, change strong to string..

I know. But in OnPlayerText already exists a "string". Thats why i'm named it strong


AW: NPC doesn't answer anymore - Timmeyable - 29.09.2012

I tested it with return 1. Now the original SendChat message and the formatted message is shown in chat.
But if i return 0 no message is shown in the chat.

What can i do