FCNPC Shutting down server
#1

I've been trying to learn more about FCNPC and just started making an edit of this filter script: https://sampforum.blast.hk/showthread.php?tid=637336 .

The problem is that when I start the server and go in-game, after a while or whenever I kill an NPC, the samp-server.exe just closes. No error messages or anything, I even got crashdetect to see if any messages could have popped up. Any clues what might be causing this?

The FCNPC plugin/include is up to date, also MapAndreas. I'm using the 0.3.DL SA-MP version.
Repping anyone that helps!

This is the code I got so far:

Код:
public OnFilterScriptInit()
{

	MapAndreas_Init(MAP_ANDREAS_MODE_FULL);
	FCNPC_InitMapAndreas(MapAndreas_GetAddress());
	
	ServerData[spawned_npcs] = 0;
	SpawningNPCTimer = SetTimer("SpawnNPC", 5000, true);
	
	return 1;
}

forward SpawnNPC();
public SpawnNPC()
{
	new Random = random(sizeof(SpawnLocations));
	new string[MAX_PLAYER_NAME];
	new botid = ServerData[spawned_npcs];
	new targetnpc;
	if(ServerData[spawned_npcs] < MAX_NPCS)
	{
	    format(string,sizeof(string), "NPC_%i", botid + 1);
	    targetnpc = FCNPC_Create(string);
	    FCNPC_Spawn(targetnpc,133,SpawnLocations[Random][0],SpawnLocations[Random][1],SpawnLocations[Random][2]);
	    FCNPC_SetInterior(targetnpc, 0);
	    FCNPC_SetVirtualWorld(targetnpc, 0);
	    FCNPC_SetHealth(targetnpc, 100);
	    FCNPC_SetWeapon(targetnpc, 1);
	    
	    ServerData[spawned_npcs]++;
	}
	else
	{
	    KillTimer(SpawningNPCTimer);
	    printf("Maximum NPCs spawned, totals to: %i", ServerData[spawned_npcs]);
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)