NPC doesn't connect to server? WTF?
#1

Hi there,

I'm having some problems with NPCs. I've followed kc's tutorial but my bots won't connect to my server!

Here take a look at some of my script.

npcmodes script:
Код:
#include <a_npc>
new NPCVAR;
main()
{
	print("NPC: ''airport-cityhall'' - Script Initializing.");
}
public OnNPCModeInit()
{
	print("NPC: ''airport-cityhall'' - Script has been loaded.");
	return 1;
}
public OnNPCModeExit()
{
	print("NPC: ''airport-cityhall'' - Script has been unloaded.");
	return 1;
}
public OnNPCSpawn()
{
  print("NPC: ''airport-cityhall'' - Spawned.");
  SendCommand("/ooc Hello everyone! I'm a bot! Have fun :P");
  return 1;
}
public OnRecordingPlaybackEnd()
{
	if(NPCVAR==0)
	{
	  StopRecordingPlayback();
		StartRecordingPlayback(1, "airport2cityhall");
		NPCVAR++;
		return 1;
	}
	if(NPCVAR==1)
	{
	  StopRecordingPlayback();
		StartRecordingPlayback(1,"cityhall2airport");
		NPCVAR--;
		return 1;
	}
	return 1;
}
public OnNPCEnterVehicle(vehicleid, seatid)
{
	StopRecordingPlayback();
	StartRecordingPlayback(1, "cityhall2airport");
	return 1;
}
parts involving NPCs in my Gamemode:
Код:
// this is under #include a_samp
new npc1car;
#define npc1name "Paul_Ference"
Код:
// this part is in OnGameModeInit
ConnectNPC(npc1name,"airport-cityhall");
npc1car=CreateVehicleEx(420,-2196.8511,965.4650,79.7805,269.1402,6,1,1800,npc1name,0); // Taxi
// function of my custom vehicle system. last two parameters are: ownername and price
Код:
// part of OnPlayerSpawn
  if(IsPlayerNPC(playerid))
  {
    new npcname[24];
    GetPlayerName(playerid, npcname, 24); 
    if(!strcmp(npcname, npc1name, true))
    {
      SetPlayerPos(playerid,-2196.8511,965.4650,79.7805);
      PutPlayerInVehicle(playerid, npc1car, 0); //Putting the NPC into the vehicle we created for it.
    }
    return 1;
  }
So this is the code involving NPCs I wrote. When I open my server, it freezes when ConnectNPC is called and it unfreezes few seconds later, and the GM finishes loading, without any NPC connecting.

Please, help mehhhh!!!

TANHKS!! lol
Reply
#2

pawn Код:
ConnectNPC("NPCNAME","NPCMODENAME");
should fix it

pawn Код:
#define npc1name "Paul_Ference"
take that out its useless

pawn Код:
if(!IsPlayerNPC(playerid)) return 0; // We only deal with NPC players in this script

    new playername[64];
    GetPlayerName(playerid,playername,64);

    if(!strcmp(playername,"NPCNAME",true)) {
    PutPlayerInVehicle(playerid, npc1car, 0);
    SetSpawnInfo( playerid, 0, 255, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 ); //random position doesnt matter
    }
use in OnPlayerSpawn

pawn Код:
SendCommand("/ooc Hello everyone! I'm a bot! Have fun :P");
unless you have a command called /ooc Hello everyone! I'm a bot! Have fun :P this is useless.

cut your npcmode down all that stuff is useless
pawn Код:
#define RECORDING "RECORDINGNAME" //WITHOUT EXTENSION
#define RECORDING_TYPE 1 //1 for in vehicle and 2 for on foot.

#include <a_npc>
main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
public OnNPCExitVehicle() StopRecordingPlayback();
Reply
#3

Tried what you said but it still doesn't work....

plz help, someone
Reply
#4

well you've done it wrong then. look at my sig i dont think i would be wrong.
Reply
#5

do you have maxnpc [your amount of NPCs] defines in server.cfg?
Reply
#6

Quote:
Originally Posted by Tashla
do you have maxnpc [your amount of NPCs] defines in server.cfg?
Yep I just updated to RC5-1, doesn't fix it...

Quote:
Originally Posted by V1ceC1ty
well you've done it wrong then. look at my sig i dont think i would be wrong.
Gonna check your scripts.
Reply
#7

Quote:
Originally Posted by X Cutter
Quote:
Originally Posted by Tashla
do you have maxnpc [your amount of NPCs] defines in server.cfg?
Yep I just updated to RC5-1, doesn't fix it...

Quote:
Originally Posted by V1ceC1ty
well you've done it wrong then. look at my sig i dont think i would be wrong.
Gonna check your scripts.
Now I'm getting seriously pissed off. WHY THE FUCK MY NPCS DOESN'T CONNECT TO MY FUCKING SERVER, I HAVE NO PASSWORD, EVERYTHING IS FUCKING OKAY, I REDONE EVERYTHING, WTF.

Gonna try some more things, gonna edit/post here the results...

EDIT:



YAYAYYYYAAYAYAYAAYAYAYAAYAAYAYAYAAAYAYAYAYAYAYAYYY AYAYYAAYAYAAAAAYAAY!!!!!!!
I change my records name and the npcmodes name to remove the "-" and the "_" and it works !!! YAY!

HAPINESSSSSSS FTW
Reply
#8

Quote:
Originally Posted by X Cutter
Tried what you said but it still doesn't work....
you lied then
Reply
#9

Quote:
Originally Posted by V1ceC1ty
Quote:
Originally Posted by X Cutter
Tried what you said but it still doesn't work....
you lied then
NAO!!! I think the problem was with the names of the npcmodes... when I removed the "-" and "_" (without quotes) from the names of the files it worked....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)