NPC not work..
#1

Hello!
I have put plugin and Include RNPC
And added a NPCS,
but when NPCS joining in the server,
server stopped working..
I used FS by "Weponz" Zombie
Reply
#2

in server.cfg file you have maxnpc set above 0?
Reply
#3

Quote:
Originally Posted by Lucky13
Посмотреть сообщение
in server.cfg file you have maxnpc set above 0?
but i connect 10 bots
and in console typed:
BOT has joined the server
and server stopped respond
maxnpc 100
Reply
#4

Are you sure your NPCs are saved on your npcmodes folder? Also if it is done via SAMP's NPC motion capture are you sure the recordings are on your recordings folder also are you sure you have the NPCs' scripts on npcmodes?
Reply
#5

Quote:
Originally Posted by Rufio
Посмотреть сообщение
Are you sure your NPCs are saved on your npcmodes folder? Also if it is done via SAMP's NPC motion capture are you sure the recordings are on your recordings folder also are you sure you have the NPCs' scripts on npcmodes?
Serverlog:
Код:
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[18:52:45] hostname = "SA-MP Server"  (string)
[18:52:45] weburl = "www.sa-mp.com"  (string)
[18:52:45] 
[18:52:45] Server Plugins
[18:52:45] --------------
[18:52:45]  Loading plugin: streamer
[18:52:45] 

*** Streamer Plugin v2.7.8 by Incognito loaded ***

[18:52:45]   Loaded.
[18:52:45]  Loading plugin: sscanf
[18:52:45] 

[18:52:45]  ===============================

[18:52:45]       sscanf plugin loaded.     

[18:52:45]          Version:  2.8.1        

[18:52:45]    © 2012 Alex "******" Cole  

[18:52:45]  ===============================

[18:52:45]   Loaded.
[18:52:45]  Loading plugin: mysql
[18:52:45]  >> plugin.mysql: R39-4 successfully loaded.
[18:52:45]   Loaded.
[18:52:45]  Loading plugin: gmtime
[18:52:45] 

[18:52:45] ______________________________________

[18:52:45]  GMT Time Plugin v0.2.3 loaded
[18:52:45] ______________________________________

[18:52:45]  By: Fro © Copyright <TBG> 2009-2011
[18:52:45] ______________________________________

[18:52:45]   Loaded.
[18:52:45]  Loading plugin: RNPC
[18:52:45] RNPC V0.4.1 by Mauzen (03.12.2014)
[18:52:45]   Loaded.
[18:52:45]  Loading plugin: MapAndreas
[18:52:45]   Loaded.
[18:52:45]  Loading plugin: Whirlpool
[18:52:45]  
[18:52:45]  ==================
[18:52:45]  
[18:52:45]   Whirlpool loaded
[18:52:45]  
[18:52:45]  ==================
[18:52:45]  
[18:52:45]   Loaded.
[18:52:45]  Loaded 7 plugins.

[18:52:45] 
[18:52:45] Ban list
[18:52:45] --------
[18:52:45]  Loaded: samp.ban
[18:52:45] 
[18:52:45] 
[18:52:45] Filterscripts
[18:52:45] ---------------
[18:52:45]   Loading filterscript 'Objects.amx'...
[18:52:45]   Loading filterscript 'Zombie.amx'...
[18:52:46] [connection] 127.0.0.1:57922 requests connection cookie.
[18:52:46] [connection] 127.0.0.1:57923 requests connection cookie.
[18:52:46] [connection] 127.0.0.1:57924 requests connection cookie.
[18:52:46] [connection] 127.0.0.1:57925 requests connection cookie.
[18:52:46] [connection] 127.0.0.1:57926 requests connection cookie.
[18:52:46] [connection] 127.0.0.1:57927 requests connection cookie.
[18:52:46] [connection] 127.0.0.1:57928 requests connection cookie.
[18:52:46] Number of zombies created: 10
[18:52:46]   Loaded 2 filterscripts.

[18:52:46]   RNPC versionchecker: checking for updates...
[18:52:46] 
----------------------------------
[18:52:46]  Blank Gamemode by your name here
[18:52:46] ----------------------------------

