12.04.2010, 21:58
Hello, I have followed a tutorial to create an NPC in my server and when the gamemode starts or restarts the NPC spawns in the vehicle and just stays underground.
I added this variable in my gamemode:
& put this under OnPlayerSpawn:
& put this under OnGameModeInit:
Here is the recording I created for the NPC which I saved in the 'npcmodes' folder as "mynpc.pwn":
And there's also a mynpc.rec in npcmodes/recordings.
Please help, I can't figure it out.
I added this variable in my gamemode:
Код:
new MyFirstNPCVehicle;
Код:
public OnPlayerSpawn(playerid)
{
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, "Graham_Jones", true)) //Checking if the NPC's name is MyFirstNPC
{
PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
}
return 1;
}
Код:
ConnectNPC("Graham_Jones","mynpc");
MyFirstNPCVehicle = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
Код:
#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_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
Please help, I can't figure it out.


it spwns at position 0 (under the map, somwhere in the middle of San Andreas)