SA-MP Forums Archive
RNPC isn't spawning - 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: RNPC isn't spawning (/showthread.php?tid=642738)



RNPC isn't spawning - StrikerZ - 06.10.2017

Well, I'm trying to use RNPC, I'm using bare gamemode so no login dialog is there.
The problem is, it connects but doesn't spawns. Yes I'm using the PathFinder plugin too.
I tried with a simple script without PathFinder, that doesn't work too.
This code is on OnFilterScriptInit
PHP код:
for(new =0MAX_ZOMBIES;i++)
    {
       new 
spawn random(sizeof(ZombieSpawns));
          new 
name[24], then_npc;
       
format(namesizeof(name), ZOMBIE_NAMEzombie_count 1);
       
then_npc ConnectRNPC(name);
       
SpawnPlayer(then_npc);
       
SetPlayerPos(then_npc,ZombieSpawns[spawn][0], ZombieSpawns[spawn][1], ZombieSpawns[spawn][2]);
       
       
SetPlayerSkin(then_npcrandom(298)+1);
       
SetRNPCHealth(then_npcZOMBIE_HEALTH);
       
SetPlayerColor(then_npcZOMBIE_COLOR);
       
ZombieIsAttack[then_npc] = 0;
       
ApplyAnimation(then_npc"PED""WALK_fatold"3.111,  1,  0,  0);
       
zombie_count++;
       
RNPC_SetShootable(then_npc1);
    } 
