Az a baj, hogy kickeli ugyebár, de aztán nem csatlakoznak vissza... :wall:
[21:48:33] Incoming connection: 127.0.0.1:44141
[21:48:33] Incoming connection: 127.0.0.1:53158
[21:48:33] Incoming connection: 127.0.0.1:33894
[21:48:33] [npc:join] NPC1 has joined the server (0:127.0.0.1)
[21:48:33] [npc:join] NPC2 has joined the server (1:127.0.0.1)
[21:48:33] [npc:join] NPC3 has joined the server (2:127.0.0.1)
[21:48:34] [npc:part] NPC1 has left the server (0:2)
[21:48:34] [npc:part] NPC2 has left the server (1:2)
[21:48:34] [npc:part] NPC3 has left the server (2:2)
#include <a_samp>
#include <a_npc>
#define FILTERSCRIPT
#define MAX_LASTNPC 3 //MAX 100 NPC
new maxplcheck;
forward NPCLoadUpdate();
public NPCLoadUpdate()
{
ConnectNPC(\"NPC1\",\"barman1\");
ConnectNPC(\"NPC2\",\"barman2\");
ConnectNPC(\"NPC3\",\"barman3\");
return 1;
}
public OnFilterScriptInit()
{
SlotNPC();
return 1;
}
stock SlotNPC()
{
maxplcheck = GetServerVarAsInt(\"maxplayers\");
for(new i = 0; i <= maxplcheck-1-MAX_LASTNPC; i++)
{
new str[64];
format(str,sizeof(str),\"barman1\",i);
ConnectNPC(str,\"NPC1\");
}
for(new i = 0; i <= maxplcheck-1-MAX_LASTNPC; i++)
{
new str[64];
format(str,sizeof(str),\"barman2\",i);
ConnectNPC(str,\"NPC2\");
}
for(new i = 0; i <= maxplcheck-1-MAX_LASTNPC; i++)
{
new str[64];
format(str,sizeof(str),\"barman3\",i);
ConnectNPC(str,\"NPC3\");
}
SetTimer(\"NPCLoadUpdate\",1000,0);
SetTimer(\"KickTime\",2000,0);
return 1;
}
forward KickTime();
public KickTime()
{
maxplcheck = GetServerVarAsInt(\"maxplayers\");
for(new i = 0; i <= maxplcheck-1-MAX_LASTNPC; i++)
{
Kick(i);
}
}
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid))
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname));
if (!strcmp(npcname, \"NPC1\", true))
{
SetPlayerSkin(playerid, 260);
return 1;
}
else if (!strcmp(npcname, \"NPC2\", true))
{
SetPlayerSkin(playerid, 287);
return 1;
}
else if (!strcmp(npcname, \"NPC3\", true))
{
SetPlayerSkin(playerid, 216);
return 1;
}
}
return 1;
}