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



NPC help - Abraham2nd - 24.06.2010

how do i make a bot connect to my server when its need register/login? please help


Re: help me... - (SF)Noobanatior - 24.06.2010

if(IsPlayerNPC(playerid)return 1; at the top onconnect


Re: help me... - bigcomfycouch - 24.06.2010

I'm guessing you're using the godfather or an edit of it

in onplayerrequestclass

Код:
if(IsPlayerNPC(playerid)) return SpawnPlayer(playerid);
in onplayerspawn

Код:
if(IsPlayerNPC(playerid)) return SetPlayerSpawn(playerid);



Re: help me... - Abraham2nd - 24.06.2010

Quote:
Originally Posted by big comfy couch
I'm guessing you're using the godfather or an edit of it

in onplayerrequestclass

Код:
if(IsPlayerNPC(playerid)) return SpawnPlayer(playerid);
in onplayerspawn

Код:
if(IsPlayerNPC(playerid)) return SetPlayerSpawn(playerid);
no im using Raven's RP i edited it using help


Re: NPC help - Abraham2nd - 24.06.2010

k Sry for double post,
This is the FS that i DL'ed:
Код:
//NPC Created By JustinB
//Do NOT remove The Line above This




#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

new Super; //Global variable!
public OnFilterScriptInit()
{
  print("Viper Filterscript");
  ConnectNPC("Kriminal","Kriminal");
  Super = CreateVehicle(506, 0.0, 0.0, 5.0, 0.0, 0, 1, 5000);
  return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

#endif

public OnGameModeInit()
{
	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, "Kriminal", true)) //Checking if the NPC's name is MyFirstNPC
    {
      PutPlayerInVehicle(playerid, Super, 0); //Putting the NPC into the vehicle we created for it.
    }
    return 1;
  }
	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;
}
and well when i start server the bot crashes:

Incoming Connection: X.XXX:XXXX
NPC_Kriminal has joined.
INFO: Kriminal has left the server. (Crashed)