How to interact with an npcmode file?
#9

From NPC to GM:
SendCommand -> OnPlayerCommandText

From GM to NPC:
SendClientMessage -> OnClientMessage

Example:

NPC:
pawn Код:
public OnNPCSpawn()
{
    SendCommand("/npcspawn");
    return 1;
}
GM:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(IsPlayerNPC(playerid))
    {
        if(strcmp(cmdtext, "/npcspawn", true) == 0)
        {
            SendClientMessage(playerid, -1, "/talk");
            return 1;
        }
        return 0;
    }
    return 0;
}
NPC:
pawn Код:
public OnClientMessage(color, text[])
{
    if(strcmp(text,"/talk", true) == 0)
    {
        SendChat("I just spawned");
        return 1;
    }
    return 1;
}
Reply


Messages In This Thread
How to interact with an npcmode pwn file? - by Donya - 11.05.2011, 23:22
Re: How to interact with an npcmode file? - by marinov - 12.05.2011, 00:09
Re: How to interact with an npcmode file? - by Donya - 12.05.2011, 00:12
Re: How to interact with an npcmode file? - by marinov - 12.05.2011, 00:16
Re: How to interact with an npcmode file? - by Donya - 12.05.2011, 00:57
Re: How to interact with an npcmode pwn file? - by marinov - 12.05.2011, 01:00
Re: How to interact with an npcmode file? - by Donya - 12.05.2011, 01:05
Re: How to interact with an npcmode file? - by THE_KNOWN - 18.05.2011, 06:22
Re: How to interact with an npcmode file? - by MadeMan - 18.05.2011, 13:01

Forum Jump:


Users browsing this thread: 1 Guest(s)