NPC Problems - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: NPC Problems (
/showthread.php?tid=157634)
NPC Problems -
Dave001 - 07.07.2010
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
Re: NPC Problems -
CAR - 07.07.2010
Isn't the NPC in a vehicle and is the vehicle created? I mean In-Game
Re: NPC Problems -
Dave001 - 07.07.2010
I've created the vehicle ingame but still nothing
Re: NPC Problems -
CAR - 07.07.2010
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;
Re: NPC Problems -
Dave001 - 07.07.2010
I can't compile if i write this
error id:209
line:26
function "OnPlayeSpawn" should return a value
Re: NPC Problems -
CAR - 07.07.2010
pawn Код:
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid)) return 1;
// your codes of login/register
return 1;
}
Re: NPC Problems -
Dave001 - 07.07.2010
I don't have login/register system