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



NPC Recording - LiamM - 18.02.2012

Hey guys well I was considering adding a few NPC's into the game but I have a few questions. Now I know they take up a player slot. But is there a way to dedicate a slot to them? For example, I may only connect an NPC for a tutorial and once the tutorial is over, disconnect the NPC until another new player joins. But is there a way to keep that player slot once the NPC has disconnected off to stop the players being 30/30 and no spot for a NPC and it fucks up. :P


To sum it up, can you keep a player slot spare to use for a NPC for connecting a NPC when you need them.
Thanks.


Re: NPC Recording - Vince - 18.02.2012

pawn Код:
public OnPlayerConnect(playerid)
{
    if(playerid == GetMaxPlayers() - 1 && !IsPlayerNPC(playerid))
    {
        SendClientMessage(playerid, COLOR_RED, "We're sorry, this slot is reserved.");
        Kick(playerid);
    }
    return 1;
}
That's as close as you can get.


Re: NPC Recording - LiamM - 18.02.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
pawn Код:
public OnPlayerConnect(playerid)
{
    if(playerid == GetMaxPlayers() - 1 && !IsPlayerNPC(playerid))
    {
        SendClientMessage(playerid, COLOR_RED, "We're sorry, this slot is reserved.");
        Kick(playerid);
    }
    return 1;
}
That's as close as you can get.
Looking at that code it seems to do what I need. Thanks man!