SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 06/11/2011, 09:15 PM   #1
Lynn
Gangsta
 
Lynn's Avatar
 
Join Date: Jan 2010
Location: Detroit, Michigan USA
Posts: 937
Reputation: 108
Default 4th NPC Leaves.

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.
__________________
Former developer at Next Generation Gaming
Lynn is offline   Reply With Quote
Old 06/11/2011, 10:18 PM   #2
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,236
Reputation: 1004
Default Re: 4th NPC Leaves.

How often after joining does it leave? Do you have IsPlayerNPC checks in place to stop OnPlayerConnect/Spawn/RequestClass etc.?
__________________
Owner and developer of Mike's Cops and Robbers.

Click here to visit our site and find out more. Click here to view trailers.
Enter referral code SAMPFORUM after registering for a $5000 starting bonus!
MP2 is offline   Reply With Quote
Old 07/11/2011, 01:31 AM   #3
Lynn
Gangsta
 
Lynn's Avatar
 
Join Date: Jan 2010
Location: Detroit, Michigan USA
Posts: 937
Reputation: 108
Default Re: 4th NPC Leaves.

Yes I have that where needed.
It's the only one that leaves.
The other three stay connected, and spawn, work how they should.
__________________
Former developer at Next Generation Gaming
Lynn is offline   Reply With Quote
Old 07/11/2011, 01:38 AM   #4
RadioRocker
Banned
 
Join Date: Nov 2011
Location: In between the samp map..
Posts: 24
Reputation: 12
Default Re: 4th NPC Leaves.

Hm Show the message from the log when it leaves.
RadioRocker is offline   Reply With Quote
Old 07/11/2011, 02:40 AM   #5
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,236
Reputation: 1004
Default Re: 4th NPC Leaves.

Quote:
Originally Posted by MP2 View Post
How often after joining does it leave?
4char
__________________
Owner and developer of Mike's Cops and Robbers.

Click here to visit our site and find out more. Click here to view trailers.
Enter referral code SAMPFORUM after registering for a $5000 starting bonus!
MP2 is offline   Reply With Quote
Old 07/11/2011, 02:48 AM   #6
Lynn
Gangsta
 
Lynn's Avatar
 
Join Date: Jan 2010
Location: Detroit, Michigan USA
Posts: 937
Reputation: 108
Default Re: 4th NPC Leaves.

Like, after 10-15 Seconds
__________________
Former developer at Next Generation Gaming
Lynn is offline   Reply With Quote
Old 07/11/2011, 02:54 AM   #7
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,236
Reputation: 1004
Default Re: 4th NPC Leaves.

Make sure the recording type is correct in the NPC'S mode script for the StartRecordingPlayback.
__________________
Owner and developer of Mike's Cops and Robbers.

Click here to visit our site and find out more. Click here to view trailers.
Enter referral code SAMPFORUM after registering for a $5000 starting bonus!
MP2 is offline   Reply With Quote
Old 07/11/2011, 02:56 AM   #8
Lynn
Gangsta
 
Lynn's Avatar
 
Join Date: Jan 2010
Location: Detroit, Michigan USA
Posts: 937
Reputation: 108
Default Re: 4th NPC Leaves.

Yes it's correct
__________________
Former developer at Next Generation Gaming
Lynn is offline   Reply With Quote
Old 07/11/2011, 02:58 AM   #9
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,236
Reputation: 1004
Default Re: 4th NPC Leaves.

Perhaps you recorded it with the wrong type. Please show your onplayerspawn and npcmode code.
__________________
Owner and developer of Mike's Cops and Robbers.

Click here to visit our site and find out more. Click here to view trailers.
Enter referral code SAMPFORUM after registering for a $5000 starting bonus!
MP2 is offline   Reply With Quote
Old 07/11/2011, 03:01 AM   #10
Lynn
Gangsta
 
Lynn's Avatar
 
Join Date: Jan 2010
Location: Detroit, Michigan USA
Posts: 937
Reputation: 108
Default Re: 4th NPC Leaves.

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;
}
__________________
Former developer at Next Generation Gaming
Lynn is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
When a player leaves a checkpoint Vero Help Archive 2 05/07/2011 07:12 PM
[MySQL] set some values, and leaves others at 0 Whitetiger Help Archive 4 08/05/2011 01:00 PM
NPC Leaves InDeX Server Support 7 16/03/2011 06:51 AM
Leaves the pawn Finging Help Archive 4 16/02/2011 05:27 PM
NPC leaves after some seconds ||123|| Help Archive 2 21/05/2010 12:57 AM


All times are GMT. The time now is 06:20 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.