SA-MP Forums Archive
Kicking an NPC - 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: Kicking an NPC (/showthread.php?tid=360691)



Kicking an NPC - RedFusion - 18.07.2012

How do i kick an NPC in OnFilterScriptExit()?
And not all NPC's but one.


Re: Kicking an NPC - [KHK]Khalid - 18.07.2012

pawn Code:
public OnFilterScriptExit()
{
    new npcName[MAX_PLAYER_NAME];
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        if(!IsPlayerNPC(i))
            continue;
        GetPlayerName(i, npcName, sizeof(npcName));
        if(!strcmp(npcName, "YourNPCNameHere", false)) // YourNPCNameHere is the name of your npc that you used in ConnectNPC.
        {
            // Other stuff
            Kick(i);
            break; // to break out of the loop when it finds your npc (Useful when you have many npces connected).
        }
    }
    return 1;
}



Re: Kicking an NPC - RedFusion - 18.07.2012

Thanks!