NPC join then Leave D: why?
#8

Quote:
Originally Posted by meitaredri
Посмотреть сообщение
Hi , I know what is the problem , Public "OnPlayerRequestClass"
add this:
Код:
if(IsPlayerNPC(playerid)) return 1;
First of all, that's not correct because you're not doing anything with the NPC, second of all, OnPlayerRequestClass is obviously not the only callback that's called upon when a player, or in this instance - an NPC joins the server.


What you have to do, is force the NPC to spawn because they can't press the spawn button / login / whatever, themselves. You have to make them do it. So modify your code under the relevant callback so it looks something like this:

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(IsPlayerNPC(playerid))
    {
        SpawnPlayer(playerid);
    }
        return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        SpawnPlayer(playerid);

    }
        return 1;
}
If that doesn't do it, then place the same code as above under OnPlayerConnect. Later on if you want to do anything with the bots, say for example, set their position or vw, you just code that under...

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        //code
    }
    return 1;
}
Reply


Messages In This Thread
NPC join then Leave D: why? - by Mzake - 01.09.2014, 13:11
Re: NPC join then Leave D: why? - by meitaredri - 01.09.2014, 13:15
Re: NPC join then Leave D: why? - by DaniceMcHarley - 01.09.2014, 13:26
Re: NPC join then Leave D: why? - by M0HAMMAD - 01.09.2014, 15:54
Re: NPC join then Leave D: why? - by Mzake - 02.09.2014, 11:52
Re: NPC join then Leave D: why? - by Dotayuri - 02.09.2014, 11:57
Re: NPC join then Leave D: why? - by Mzake - 02.09.2014, 13:33
Re: NPC join then Leave D: why? - by Rifa4life - 02.09.2014, 16:55
Re: NPC join then Leave D: why? - by meitaredri - 02.09.2014, 16:58
Re: NPC join then Leave D: why? - by Clad - 02.09.2014, 16:59

Forum Jump:


Users browsing this thread: 1 Guest(s)