NPC chat
#1

I have made some answers from the NPC bot when typing some particular words in a line

But the answers appears over the players words like the NPC already known what he was going to type.

Example:
if type /lifterman

i got this
Answer:
lifterman: What do you want Cruising?
Cruising: lifterman

It should be:
Cruising: lifterman
lifterman: What do you want Cruising?

any way to fix that? or is it just that way it is?

Code:
pawn Код:
public OnPlayerText(playerid, text[])
{
    if (strfind(text, "lifterman") != -1)
    {
        new string[80], name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "lifterman: What do you want %s?", name);
        SendClientMessageToAll(0xFFFFFFFF, string);
    }
    else if (strfind(text, "who are you?") != -1)
    {
        new string[80], name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "lifterman: I am your worst nightmare!", name);
        SendClientMessageToAll(0xFFFFFFFF, string);
    }
    else if (strfind(text, "fuck you") != -1)
    {

        new string[80], name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string),"lifterman: You talking to me %s? or did you just got owned? haha", name);
        SendClientMessageToAll(0xFFFFFFFF, string);
    }
    return 1;
}
Reply
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
"OnPlayerText" is called BEFORE the text is shown, the "return 1" signals the server to show it, which is how "return 0" can cancel text. To do this you would need to set a 0ms timer to show the reply.
Ah ok then i understand! How do i make that timer proper for the text?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)