NPC Problems
#1

hi,
I'm trying to make a driving NPC but i have a problem.The NPCconnects and spawns but it stays at the spawn point.I've placed the rec and amx files in the correct folder.
I read many tutorials but it's still wrong.

script1:
Код:
#define RECORDING "bus"
#define RECORDING_TYPE 1 

#include <a_npc> 

public OnRecordingPlaybackEnd ( )
{
    StartRecordingPlayback ( RECORDING_TYPE, RECORDING );
    return 0;
}

#if RECORDING_TYPE == 1 
    public OnNPCEnterVehicle ( vehicleid, seatid )
    {
        StartRecordingPlayback ( RECORDING_TYPE, RECORDING );
        return 0;
    }
    public OnNPCExitVehicle ( )
    {
        StopRecordingPlayback ( );
        return 0;
    }
#else
    public OnNPCSpawn ( )
    {
        StartRecordingPlayback ( RECORDING_TYPE, RECORDING );
        return 0;
#endif
script2:
Код:
#include <a_samp>
#include <a_npc>

new Bus; 

public OnFilterScriptInit ( )
{
    print ( "BusNPC" );
    ConnectNPC ( "BusNPC", "BusRec" );
    Bus = CreateVehicle(437, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, 60);
    return 1;
}

public OnPlayerSpawn ( playerid )
{
    if ( IsPlayerNPC ( playerid ) )
    {
        new npcname [ MAX_PLAYER_NAME ];
        GetPlayerName ( playerid, npcname, sizeof ( npcname ) );
        if ( !strcmp ( npcname, "BusNPC", true ) )
        {
            PutPlayerInVehicle ( playerid, Bus, 0 );
        }
    }
}
I can't figure out what's the problem
Reply
#2

Isn't the NPC in a vehicle and is the vehicle created? I mean In-Game
Reply
#3

I've created the vehicle ingame but still nothing
Reply
#4

So the NPC is not going in his vehicle, you mean?

Maybe you got a login system and you must put in OnPlayerSpawn

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

I can't compile if i write this

error id:209
line:26
function "OnPlayeSpawn" should return a value
Reply
#6

pawn Код:
public OnPlayerSpawn(playerid)
{
   if(IsPlayerNPC(playerid)) return 1;
   // your codes of login/register
   return 1;
}
Reply
#7

I don't have login/register system
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)