4th NPC Leaves.
#1

So I have 4 NPC's set up.
All three set up the same.
On-foot.
I have Max NPC's set to 10(I only use 4)
I copied and pasted each of them from the first(So I knew I wouldn't forget something.)
Yet the 4th one for some reason leaves.
But the other 3 stay.
I don't get why.
Reply
#2

How often after joining does it leave? Do you have IsPlayerNPC checks in place to stop OnPlayerConnect/Spawn/RequestClass etc.?
Reply
#3

Yes I have that where needed.
It's the only one that leaves.
The other three stay connected, and spawn, work how they should.
Reply
#4

Hm Show the message from the log when it leaves.
Reply
#5

Quote:
Originally Posted by MP2
View Post
How often after joining does it leave?
4char
Reply
#6

Like, after 10-15 Seconds
Reply
#7

Make sure the recording type is correct in the NPC'S mode script for the StartRecordingPlayback.
Reply
#8

Yes it's correct
Reply
#9

Perhaps you recorded it with the wrong type. Please show your onplayerspawn and npcmode code.
Reply
#10

I used a key bind for all four.
So they'd all be the same record type.
Anyways,
pawn Code:
#define RECORDING "Soldier4" //This is the filename of your recording without the extension.
#define RECORDING_TYPE 2 //1 for in vehicle and 2 for on foot.

#include <a_npc>
main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);

#if RECORDING_TYPE == 1
  public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
  public OnNPCExitVehicle() StopRecordingPlayback();
#else
  public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
pawn Code:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;
    if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
        if(!strcmp(npcname, "Soldier_1", true)) //Checking if the NPC's name is MyFirstNPC
        {
            SetPlayerSkin(playerid, 287);
        }
        if(!strcmp(npcname, "Soldier_2", true)) //Checking if the NPC's name is MyFirstNPC
        {
            SetPlayerSkin(playerid, 287);
        }
        if(!strcmp(npcname, "Soldier_3", true)) //Checking if the NPC's name is MyFirstNPC
        {
            SetPlayerSkin(playerid, 287);
        }
        if(!strcmp(npcname, "Soldier_4", true)) //Checking if the NPC's name is MyFirstNPC
        {
            SetPlayerSkin(playerid, 287);
        }
        return 1;
    }
    return 1;
}
Reply
#11

Record again and try.
Reply
#12

Remove the first line in onplayerspawn, otherwise the skin setting code won't be reached. I suggest you try re-recording the NPC. Are you sure the soldier4.rec file is in \npcmodes\recordings?
Reply
#13

I placed that there earlier, to see if it was the problem, just forgot to delete it after. Thanks.
Yes, I'm sure. I doubled checked and tripped checked.
I will just have to re-record it I guess.
Reply
#14

Did you stop the recording when you finished?
Reply
#15

Yeah I did.
Reply
#16

Have you tried re-recording?
Reply
#17

It should be like this. 4 different .rec files on your <Your SA-MP server directory>/npcmodes/recordings/ and 4 different .pwn files like these under.
pawn Код:
#define RECORDING "Soldier1" //This is the filename of your recording without the extension.
#define RECORDING_TYPE 2 //1 for in vehicle and 2 for on foot.

#include <a_npc>
main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);

#if RECORDING_TYPE == 1
  public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
  public OnNPCExitVehicle() StopRecordingPlayback();
#else
  public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
pawn Код:
#define RECORDING "Soldier2" //This is the filename of your recording without the extension.
#define RECORDING_TYPE 2 //1 for in vehicle and 2 for on foot.

#include <a_npc>
main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);

#if RECORDING_TYPE == 1
  public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
  public OnNPCExitVehicle() StopRecordingPlayback();
#else
  public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
pawn Код:
#define RECORDING "Soldier3" //This is the filename of your recording without the extension.
#define RECORDING_TYPE 2 //1 for in vehicle and 2 for on foot.

#include <a_npc>
main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);

#if RECORDING_TYPE == 1
  public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
  public OnNPCExitVehicle() StopRecordingPlayback();
