NPC leaves server after joining
#19

Here is my NPC filterscript:

Code:
#include <a_samp>
#include <dini>

#define COLOR_YELLOW 0xFFFF00AA

new MyFirstNPCVehicle; //Global variable!

forward OnPlayerLogin(playerid,password[]);
forward OnNPCConnect(myplayerid);

public OnFilterScriptInit()
{
  ConnectNPC("Yoko","politie");
  MyFirstNPCVehicle = CreateVehicle(596,1535.7097,-1677.5266,13.1147,359.5821, 0, 1, 5000);
  return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
  SendClientMessage(playerid, COLOR_YELLOW, "Requesting Class");
	return 1;
}

public OnPlayerConnect(playerid)
{
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerLogin(playerid,password[])
{
  return 1;
}

public OnPlayerSpawn(playerid)
{
  if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
  {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
    if(!strcmp(npcname, "Yoko", true)) //Checking if the NPC's name is MyFirstNPC
    {
      print("spawn");
      OnPlayerCommandText(playerid, "/login password");
      PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
      SetPlayerSkin(playerid,280); //Give NPC a skin
    }
    return 1;
  }
  //Other stuff for normal players goes here!
  return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
	return 1;
}

public OnPlayerUpdate(playerid)
{
	return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}

public OnNPCConnect(myplayerid)
{
  printf("I successfully connected the server with ID %i!", myplayerid);
}
And here is my npcmode:

Code:
#define RECORDING "politie" //This is the filename of your recording without the extension.
#define RECORDING_TYPE 1 //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() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
Reply


Messages In This Thread
NPC leaves server after joining - by Ma - 09.02.2010, 10:34
Re: NPC leaves server after joining - by V1ceC1ty - 09.02.2010, 10:35
Re: NPC leaves server after joining - by Ma - 09.02.2010, 10:37
Re: NPC leaves server after joining - by V1ceC1ty - 09.02.2010, 12:02
Re: NPC leaves server after joining - by Ma - 09.02.2010, 12:10
Re: NPC leaves server after joining - by V1ceC1ty - 09.02.2010, 12:36
Re: NPC leaves server after joining - by Ma - 09.02.2010, 13:02
Re: NPC leaves server after joining - by [KMA]DlennartD - 09.02.2010, 13:04
Re: NPC leaves server after joining - by Ma - 09.02.2010, 13:04
Re: NPC leaves server after joining - by (Jeff) - 09.02.2010, 13:07
Re: NPC leaves server after joining - by [KMA]DlennartD - 09.02.2010, 13:17
Re: NPC leaves server after joining - by Ma - 09.02.2010, 13:23
Re: NPC leaves server after joining - by Calgon - 09.02.2010, 13:37
Re: NPC leaves server after joining - by V1ceC1ty - 09.02.2010, 13:39
Re: NPC leaves server after joining - by Ma - 09.02.2010, 14:02
Re: NPC leaves server after joining - by [KMA]DlennartD - 10.02.2010, 06:39
Re: NPC leaves server after joining - by V1ceC1ty - 10.02.2010, 06:53
Re: NPC leaves server after joining - by [KMA]DlennartD - 10.02.2010, 07:21
Re: NPC leaves server after joining - by Ma - 10.02.2010, 07:26
Re: NPC leaves server after joining - by WThieves - 10.02.2010, 17:48
Re: NPC leaves server after joining - by Ricop522 - 11.02.2010, 16:55
Re: NPC leaves server after joining - by WThieves - 11.02.2010, 17:57
Re: NPC leaves server after joining - by Ricop522 - 12.02.2010, 00:01
Re: NPC leaves server after joining - by Sew_Sumi - 12.02.2010, 07:17
Re: NPC leaves server after joining - by WThieves - 12.02.2010, 13:47
Re: NPC leaves server after joining - by Ricop522 - 12.02.2010, 13:50
Re: NPC leaves server after joining - by V1ceC1ty - 12.02.2010, 14:06
Re: NPC leaves server after joining - by Ricop522 - 12.02.2010, 14:52
Re: NPC leaves server after joining - by V1ceC1ty - 12.02.2010, 15:27
Re: NPC leaves server after joining - by Ricop522 - 12.02.2010, 15:50
Re: NPC leaves server after joining - by Ricop522 - 12.02.2010, 17:35
Re: NPC leaves server after joining - by WThieves - 12.02.2010, 18:04
Re: NPC leaves server after joining - by Ricop522 - 12.02.2010, 20:39
Re: NPC leaves server after joining - by Ricop522 - 13.02.2010, 17:05
Re: NPC leaves server after joining - by Sew_Sumi - 13.02.2010, 20:51
Re: NPC leaves server after joining - by Ma - 13.02.2010, 23:01
Re: NPC leaves server after joining - by Ricop522 - 13.02.2010, 23:11
Re: NPC leaves server after joining - by Ma - 15.02.2010, 14:41
Re: NPC leaves server after joining - by Sew_Sumi - 16.02.2010, 21:08
Re: NPC leaves server after joining - by Ma - 17.02.2010, 06:13
Re: NPC leaves server after joining - by Sew_Sumi - 17.02.2010, 21:07
Re: NPC leaves server after joining - by Ma - 18.02.2010, 09:07
Re: NPC leaves server after joining - by Ricop522 - 18.02.2010, 21:20
Re: NPC leaves server after joining - by Sew_Sumi - 24.02.2010, 03:47
Re: NPC leaves server after joining - by [KMA]DlennartD - 24.02.2010, 07:04
Re: NPC leaves server after joining - by Sew_Sumi - 24.02.2010, 13:47
Re: NPC leaves server after joining - by [KMA]DlennartD - 24.02.2010, 13:52
Re: NPC leaves server after joining - by Sew_Sumi - 24.02.2010, 14:56

Forum Jump:


Users browsing this thread: 10 Guest(s)