[NPC HELP] The NPC spawns underground and just stays there; - 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 HELP] The NPC spawns underground and just stays there; (
/showthread.php?tid=141343)
[NPC HELP] The NPC spawns underground and just stays there; -
BugsY - 12.04.2010
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:
Код:
new MyFirstNPCVehicle;
& put this under OnPlayerSpawn:
Код:
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;
}
& put this under OnGameModeInit:
Код:
ConnectNPC("Graham_Jones","mynpc");
MyFirstNPCVehicle = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
Here is the recording I created for the NPC which I saved in the 'npcmodes' folder as "mynpc.pwn":
Код:
#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
And there's also a mynpc.rec in npcmodes/recordings.
Please help, I can't figure it out.
Re: [NPC HELP] The NPC spawns underground and just stays there; -
M4S7ERMIND - 12.04.2010
Maybe you shouldnt start recording playback when NPC spawns, becauz it will start once NPC is put in the vehicle.
Re: [NPC HELP] The NPC spawns underground and just stays there; -
mihaitza55 - 15.04.2010
Happens to me too

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