Kick an NPC
#1

Hey guys i got 4 NPCS in my script.

And i want to know how do i kick the shit npcs?

Please tell me.

Thanks!

Davz~
Reply
#2

Oh my god, what the hell is this, No one knows what to do? = Ima feel sorry for 1 bump.
Reply
#3

Delete ConnectNPC under OnGameModeInit?
Reply
#4

Simply use "Kick":
pawn Код:
Kick(id);
Reply
#5

that doesnt work
Reply
#6

Yes it does - What about trying?
Reply
#7

Hi if it works for you.

It does not work for me, Sir.

Here is the code:

pawn Код:
public KickHydraAssualts(playerid)
{
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
    if(!strcmp(npcname, "HydraAssualt1", true))
    {
      Kick(HydraAssualt1);
      Kick(playerid);
      return 1;
    }
    if(!strcmp(npcname, "HydraAssualt2", true))
    {
      Kick(HydraAssualt2);
      Kick(playerid);
      return 1;
    }
    if(!strcmp(npcname, "HydraAssualt3", true))
    {
      Kick(HydraAssualt3);
      Kick(playerid);
      return 1;
    }
    if(!strcmp(npcname, "HydraAssualt4", true))
    {
      Kick(HydraAssualt4);
      Kick(playerid);
      return 1;
    }
    return 1;
}
I have set an timer about 42 seconds, and that kicks npc..

But none of this works.
Reply
#8

Try this without any timer - Just add the example in a simple command to see if it works (it should work):
pawn Код:
stock KickNPC(npcName[])
{
    for(new i, tmpName[MAX_PLAYER_NAME]; i < MAX_PLAYERS; ++i)
    {
        if(IsPlayerNPC(i))
        {
            if(!strcmp(tmpName, npcName, true))
            {
                return Kick(i);
            }
        }
    }
    return 0;
}
Usage:
pawn Код:
KickNPC("HydraAssualt1");
Reply
#9

thanks very much!
Reply
#10

change maxnpcs in your server.cfg to 0
so no npcs can connect
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)