[18:52:46] Number of vehicle models: 0
[18:52:46] [connection] 127.0.0.1:57929 requests connection cookie.
[18:52:46] [connection] 127.0.0.1:57930 requests connection cookie.
[18:52:46]   RNPC versionchecker: Connection problem.
[18:52:46] [connection] 127.0.0.1:56111 requests connection cookie.
[18:52:47] [connection] incoming connection: 127.0.0.1:57922 id: 0
[18:52:47] [connection] incoming connection: 127.0.0.1:57923 id: 1
[18:52:47] [npc:join] Zombie[1] has joined the server (0:127.0.0.1)
[18:52:47] [connection] incoming connection: 127.0.0.1:57924 id: 2
[18:52:47] [connection] incoming connection: 127.0.0.1:57925 id: 3
[18:52:47] [connection] incoming connection: 127.0.0.1:57926 id: 4
[18:52:47] [npc:join] Zombie[2] has joined the server (1:127.0.0.1)
[18:52:47] [connection] incoming connection: 127.0.0.1:57927 id: 5
[18:52:47] [npc:join] Zombie[3] has joined the server (2:127.0.0.1)
[18:52:47] [connection] incoming connection: 127.0.0.1:57928 id: 6
[18:52:47] [npc:join] Zombie[4] has joined the server (3:127.0.0.1)
[18:52:47] [npc:join] Zombie[5] has joined the server (4:127.0.0.1)
[18:52:47] [connection] incoming connection: 127.0.0.1:57929 id: 7
[18:52:47] [npc:join] Zombie[6] has joined the server (5:127.0.0.1)
[18:52:47] [connection] incoming connection: 127.0.0.1:57930 id: 8
[18:52:47] [npc:join] Zombie[7] has joined the server (6:127.0.0.1)
[18:52:47] [connection] incoming connection: 127.0.0.1:56111 id: 9
[18:52:48] [npc:join] Zombie[8] has joined the server (7:127.0.0.1)
[18:52:48] [npc:join] Zombie[9] has joined the server (8:127.0.0.1)
[18:52:48] [npc:join] Zombie[10] has joined the server (9:127.0.0.1)
and after this server is crashing ..
Reply
#6

Does the server crash or freeze? Can we see your NPC script for Zombie[10]?
Reply
#7

Quote:
Originally Posted by Yashas
Посмотреть сообщение
Does the server crash or freeze? Can we see your NPC script for Zombie[10]?
Server crashing..Closing totally

Zombie.amx & Zombie.pwn:
Код:
/*
	ZNPC: Zombified Non-Player Characters [v1.0] by Weponz
*/

#include <a_samp>//Credits: SA:MP Team
#include <rnpc>//Credits: Mauzen

#define MAX_ZOMBIES 10//OPTIONAL: Define the max amount of zombies to spawn here. (Default: 50)

#define ZOMBIE_NAME "Zombie[%i]"//OPTIONAL: Define the name of zombies here. (Default: Zombie[%i])
#define ZOMBIE_HEALTH 50//OPTIONAL: Define the full amount of health for zombies here. (Default: 50%)
#define ZOMBIE_SKIN 162//OPTIONAL: Define the skin id for zombies here. (Default: 162)
#define ZOMBIE_COLOR 0xFF0000FF//OPTIONAL: Define the color of zombies here. (Default: Red)
#define ZOMBIE_DETECT 25//OPTIONAL: Define the minimum detect range for zombies here. (Default: 25 Metres)
#define ZOMBIE_DAMAGE 25//OPTIONAL: Define the damage amount for zombies here. (Default: 25%)

forward OnZombieAttack();
forward OnZombieRoam();

forward ResetDetectRange(playerid);

new GetZombieVictimID[MAX_ZOMBIES];

new GetVictimDetectRange[MAX_PLAYERS];
new GetVictimResetTimer[MAX_PLAYERS];
new GetVictimTimerStatus[MAX_PLAYERS];

new Float:ZombieSpawns[2][3] =//REQUIRED: Change [2] to the amount of spawn locations.
{
	{-14.8762,1529.4866,12.7560},//REQUIRED: Add zombie spawn locations here.
	{-15.8964,1508.5994,12.7500}//REQUIRED: Add zombie spawn locations here.
};

