OnNPCSpawn - 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: OnNPCSpawn (
/showthread.php?tid=391841)
OnNPCSpawn -
thefatshizms - 11.11.2012
When i add the public OnNPCSpawn() it says i need to forward it first.
Re: OnNPCSpawn -
Plovix - 11.11.2012
Just forward it at beginning of the code and if you want to check when npc spawns just use isplayernpc on onplayerspawn
Re: OnNPCSpawn -
Jaxson - 11.11.2012
Perhaps you didn't include the a_npc include or something?
Re: OnNPCSpawn -
thefatshizms - 11.11.2012
I included it.
Re: OnNPCSpawn -
Konstantinos - 11.11.2012
I remember I have read that a_npc does not work in the gamemode/filterscripts. This functions should be on the npcmodes folder/files
Re: OnNPCSpawn -
thefatshizms - 11.11.2012
so how do i make a npc script?
script it but then place it in scriptfiles folder?
Re: OnNPCSpawn -
Konstantinos - 12.11.2012
No, you have to open with pawno.exe the file from the
pawn Код:
..npcmodes /my_file_here.pwn
An example of the at400_ls by Kye, it uses the include there.
pawn Код:
//
// A Driver NPC that goes around a path continuously
// Kye 2009
//
#include <a_npc>
#define NUM_PLAYBACK_FILES 3
new gPlaybackFileCycle=0;
//------------------------------------------
main(){}
//------------------------------------------
NextPlayback()
{
// Reset the cycle count if we reach the max
if(gPlaybackFileCycle==NUM_PLAYBACK_FILES) gPlaybackFileCycle = 0;
if(gPlaybackFileCycle==0) {
StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"at400_ls_to_lv_x1");
}
else if(gPlaybackFileCycle==1) {
StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"at400_lv_to_sf_x1");
}
else if(gPlaybackFileCycle==2) {
StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"at400_sf_to_ls_x1");
}
gPlaybackFileCycle++;
}
//------------------------------------------
public OnRecordingPlaybackEnd()
{
NextPlayback();
}
//------------------------------------------
public OnNPCEnterVehicle(vehicleid, seatid)
{
NextPlayback();
}
//------------------------------------------
public OnNPCExitVehicle()
{
StopRecordingPlayback();
gPlaybackFileCycle = 0;
}
//------------------------------------------
Re: OnNPCSpawn -
DBan - 12.11.2012
You cannot use <a_npc> and <a_samp> in the same script. You would have to create a separate script (placed in npcmodes as said above) if you want to use <a_npc>.
Re: OnNPCSpawn -
Mauzen - 12.11.2012
Yep, a_npc is the replacement of a_samp for npc scripts. You cant use it in normal scripts, and the other way round.
So there is no OnNPCSpawn in normal gamemode scripts. Use OnPlayerSpawn for that.
OnNPCSpawn is just used in npc scripts. Check the tutorial section for more infos.