SA-MP Forums Archive
Walking NPC Script don't work - 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: Walking NPC Script don't work (/showthread.php?tid=136346)



Walking NPC Script don't work - gangstajoe - 24.03.2010

Hey,

I recorded a npc, that walks around the streets, and it don't work.. Can someone tell me what i did wrong?

NPCscript:
Код:
#define RECORDING "Walk"
#define RECORDING_TYPE 2

#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
Filterscript:
Код:
#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Walking NPC ");
	print("--------------------------------------\n");
	return 1;
}

main()
{
	print("\n----------------------------------");
	print(" Walking NPC");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	ConnectNPC("WalkingNPC","Walk");
}

public OnPlayerSpawn(playerid)
{
  if(IsPlayerNPC(playerid))
  {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
    if(!strcmp(npcname, "WalkingNPC", true))
    {
      if(IsPlayerNPC(playerid)) return 1;
 	  	SetSpawnInfo( playerid, 0, 108, 1958.33, 1343.12, 15.36, 269.15, 31, 1000, 0, 0, 0, 0 );
  	  SetPlayerColor(playerid,0xFFFF00AA);
  	  return 1;
    }
}
	return 1;
}



Re: Walking NPC Script don't work - Geso - 24.03.2010

did you put the npcrecorded file in the correct map?


Re: Walking NPC Script don't work - gangstajoe - 24.03.2010

Yep, the .rec file in npcmodes\recordings, and that NPCscript in npcmodes.


Re: Walking NPC Script don't work - GaGlets(R) - 24.03.2010

Connecting npc.
Put at top
Код:
#define FILTERSCRIPT
And at your registration script or smth like that
at OnPlayerConnect
Код:
IsPlayerNPC(playerid)
{
 //put there some codes like putting player logged in to not force kicking 
 //like : IsPlayerLogged[playerid] = 1; etc.. 
return 1;
}



Re: Walking NPC Script don't work - gangstajoe - 24.03.2010

i figured it out, thanks anyway