stock GetZombieVictim(npcid)
{
	for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
	{
	    if(!IsPlayerNPC(playerid) && IsPlayerConnected(playerid))
	    {
	        new Float:x, Float:y, Float:z;
			GetPlayerPos(npcid, x, y, z);
			if(IsPlayerInRangeOfPoint(playerid, GetVictimDetectRange[playerid], x, y, z) && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && GetPlayerInterior(playerid) == 0 && GetPlayerVirtualWorld(playerid) == 0) return playerid;
	    }
	}
	return INVALID_PLAYER_ID;
}

public OnFilterScriptInit()
{
    RNPC_SetUpdateRate(80);

    MapAndreas_Init(MAP_ANDREAS_MODE_NOBUFFER);

    new count = 0;
    for(new npcid = 0; npcid < MAX_ZOMBIES; npcid++)
	{
	    new name[24];
	    format(name, sizeof(name), ZOMBIE_NAME, npcid + 1);
		ConnectRNPC(name);
		count++;
	}
	printf("Number of zombies created: %i", count);

	SetTimer("OnZombieAttack", 1000, true);
	SetTimer("OnZombieRoam", 10000, true);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	ApplyAnimation(playerid, "BOMBER", "null", 0, 0, 0, 0, 0, 1);
	ApplyAnimation(playerid, "PED", "null", 0, 0, 0, 0, 0, 1);

	if(IsPlayerNPC(playerid))
	{
		new spawn = random(sizeof(ZombieSpawns));
		SetPlayerPos(playerid, ZombieSpawns[spawn][0], ZombieSpawns[spawn][1], ZombieSpawns[spawn][2]);

		SetRNPCHealth(playerid, ZOMBIE_HEALTH);
		SetPlayerSkin(playerid, ZOMBIE_SKIN);
		SetPlayerColor(playerid, ZOMBIE_COLOR);

		RNPC_SetShootable(playerid, 1);
		RNPC_ToggleVehicleCollisionCheck(playerid, 1);

		GetZombieVictimID[playerid] = INVALID_PLAYER_ID;
		return 1;
	}
	else
	{
	    GetVictimDetectRange[playerid] = ZOMBIE_DETECT;
	    GetVictimTimerStatus[playerid] = 0;
	}
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	if(IsPlayerNPC(killerid))
	{
		ApplyAnimation(killerid, "BOMBER", "BOM_Plant", 4.1, 0, 1, 1, 1, 0, 1);
		SetRNPCHealth(killerid, ZOMBIE_HEALTH);
		return SendDeathMessage(killerid, GetZombieVictimID[killerid], reason);
	}
	return 1;
}

public OnRNPCDeath(npcid, killerid, reason)
{
    SendDeathMessage(killerid, npcid, reason);
	ApplyAnimation(npcid, "PED", "BIKE_fall_off", 4.1, 0, 1, 1, 1, 0, 1);
	RespawnRNPC(npcid);
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(!IsPlayerNPC(playerid))
	{
	    if(newkeys & KEY_FIRE)
		{
			if(GetPlayerWeapon(playerid) >= 22 && GetPlayerWeapon(playerid) <= 38)
			{
				GetVictimDetectRange[playerid] = (ZOMBIE_DETECT * 4);
				if(GetVictimTimerStatus[playerid] == 1) { KillTimer(GetVictimResetTimer[playerid]); }
				GetVictimTimerStatus[playerid] = 1;
				GetVictimResetTimer[playerid] = SetTimerEx("ResetDetectRange", 5000, false, "i", playerid);
			}
		}
		else if(newkeys & KEY_SPRINT && GetVictimTimerStatus[playerid] == 0)
		{
		    GetVictimDetectRange[playerid] = (ZOMBIE_DETECT * 2);
			GetVictimTimerStatus[playerid] = 1;
			GetVictimResetTimer[playerid] = SetTimerEx("ResetDetectRange", 5000, false, "i", playerid);
		}
	}
	return 1;
}

public OnPlayerUpdate(playerid)
{
	if(!IsPlayerNPC(playerid))
	{
	    if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DUCK && GetVictimTimerStatus[playerid] == 0)
		{
		    GetVictimDetectRange[playerid] = (ZOMBIE_DETECT / 4);
			GetVictimTimerStatus[playerid] = 1;
			GetVictimResetTimer[playerid] = SetTimerEx("ResetDetectRange", 5000, false, "i", playerid);
		}
	}
	return 1;
}

