SA-MP Forums Archive
NPC connects but doesen't spawn. - 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 connects but doesen't spawn. (/showthread.php?tid=381148)



NPC connects but doesen't spawn. - Sasoft - 28.09.2012

My NPC doesen't spawn, it even prints DEALER SPAWNED.

pawn Код:
public OnGameModeInit()
{
      ConnectNPC("Dealer", "npcidle");
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    new sendername[MAX_PLAYER_NAME];
    if(IsPlayerNPC(playerid))
    {
        if(strcmp(sendername,"Dealer",true) == 0)
        {
            SetSpawnInfo(playerid, NO_TEAM, 280, 2319.1616,17.7953,26.4766,39.4589,-1,-1,-1,-1,-1,-1);
            print("DEALER SPAWNED");
        }
    }



Re: NPC connects but doesen't spawn. - BloodMaster - 28.09.2012

GetPlayerName(playerid, sendername,sizeof sendername);


Re: NPC connects but doesen't spawn. - Sasoft - 28.09.2012

Didn't change a thing.


Re: NPC connects but doesen't spawn. - iPLEOMAX - 28.09.2012

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    new sendername[MAX_PLAYER_NAME];
    if(IsPlayerNPC(playerid))
    {
        GetPlayerName(playerid, sendername, sizeof sendername);
        if(!strcmp(sendername,"Dealer",true))
        {
            SetSpawnInfo(playerid, NO_TEAM, 280, 2319.1616,17.7953,26.4766,39.4589,-1,-1,-1,-1,-1,-1);
            print("DEALER SPAWNED with ID%i", playerid);
            return 1;
        }
    }
And make sure it always returns 1 for this npc under OnPlayerRequestSpawn.


Re: NPC connects but doesen't spawn. - Sasoft - 28.09.2012

Quote:
Originally Posted by iPLEOMAX
Посмотреть сообщение
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    new sendername[MAX_PLAYER_NAME];
    if(IsPlayerNPC(playerid))
    {
        GetPlayerName(playerid, sendername, sizeof sendername);
        if(!strcmp(sendername,"Dealer",true))
        {
            SetSpawnInfo(playerid, NO_TEAM, 280, 2319.1616,17.7953,26.4766,39.4589,-1,-1,-1,-1,-1,-1);
            print("DEALER SPAWNED with ID%i", playerid);
            return 1;
        }
    }
And make sure it always returns 1 for this npc under OnPlayerRequestSpawn.
Thank you sir, was dying to get this to work. REP+ for you.