SA-MP Forums Archive
[HELP]NPC - 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: [HELP]NPC (/showthread.php?tid=254113)



[HELP]NPC - System64 - 09.05.2011

ZZ,
One problem, i made NPC on foot (just staying,no moving) and when i want to compile mj FS, got 2 errors and 2 warnings

fs:
Код:
#define FILTERSCRIPT

#include <a_samp>
#include <a_npc>


#define RECORDING "ammu"
#define RECORDING_TYPE 2

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

public OnFilterScriptInit()
{
	ConnectNPC("uAmmu","ammu");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}
errors and warnings:
Код:
C:\Users\Mate\Desktop\Server\pawno\npc.pwn(11) : warning 235: public function lacks forward declaration (symbol "OnRecordingPlaybackEnd")
C:\Users\Mate\Desktop\Server\pawno\npc.pwn(11) : error 017: undefined symbol "StartRecordingPlayback"
C:\Users\Mate\Desktop\Server\pawno\npc.pwn(17) : warning 235: public function lacks forward declaration (symbol "OnNPCSpawn")
C:\Users\Mate\Desktop\Server\pawno\npc.pwn(17) : error 017: undefined symbol "StartRecordingPlayback"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.



Re: [HELP]NPC - Lynn - 09.05.2011

It should be,
#define RECORDING_TYPE 1
If I am not mistaken,
and for the error's, make sure the FS is compiling in a updated version of Pawno.


Re: [HELP]NPC - Fj0rtizFredde - 09.05.2011

You dont use a_samp and a_npc in the same script. It should be two different scripts. This one goes in your "npcmodes" folder:
pawn Код:
#include <a_npc>


#define RECORDING "ammu"
#define RECORDING_TYPE 2

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 then you use a normal FS to connect the NPC or connect it via your GM.


Re: [HELP]NPC - System64 - 09.05.2011

Quote:
Originally Posted by Fj0rtizFredde
Посмотреть сообщение
You dont use a_samp and a_npc in the same script. It should be two different scripts. This one goes in your "npcmodes" folder:
pawn Код:
#include <a_npc>


#define RECORDING "ammu"
#define RECORDING_TYPE 2

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 then you use a normal FS to connect the NPC or connect it via your GM.
thanks now there isn't any problems but one Question: can I use npc in interior?


Re: [HELP]NPC - Fj0rtizFredde - 09.05.2011

Sure you can. Use OnPlayerConnect and check if the player is a NPC then just use SetPlayerPos and SetPlayerInterior.


Re: [HELP]NPC - System64 - 09.05.2011

please I'm noob and I can't put it in my GM and I don't now howw to make him in interior, could you please make me that? I will send you my mod, please?


Re: [HELP]NPC - Lynn - 10.05.2011

Go to weedarr.wikidot.com
Goto, the interiors section,
Find the one you want and do the following.
Under,
pawn Код:
public OnPlayerConnect()
Put
pawn Код:
SetPlayerPos(playerid, X, Y, Z);//X, Y, Z is the cord's found on the website.
SetPlayerInterior(playerid, InteriorID);//Interior ID found on website.
Make sure you define, to only do that, if it's a NPC.