Having issues with NPC's.
#1

pawn Код:
#define RECORDING "tramnpc" //This is the filename of your recording without the extension.
#define RECORDING_TYPE 1 //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
I pretty much copied a tutorial, it still doesn't work.

The recording filename is called 'tramnpc'
The file above is called record, Yes I compiled it.

pawn Код:
//ONGAMEMODEINIT
    ConnectNPC("Reacher","record");
    tramid = CreateVehicle(449, -1583.0962,1063.5284,7.0468, 0, 3, 3, 0,0);
ONPLAYERSPAWN.
pawn Код:
if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
    {
          PutPlayerInVehicle(playerid, tramid, 0); //Putting the NPC into the vehicle we created for it.
    }
I've changed the Maxnpcs to 5, it also isn't blocked by the firewall, any ideas?

I can slap the NPC, can't TP it and he won't drive the vehicle, have I missed anything?
Reply
#2

Well, each NPC is meant to have a script that they run in under 'npcmodes'. Did you create that little NPC script?
Reply
#3

try adding the following in OnPlayerConnect, OnPlayerDisconnect and OnPlayerRequestClass

pawn Код:
if( IsPlayerNPC( playerid ) )
    return 1;
Reply
#4

Are you sure your NPC isn't doing the registration/login dialog or any other dialog appearing upon connection?
Reply
#5

Checked both of those things, still unresolved.
Reply
#6

Bump still unresolved, the NPC is connected to the server but does not spawn in the vehicle.
Reply
#7

iknow you already posted important parts of the script are they still the same ?
i could compare it with a script i have spawning npc's in trams.
If i remember correct, i had issues with them too while they did spawn correctly in 'normal' vehicles.
Reply
#8

I tried a different vehicle since I thought that, myself.

Could you maybe show me your script?
Reply
#9

I had to dig deep into my files its a simple part but im sorry i cant be sure if it actually works but here you
are. Maybe you get some ideas..who knows...

gamemodeinit;
pawn Код:
tram1 = AddStaticVehicle(449,-2264.6882,527.2341,35.5907,180.4091,194,180);// tram (duh)
        // i remember using staticvehicle is better than using createvehicle if it comes to npc
spawning..
pawn Код:
public OnPlayerSpawn(playerid)
{

    if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
    {
        new npcname[MAX_PLAYER_NAME];
//----------------------------------NPC
        GetPlayerName(playerid, npcname, sizeof(npcname));
        if(!strcmp(npcname,"Jack",true)) {//
            SetPlayerSkin(playerid, 60);
            PutPlayerInVehicle(playerid,tram1, 0);
        }
    }
   return 1;
}
Dont have anything in onplayerconnect its just this.
BTW maybe because of isplayernpc return 1 in any script could conflict the use of npc's in your GM.
make sure to outrule that too.
Reply
#10

Thanks, I'll check this.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)