#else
  public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
pawn Код:
#define RECORDING "Soldier4" //This is the filename of your recording without the extension.
#define RECORDING_TYPE 2 //1 for in vehicle and 2 for on foot.

#include <a_npc>
main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);

#if RECORDING_TYPE == 1
  public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
  public OnNPCExitVehicle() StopRecordingPlayback();
#else
  public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
pawn Код:
public OnGameModeInit()
{
    ConnectNPC("Soldier_1","Soldier1");
    ConnectNPC("Soldier_2","Soldier2");
    ConnectNPC("Soldier_3","Soldier3");
    ConnectNPC("Soldier_4","Soldier4");
    //More
    return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) {                   //Checks if the player that just spawned is an NPC.
        new npcname[MAX_PLAYER_NAME];
                                                  //Getting the NPC's name.
        GetPlayerName(playerid, npcname, sizeof(npcname));
        if(!strcmp(npcname, "Soldier_1", true)) { //Checking if the NPC's name is MyFirstNPC
            SetPlayerSkin(playerid, 287);
            return 1;
        }
        if(!strcmp(npcname, "Soldier_2", true)) { //Checking if the NPC's name is MyFirstNPC
            SetPlayerSkin(playerid, 287);
            return 1;
        }
        if(!strcmp(npcname, "Soldier_3", true)) { //Checking if the NPC's name is MyFirstNPC
            SetPlayerSkin(playerid, 287);
            return 1;
        }
        if(!strcmp(npcname, "Soldier_4", true)) { //Checking if the NPC's name is MyFirstNPC
            SetPlayerSkin(playerid, 287);
            return 1;
        }
        return 1;
    }
    //For normal players goes here!
    return 1;
}
Reply
#18

Obviously I am aware of that, if the first three stay connected xD
Reply
#19

But you code isn't correct.
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;
    if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
        if(!strcmp(npcname, "Soldier_1", true)) //Checking if the NPC's name is MyFirstNPC
        {
            SetPlayerSkin(playerid, 287);
        }
        if(!strcmp(npcname, "Soldier_2", true)) //Checking if the NPC's name is MyFirstNPC
        {
            SetPlayerSkin(playerid, 287);
        }
        if(!strcmp(npcname, "Soldier_3", true)) //Checking if the NPC's name is MyFirstNPC
        {
            SetPlayerSkin(playerid, 287);
        }
        if(!strcmp(npcname, "Soldier_4", true)) //Checking if the NPC's name is MyFirstNPC
        {
            SetPlayerSkin(playerid, 287);
        }
        return 1;
    }
    return 1;
}
It doesn't need to have two
Код:
if(IsPlayerNPC(playerid))
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) {                   //Checks if the player that just spawned is an NPC.
        new npcname[MAX_PLAYER_NAME];
                                                  //Getting the NPC's name.
        GetPlayerName(playerid, npcname, sizeof(npcname));
        if(!strcmp(npcname, "Soldier_1", true)) { //Checking if the NPC's name is MyFirstNPC
            SetPlayerSkin(playerid, 287);
            return 1;
        }
        if(!strcmp(npcname, "Soldier_2", true)) { //Checking if the NPC's name is MyFirstNPC
            SetPlayerSkin(playerid, 287);
            return 1;
        }
        if(!strcmp(npcname, "Soldier_3", true)) { //Checking if the NPC's name is MyFirstNPC
            SetPlayerSkin(playerid, 287);
            return 1;
        }
        if(!strcmp(npcname, "Soldier_4", true)) { //Checking if the NPC's name is MyFirstNPC
            SetPlayerSkin(playerid, 287);
            return 1;
        }
        return 1;
    }
    //For normal players goes here!
    return 1;
}
Also, check again if the 4th NPC's file (.rec) is on the recordings folder and the .pwn in the npcmodes
Reply
#20

We already established that I only put it in there a second time to see if it was the cause.
Then I stated I didn't notice that I didn't delete it.
But thanks for tryin to help anyways.
I'm just going to re-record it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)