NPC's not using the vehicle I want them to? -
Riggster - 23.12.2012
When my npcs spawn they seem to steal each others cars (Like the one I want in a police heli is in a freeway flying around and the npc I want on a freeway is just standing still) can anyone help here is the code -
Filterscript they are in -
pawn Код:
#define FILTERSCRIPT
#define RECORDING "mynpc" //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_samp>
#include <a_npc>
#if defined FILTERSCRIPT
new First; //my npc
new Second; //Cheeta driver
new npcname[MAX_PLAYER_NAME];
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("My NPC's");
print("--------------------------------------\n");
ConnectNPC("Tim","freeway");
First = CreateVehicle(463, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
ConnectNPC("Frank","cheeta");
Second = CreateVehicle(497, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
{
GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
if(!strcmp(npcname, "Tim", true)) //Checking if the NPC's name is MyFirstNPC
SetPlayerSkin(playerid, 248);
{
PutPlayerInVehicle(playerid, First, 1); //Putting the NPC into the vehicle we created for it.
}
return 1;
}
if(!strcmp(npcname, "Frank", true))
{
PutPlayerInVehicle(playerid, Second, 2);
return 1;
}
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
Mini script for both -
freeway -
pawn Код:
#define RECORDING "freeway" //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
police helicopter the "mini" script is called cheeta I dont know why I did that -
pawn Код:
#define RECORDING "phawk" //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
Screen shot of what they do (This time the phawk was not there when I spawned -
http://imgur.com/a/aeCd6
Re: NPC's not using the vehicle I want them to? -
Riggster - 23.12.2012
Can anyone help?
Re: NPC's not using the vehicle I want them to? -
[HiC]TheKiller - 23.12.2012
Not quite sure how that even compiled but change
pawn Код:
#define FILTERSCRIPT
#define RECORDING "mynpc" //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_samp>
#include <a_npc>
#if defined FILTERSCRIPT
new First; //my npc
new Second; //Cheeta driver
new npcname[MAX_PLAYER_NAME];
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("My NPC's");
print("--------------------------------------\n");
ConnectNPC("Tim","freeway");
First = CreateVehicle(463, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
ConnectNPC("Frank","cheeta");
Second = CreateVehicle(497, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
{
GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
if(!strcmp(npcname, "Tim", true)) //Checking if the NPC's name is MyFirstNPC
SetPlayerSkin(playerid, 248);
{
PutPlayerInVehicle(playerid, First, 1); //Putting the NPC into the vehicle we created for it.
}
return 1;
}
if(!strcmp(npcname, "Frank", true))
{
PutPlayerInVehicle(playerid, Second, 2);
return 1;
}
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
To
pawn Код:
#include <a_samp>
new First; //my npc
new Second; //Cheeta driver
new npcname[MAX_PLAYER_NAME];
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("My NPC's");
print("--------------------------------------\n");
ConnectNPC("Tim","freeway");
First = CreateVehicle(463, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
ConnectNPC("Frank","cheeta");
Second = CreateVehicle(497, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
return 1;
}
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
{
GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
if(!strcmp(npcname, "Tim", true)) //Checking if the NPC's name is MyFirstNPC
{
SetPlayerSkin(playerid, 248);
PutPlayerInVehicle(playerid, First, 0); //Putting the NPC into the vehicle we created for it.
}
else if(!strcmp(npcname, "Frank", true))
{
PutPlayerInVehicle(playerid, Second, 0);
}
}
return 1;
}