To debug
PHP код:
public OnPlayerSpawn(playerid)
{
   new 
spawn random(sizeof(ZombieSpawns));
   if(
IsPlayerNPC(playerid))
   {
       
printf("Yes"); 
Log
PHP код:
[03:21:32] [connection127.0.0.1:58285 requests connection cookie.
[
03:21:32] [connection127.0.0.1:58286 requests connection cookie.
[
03:21:32] [connection127.0.0.1:58287 requests connection cookie.
[
03:21:32] [connection127.0.0.1:58288 requests connection cookie.
[
03:21:32] [connection127.0.0.1:58289 requests connection cookie.
[
03:21:32] [connection127.0.0.1:58290 requests connection cookie.
[
03:21:32] [connection127.0.0.1:58292 requests connection cookie.
[
03:21:32] [connection127.0.0.1:58291 requests connection cookie.
[
03:21:32] [connection127.0.0.1:58293 requests connection cookie.
[
03:21:32] [connection127.0.0.1:58294 requests connection cookie.
[
03:21:32] [connection127.0.0.1:58295 requests connection cookie.
[
03:21:32] [connection127.0.0.1:58296 requests connection cookie.
[
03:21:32] [connection127.0.0.1:58297 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58298 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58299 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58300 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58301 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58302 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58303 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58304 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58305 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58306 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58307 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58308 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58309 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58310 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58311 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58312 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58313 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58314 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58315 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58317 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58316 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58318 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58319 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58320 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58321 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58322 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58323 requests connection cookie.
[
03:21:33] [connection127.0.0.1:58324 requests connection cookie.
[
03:21:34] [connection127.0.0.1:58325 requests connection cookie.
[
03:21:34]   Loaded 1 filterscripts.
[
03:21:34] [connection127.0.0.1:58326 requests connection cookie.
[
03:21:34] [connection127.0.0.1:58327 requests connection cookie.
[
03:21:34] [connection127.0.0.1:58328 requests connection cookie.
[
03:21:34] [connection127.0.0.1:58329 requests connection cookie.
[
03:21:34] [connection127.0.0.1:58330 requests connection cookie.
[
03:21:34] [connection127.0.0.1:58331 requests connection cookie.
[
03:21:34]   RNPC versioncheckerchecking for updates...
[
03:21:34
/*-----------------------------------*\
[03:21:34] |*=====[TS Base GameMode Loaded]=====*|
[03:21:34] \*-----------------------------------*/
[03:21:34Number of vehicle models0
[03:21:34] [connectionincoming connection127.0.0.1:58285 id0
[03:21:34] [connectionincoming connection127.0.0.1:58286 id1
[03:21:34] [connectionincoming connection127.0.0.1:58288 id2
[03:21:34] [connectionincoming connection127.0.0.1:58287 id3
[03:21:34] [connectionincoming connection127.0.0.1:58289 id4
[03:21:34] [connectionincoming connection127.0.0.1:58292 id5
[03:21:34] [connectionincoming connection127.0.0.1:58290 id6
[03:21:34] [connectionincoming connection127.0.0.1:58291 id7
[03:21:34] [connectionincoming connection127.0.0.1:58293 id8
[03:21:34] [connectionincoming connection127.0.0.1:58294 id9
[03:21:34] [connectionincoming connection127.0.0.1:58295 id10
[03:21:34] [connectionincoming connection127.0.0.1:58296 id11
[03:21:34] [connectionincoming connection127.0.0.1:58297 id0
[03:21:34] [connectionincoming connection127.0.0.1:58298 id1
[03:21:34] [connectionincoming connection127.0.0.1:58299 id2
[03:21:34] [connectionincoming connection127.0.0.1:58300 id3
[03:21:34] [connectionincoming connection127.0.0.1:58301 id4
[03:21:34] [connection127.0.0.1:58332 requests connection cookie.
[
03:21:34] [connectionincoming connection127.0.0.1:58302 id5
[03:21:34] [connection127.0.0.1:58333 requests connection cookie.
[
03:21:34] [connectionincoming connection127.0.0.1:58303 id6
[03:21:34] [connection127.0.0.1:58334 requests connection cookie.
[
03:21:34] [connectionincoming connection127.0.0.1:58304 id0
[03:21:34] [connectionincoming connection127.0.0.1:58305 id7
[03:21:34] [connectionincoming connection127.0.0.1:58306 id1
[03:21:34] [connectionincoming connection127.0.0.1:58307 id2
[03:21:34] [connectionincoming connection127.0.0.1:58308 id3
[03:21:34] [connectionincoming connection127.0.0.1:58309 id0
[03:21:34] [connectionincoming connection127.0.0.1:58310 id4
[03:21:34] [connectionincoming connection127.0.0.1:58311 id1
[03:21:34] [connectionincoming connection127.0.0.1:58312 id2
[03:21:34] [connectionincoming connection127.0.0.1:58313 id5
[03:21:34] [connectionincoming connection127.0.0.1:58314 id6
[03:21:34] [connectionincoming connection127.0.0.1:58315 id3
[03:21:34] [connectionincoming connection127.0.0.1:58317 id0
[03:21:34] [connectionincoming connection127.0.0.1:58316 id4
[03:21:34] [connectionincoming connection127.0.0.1:58318 id7
[03:21:34] [connectionincoming connection127.0.0.1:58319 id1
[03:21:34] [connectionincoming connection127.0.0.1:58320 id2
[03:21:34] [connectionincoming connection127.0.0.1:58321 id5
[03:21:34] [connectionincoming connection127.0.0.1:58322 id3
[03:21:34] [connectionincoming connection127.0.0.1:58323 id6
[03:21:34] [connectionincoming connection127.0.0.1:58324 id0
[03:21:35] [connectionincoming connection127.0.0.1:58325 id1
[03:21:35] [connectionincoming connection127.0.0.1:58326 id2
[03:21:35] [connectionincoming connection127.0.0.1:58327 id4
[03:21:35] [connectionincoming connection127.0.0.1:58330 id5
[03:21:35] [connectionincoming connection127.0.0.1:58328 id7
[03:21:35] [connectionincoming connection127.0.0.1:58329 id8
[03:21:35] [connectionincoming connection127.0.0.1:58331 id3
[03:21:35] [connectionincoming connection127.0.0.1:58332 id0
[03:21:35] [connectionincoming connection127.0.0.1:58333 id6
[03:21:35] [connectionincoming connection127.0.0.1:58334 id
I even went in game to check but there's no NPC


Re: RNPC isn't spawning - oMa37 - 06.10.2017

Use SpawnPlayer(playerid); under OnPlayerRequestClass or/and OnPlayerRequestSpawn if the player is NPC.


Re: RNPC isn't spawning - StrikerZ - 06.10.2017

Quote:
Originally Posted by oMa37
Посмотреть сообщение
Use SpawnPlayer(playerid); under OnPlayerRequestClass or/and OnPlayerRequestSpawn if the player is NPC.
Doesn't work.
PHP код:
public OnPlayerRequestSpawn(playerid)
{
    if(
IsPlayerNPC(playerid))
    {
        
printf("Requesting Spawn");
        
SpawnPlayer(playerid);
    }
    return 
1;

Tried with class too, not working.


Re: RNPC isn't spawning - ToiletDuck - 06.10.2017

why not use fcnpc?


Re: RNPC isn't spawning - StrikerZ - 06.10.2017

EDIT: I ran the server ony my VPS, it works fine, does it have to do something with my PC ?