public OnZombieAttack()
{
	for(new npcid = 0; npcid < MAX_ZOMBIES; npcid++)
	{
	    if(IsPlayerNPC(npcid))
	    {
	        if(GetRNPCHealth(npcid) > 0)
	        {
		        new victim = GetZombieVictim(npcid), Float:x, Float:y, Float:z, Float:health;
				GetPlayerPos(npcid, x, y, z);
		        if(victim != INVALID_PLAYER_ID)
		        {
					if(IsPlayerInRangeOfPoint(victim, GetVictimDetectRange[victim], x, y, z))
					{
					    GetZombieVictimID[npcid] = victim;

					    if(IsPlayerInRangeOfPoint(victim, 1, x, y, z))
						{
							RNPC_CreateBuild(npcid, PLAYER_RECORDING_TYPE_ONFOOT);
							RNPC_AddPause(100);
							RNPC_SetKeys(KEY_FIRE);
							RNPC_AddPause(100);
							RNPC_SetKeys(0);
							RNPC_FinishBuild();
							RNPC_StartBuildPlayback(npcid);

					        GetPlayerHealth(victim, health);
					  		SetPlayerHealth(victim, health - ZOMBIE_DAMAGE);
							continue;
						}
						GetPlayerPos(victim, x, y, z);

						MoveRNPC(npcid, x, y, z, RNPC_SPEED_RUN, 1);
					}
				}
			}
		}
	}
	return 1;
}

public OnZombieRoam()
{
	for(new npcid = 0; npcid < MAX_ZOMBIES; npcid++)
	{
	    if(IsPlayerNPC(npcid))
	    {
	        if(GetRNPCHealth(npcid) > 0)
	        {
		        new victim = GetZombieVictim(npcid), Float:x, Float:y, Float:z;
				GetPlayerPos(npcid, x, y, z);
				if(victim == INVALID_PLAYER_ID)
			  	{
					new pos = random(4);
					if(pos == 0) { x = x + 100.0; }
					else if(pos == 1) { x = x - 100.0; }
					else if(pos == 2) { y = y + 100.0; }
					else if(pos == 3) { y = y - 100.0; }

					GetZombieVictimID[npcid] = INVALID_PLAYER_ID;

					RNPC_SetKeys(0);

					MoveRNPC(npcid, x, y, z, RNPC_SPEED_WALK, 1);
			 	}
			}
		}
	}
	return 1;
}

public ResetDetectRange(playerid)
{
    if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DUCK)
	{
		GetVictimDetectRange[playerid] = (ZOMBIE_DETECT / 4);
		GetVictimTimerStatus[playerid] = 1;
		GetVictimResetTimer[playerid] = SetTimerEx("ResetDetectRange", 5000, false, "i", playerid);
		return 1;
	}

    GetVictimTimerStatus[playerid] = 0;
    GetVictimDetectRange[playerid] = ZOMBIE_DETECT;
	return 1;
}
I use samp-version 0.3.7.
Reply
#8

Install crashdetect plugin and reply back with the crash log (printed in the server console , i.e: server_log.txt).
Reply
#9

Quote:
Originally Posted by Yashas
Посмотреть сообщение
Install crashdetect plugin and reply back with the crash log (printed in the server console , i.e: server_log.txt).
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[19:53:30] hostname = "SA-MP Server"  (string)
[19:53:30] weburl = "www.sa-mp.com"  (string)
[19:53:30] 
[19:53:30] Server Plugins
[19:53:30] --------------
[19:53:30]  Loading plugin: crashdetect
[19:53:30]   CrashDetect v4.15.1 is OK.
[19:53:30]   Loaded.
[19:53:30]  Loading plugin: streamer
[19:53:30] 

*** Streamer Plugin v2.7.8 by Incognito loaded ***

[19:53:30]   Loaded.
[19:53:30]  Loading plugin: sscanf
[19:53:30] 

[19:53:30]  ===============================

[19:53:30]       sscanf plugin loaded.     

[19:53:30]          Version:  2.8.1        

[19:53:30]    © 2012 Alex "******" Cole  

[19:53:30]  ===============================

[19:53:30]   Loaded.
[19:53:30]  Loading plugin: mysql
[19:53:30]  >> plugin.mysql: R39-4 successfully loaded.
[19:53:30]   Loaded.
[19:53:30]  Loading plugin: gmtime
[19:53:30] 

