npc chat help
#1

ok so im making an npc but when you type a message to it the response comes before the orginal message.that needs to be fixed. heres the code




if (strfind(text, "Wheres a good place to eat?") != -1)
{
switch(random(3))
{
case 0:
{
SendPlayerMessageToPlayer(playerid,0,"The steak house is a good place in north LV near the fire station.");
}
case 1:
{
SendPlayerMessageToPlayer(playerid,0,"Theres an awesome buffet at the four dragons just southbound from here.");
}
case 2:
{
SendPlayerMessageToPlayer(playerid,0,"Theres a donut shop all the way southbound this road to the right!");
}
}
}
return 1;
}
Reply
#2

pawn Код:
OnPlayerText(playerid, text[])
{
    if (strfind(text, "Wheres a good place to eat?") != -1)
    {
        switch(random(3))
        {
            case 0:
            {
                SendPlayerMessageToPlayer(playerid,0,"The steak house is a good place in north LV near the fire station.");
            }
            case 1:
            {
                SendPlayerMessageToPlayer(playerid,0,"Theres an awesome buffet at the four dragons just southbound from here.");
            }
            case 2:
            {
                SendPlayerMessageToPlayer(playerid,0,"Theres a donut shop all the way southbound this road to the right!");
            }
        }
        return 0;
    }
    return 1;
}
Untested.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)