Problems with NPC (spawn 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)
+--- Thread: Problems with NPC (spawn problems) (
/showthread.php?tid=378660)
Problems with NPC (spawn problems) -
Squirrel - 18.09.2012
I cant spawn NPC's. I dont know why.
Here is the code of how I added it:
PHP Code:
ConnectNPC("[BOT]GroveStreet","NPC"); //This is on game mode init
if(IsPlayerNPC(playerid)) //OnPlayerSpawn
{
SetPlayerSkin(playerid,12);
GivePlayerWeapon(playerid,24,99999);
return 1;
}
I have file named "NPC" in my npcmodes and I have a file called "twinkisnpc" in my recordings.
I do not get any errors but it's not spawning them :/
my npc mode
PHP Code:
#include <a_npc>
main() {}
NextPlayBack()
{
StartRecordingPlayback(PLAYER_RECORDING_TYPE_ONFOOT,"NPC");
}
public OnRecordingPlaybackEnd()
{
NextPlayBack();
}
public OnNPCSpawn()
{
NextPlayBack();
}
public OnNPCExitVehicle()
{
StopRecordingPlayback();
}
It's connecting the NPC but not actually spawning it...
PHP Code:
[20:24:43] [npc:join] [BOT]GroveStreet has joined the server (0:127.0.0.1)
Re: Problems with NPC (spawn problems) -
Hiddle - 18.09.2012
Well, you haven't set them up for spawning, For my NPC, in the npcmode it looks like this:
Code:
#define RECORDING "DealerNPC2" //This is the filename of your recording without the extension.
#define RECORDING_TYPE 2 //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()
{
SetMyPos(1091.7188,-1791.7927,13.6404); <------ Maybe try Putting this in yours?
StartRecordingPlayback(RECORDING_TYPE, RECORDING);
}
#endif
Re: Problems with NPC (spawn problems) -
Squirrel - 18.09.2012
Is that in your npcmodes or in your GM?
Re: Problems with NPC (spawn problems) -
Hiddle - 18.09.2012
Npcmodes
Re: Problems with NPC (spawn problems) -
Squirrel - 18.09.2012
Thanks mate. I finally did it. It's just spawning correctly
Just to add few more things in it and I will be one happy panda.
+rep!