NPC connect
#1

I want to connect a NPC and put it stay on one point.
I've read "[Tutorial] Creating a new NPC" by kc and still don't know where is the problem.
I hope you will find it.


The NPC can't connect.( Incoming connection: 127.0.0.1:55033, but nothing else)
From gamemode:
Код:
public OnGameModeInit()
{
       //...
       ConnectNPC("[NPC]Policeman","Policeman");
	   return 1;
}
public OnPlayerConnect(playerid)
{
    if (IsPlayerNPC(playerid))
    {
		GetPlayerName(playerid,gPlayerAccountName[playerid],MAX_PLAYER_NAME);
		if(!strcmp(gPlayerAccountName[playerid],"Policeman"))
		{
		    SetPlayerPos(playerid,251.2565,67.6969,1003.6406);
		    SetPlayerFacingAngle(playerid,89.3009);
		    SetPlayerInterior(playerid,6);
		    SetPlayerVirtualWorld(playerid,0);
		}
		return 1;
    }
    //...
}
NPC script which is in .../npcmodes
Код:
#define RECORDING "Policeman"
#define RECORDING_TYPE 2

#include <a_npc>

main(){}
public OnNPCModeInit()
{
    printf("NPC script loaded");
    return 1;
}
public OnNPCModeExit()
{
    print("NPC script unloaded");
    return 1;
}
public OnNPCConnect(myplayerid)
{
    printf("I successfully connected the server with ID %i!", myplayerid);
}
public OnNPCDisconnect(reason[])
{
    printf("Bot has been disconnected from the server. %s", reason);
}
public OnNPCSpawn()
{
    StartRecordingPlayback(RECORDING_TYPE, RECORDING);
    printf("NPC spawned");
    return 1;
}
public OnRecordingPlaybackEnd()
{
    StartRecordingPlayback(RECORDING_TYPE, RECORDING);
}
I have the "Policeman.rec" in .../npcmodes/recordings. I think the recording isn't necessary, but after it didn't work i put it just dor safety. recording= staying on one position.
Please help!
Thank you in advance!
Reply
#2

Did you set 'maxnpc' in server.cfg ?
Reply
#3

No I didn't. That solved the problem. Thank you rep+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)