NPC join then Leave D: why?
#9

Quote:
Originally Posted by Rifa4life
Посмотреть сообщение
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;
}
hahahha what....
dude if you don't know how to script don't help

PHP код:
Common problems
My NPC leaves my server after it joins
Your script is forcing the NPC to login
, or you have an anti-cheat ping kicker that is interfering with your NPCYou can add...
pawn Code:
if(
IsPlayerNPC(playerid)) return 1;
... as 
the first line of any callbacks that bots will use, e.gOnPlayerRequestClass or OnPlayerRequestSpawn. For an efficientsimple way of excluding NPCs from loopscheck out foreach by ******
Read it.
https://sampforum.blast.hk/showthread.php?tid=95034

OnPlayerRequestClass or OnPlayerRequestSpawn

and don't say somting you don't know please.
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: 2 Guest(s)