SA-MP Forums Archive
Help NPC! Disconnect - 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: Help NPC! Disconnect (/showthread.php?tid=522142)



Help NPC! Disconnect - danish007 - 26.06.2014

How Can i Kick Or Disconnect All NPC's OnGameModeExit

i've 17 NPC's and I want To Kick or Disconnect All NPC's OnGameModeExit

Please Help
and When i Start Server it says

Код:
[01:26:35] Incoming connection: 127.0.0.1:65468
[01:26:35] Incoming connection: 127.0.0.1:65469
[01:26:36] Incoming connection: 127.0.0.1:65471
[01:26:36] Incoming connection: 127.0.0.1:65470
[01:26:36] Incoming connection: 127.0.0.1:65479
[01:26:36] Incoming connection: 127.0.0.1:65478
[01:26:36] Incoming connection: 127.0.0.1:65472
[01:26:36] Incoming connection: 127.0.0.1:65473
[01:26:36] Incoming connection: 127.0.0.1:65476
[01:26:36] Incoming connection: 127.0.0.1:65474
[01:26:36] Incoming connection: 127.0.0.1:65475
[01:26:36] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:36] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:36] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:37] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:37] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:38] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:38] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:38] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:38] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:38] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:38] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:38] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:38] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:39] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:39] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:39] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:39] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:39] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:40] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:40] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:40] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:40] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:40] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:41] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:41] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:41] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:41] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:41] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:42] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:26:42] Blocking 127.0.0.1 due to a 'server full' attack (1)
[01:27:05] Kicking 127.0.0.1 because they didn't logon to the game.
[01:27:05] Kicking 127.0.0.1 because they didn't logon to the game.
[01:27:06] Kicking 127.0.0.1 because they didn't logon to the game.
[01:27:06] Kicking 127.0.0.1 because they didn't logon to the game.
[01:27:06] Kicking 127.0.0.1 because they didn't logon to the game.
[01:27:06] Kicking 127.0.0.1 because they didn't logon to the game.
[01:27:06] Kicking 127.0.0.1 because they didn't logon to the game.
[01:27:06] Kicking 127.0.0.1 because they didn't logon to the game.
[01:27:06] Kicking 127.0.0.1 because they didn't logon to the game.
[01:27:06] Kicking 127.0.0.1 because they didn't logon to the game.
[01:27:06] Kicking 127.0.0.1 because they didn't logon to the game.
[01:27:14] 
----------------------------------
[01:27:14] SERVER: Cruel World Cops & Robbers (0.3z)
[01:27:14] GAME MODE: Cops & Robbers
[01:27:14] MAP NAME: Las Venturas
[01:27:14] VERSION: 1.0
[01:27:14] MAX PLAYER SLOTS: 100

[01:27:14] NPC Connect: Bad player ID (127.0.0.1)
[01:27:14] NPC Connect: Bad player ID (127.0.0.1)
[01:27:14] NPC Connect: Bad player ID (127.0.0.1)
[01:27:14] NPC Connect: Bad player ID (127.0.0.1)
[01:27:14] NPC Connect: Bad player ID (127.0.0.1)
[01:27:14] NPC Connect: Bad player ID (127.0.0.1)
[01:27:14] NPC Connect: Bad player ID (127.0.0.1)
[01:27:14] NPC Connect: Bad player ID (127.0.0.1)
[01:27:14] NPC Connect: Bad player ID (127.0.0.1)
[01:27:14] NPC Connect: Bad player ID (127.0.0.1)
[01:27:14] NPC Connect: Bad player ID (127.0.0.1)



Re: Help NPC! Disconnect - Riwerry - 26.06.2014

I'm not really sure if it'll work, haven't tested it, but I think it should:
pawn Код:
#define YOUR_NPC_COUNT 17 //Edit count of NPCs if necessary

static const stock NPC_NAMES[][] = { //Just edit and add names of your NPCs to quotes
    "Joe",
    "Nick",
    "..."
};

public OnGameModeExit() {
    new
        name[MAX_PLAYER_NAME];
   
    for (new i, j; i < MAX_PLAYERS, j != YOUR_NPC_COUNT; i++) {
        GetPlayerName(i, name, sizeof (name));
        if (!strcmp(name, NPC_NAMES[j])) {
            //We've found NPC
            Kick(i);
                        j++;
        }
    }
    return 1;
}