SA-MP Forums Archive
NPC Failure. - 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 Failure. (/showthread.php?tid=271044)



NPC Failure. - Brunok - 22.07.2011

Hey all, I've made a NPC Script and i got it recorded and everyting. My first npc worked well (on-foot) the second NPC Was a helicopter in air but it kind of failed.. It leaves the server as soon i join.. Here's my stuff :

Yes, I put maxnpc on 5.



I made a special Filterscript for it, my on-foot npc is in the GM.
Quote:

#include <a_samp>

new PoliceMav;

main(){}


public OnFilterScriptInit()
{
print("Maverick 0.1");
PoliceMav = CreateVehicle(497, 0.0, 0.0, 5.0, 0.0, 2, 2, 5000);
ConnectNPC("Pilot", "npc_maverick");
return 1;
}



public OnPlayerRequestClass(playerid, classid)
{
if(!IsPlayerNPC(playerid))
{

}
return 1;
}

public OnPlayerConnect(playerid)
{
if(!IsPlayerNPC(playerid))
{

}
return 1;
}


public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid))
{
new npc_name[24];
GetPlayerName(playerid,npc_name,sizeof(npc_name));
if(!strcmp(npc_name,"Pilot",true))
{
PutPlayerInVehicle(playerid, PoliceMav, 0);
SetSpawnInfo(playerid, 1, 284, 185.2623,2634.1902,104.4029,93.5125, 31, 1, 0, 0, 0 ,0);
return 1;
}
}
return 1;
}

Script of NPC


Quote:

#define RECORDING "npc_polic"
#define RECORDING_TYPE 1

#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

Error's on compiling : None


AW: NPC Failure. - Meta - 22.07.2011

Did you record it as vehicle npc?


Re: NPC Failure. - Brunok - 22.07.2011

Yes, IG I recorded as vehicle NPC And than fly'ed around, and stopped with /stoprecord


Re: NPC Failure. - DRIFT_HUNTER - 22.07.2011

You checking if player is NOT NPC
pawn Код:
if(IsPlayerNPC(playerid)) return 1;



Re: NPC Failure. - Brunok - 22.07.2011

lemme test