[19:53:30] ______________________________________

[19:53:30]  GMT Time Plugin v0.2.3 loaded
[19:53:30] ______________________________________

[19:53:30]  By: Fro © Copyright <TBG> 2009-2011
[19:53:30] ______________________________________

[19:53:30]   Loaded.
[19:53:30]  Loading plugin: RNPC
[19:53:30] RNPC V0.4.1 by Mauzen (03.12.2014)
[19:53:30]   Loaded.
[19:53:30]  Loading plugin: MapAndreas
[19:53:30]   Loaded.
[19:53:30]  Loaded 7 plugins.

[19:53:30] 
[19:53:30] Ban list
[19:53:30] --------
[19:53:30]  Loaded: samp.ban
[19:53:30] 
[19:53:30] 
[19:53:30] Filterscripts
[19:53:30] ---------------
[19:53:30]   Loading filterscript 'Objects.amx'...
[19:53:30]   Loaded 1 filterscripts.

[19:53:30]   RNPC versionchecker: checking for updates...
[19:53:31] [connection] 127.0.0.1:56048 requests connection cookie.
[19:53:31] [connection] 127.0.0.1:56049 requests connection cookie.
[19:53:31] [connection] 127.0.0.1:56050 requests connection cookie.
[19:53:31] [connection] 127.0.0.1:56051 requests connection cookie.
[19:53:31] [connection] 127.0.0.1:56052 requests connection cookie.
[19:53:31] [connection] 127.0.0.1:56053 requests connection cookie.
[19:53:31] Number of zombies created: 10
[19:53:31] 
----------------------------------
[19:53:31]  Blank Gamemode by your name here
[19:53:31] ----------------------------------

[19:53:31] Number of vehicle models: 0
[19:53:31]   RNPC versionchecker: Connection problem.
[19:53:31] [connection] 127.0.0.1:56054 requests connection cookie.
[19:53:31] [connection] 127.0.0.1:56055 requests connection cookie.
[19:53:31] [connection] 127.0.0.1:56056 requests connection cookie.
[19:53:32] [connection] 127.0.0.1:57206 requests connection cookie.
[19:53:32] [connection] incoming connection: 127.0.0.1:56048 id: 0
[19:53:32] [connection] incoming connection: 127.0.0.1:56049 id: 1
[19:53:32] [connection] incoming connection: 127.0.0.1:56050 id: 2
[19:53:32] [connection] incoming connection: 127.0.0.1:56051 id: 3
[19:53:32] [npc:join] Zombie[1] has joined the server (0:127.0.0.1)
[19:53:32] [connection] incoming connection: 127.0.0.1:56052 id: 4
[19:53:32] [npc:join] Zombie[2] has joined the server (1:127.0.0.1)
[19:53:32] [npc:join] Zombie[3] has joined the server (2:127.0.0.1)
[19:53:32] [npc:join] Zombie[4] has joined the server (3:127.0.0.1)
[19:53:32] [connection] incoming connection: 127.0.0.1:56053 id: 5
[19:53:32] [npc:join] Zombie[5] has joined the server (4:127.0.0.1)
[19:53:32] [connection] incoming connection: 127.0.0.1:56054 id: 6
[19:53:32] [npc:join] Zombie[6] has joined the server (5:127.0.0.1)
[19:53:32] [connection] incoming connection: 127.0.0.1:56055 id: 7
[19:53:32] [connection] incoming connection: 127.0.0.1:56056 id: 8
[19:53:33] [connection] incoming connection: 127.0.0.1:57206 id: 9
[19:53:33] [npc:join] Zombie[7] has joined the server (6:127.0.0.1)
[19:53:33] [npc:join] Zombie[8] has joined the server (7:127.0.0.1)
[19:53:33] [npc:join] Zombie[9] has joined the server (8:127.0.0.1)
[19:53:33] [npc:join] Zombie[10] has joined the server (9:127.0.0.1)
//and server is closing
Reply
#10

I went through your whole script and couldn't find anything wrong. And crashdetect also doesn't report any crash.

Try adding a printf (should have callback name, callback parameters as the string) at the top and at the bottom of every callback and check the server log and find out which callback was being executed before your server crashed. This will help us isolate the problem to a specific callback.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)