NPC doesn't answer anymore
#1

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
Reply
#2

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..
Reply
#3

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
Reply
#4

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)