4th NPC Leaves. -
Lynn - 06.11.2011
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.
Re: 4th NPC Leaves. -
MP2 - 06.11.2011
How often after joining does it leave? Do you have IsPlayerNPC checks in place to stop OnPlayerConnect/Spawn/RequestClass etc.?
Re: 4th NPC Leaves. -
Lynn - 07.11.2011
Yes I have that where needed.
It's the only one that leaves.
The other three stay connected, and spawn, work how they should.
Re: 4th NPC Leaves. -
RadioRocker - 07.11.2011
Hm Show the message from the log when it leaves.
Re: 4th NPC Leaves. -
MP2 - 07.11.2011
Quote:
Originally Posted by MP2
How often after joining does it leave?
|
4char
Re: 4th NPC Leaves. -
Lynn - 07.11.2011
Like, after 10-15 Seconds
Re: 4th NPC Leaves. -
MP2 - 07.11.2011
Make sure the recording type is correct in the NPC'S mode script for the StartRecordingPlayback.
Re: 4th NPC Leaves. -
Lynn - 07.11.2011
Yes it's correct
Re: 4th NPC Leaves. -
MP2 - 07.11.2011
Perhaps you recorded it with the wrong type. Please show your onplayerspawn and npcmode code.
Re: 4th NPC Leaves. -
Lynn - 07.11.2011
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;
}
Re: 4th NPC Leaves. -
RadioRocker - 07.11.2011
Record again and try.
Re: 4th NPC Leaves. -
MP2 - 07.11.2011
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?
Re: 4th NPC Leaves. -
Lynn - 07.11.2011
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.
Re: 4th NPC Leaves. -
MP2 - 07.11.2011
Did you stop the recording when you finished?
Re: 4th NPC Leaves. -
Lynn - 07.11.2011
Yeah I did.
Re: 4th NPC Leaves. -
MP2 - 07.11.2011
Have you tried re-recording?
Re: 4th NPC Leaves. -
Kostas' - 07.11.2011
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;
}
Re: 4th NPC Leaves. -
Lynn - 07.11.2011
Obviously I am aware of that, if the first three stay connected xD
Re: 4th NPC Leaves. -
Kostas' - 07.11.2011
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
Re: 4th NPC Leaves. -
Lynn - 07.11.2011
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.