SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 06/12/2016, 08:46 AM   #971
PrettyDiamond
Big Clucker
 
Join Date: Jun 2015
Location: Germany
Posts: 53
Reputation: 5
Question Re: RNPC - Recordfree NPCs | Control NPCs without recording | DEV

I use this script for testing because i want load zombies on my server. I trying a lot of days, but for me nothing works...

Code:
// ------------- NPC zombie test and example script
// RNPC 0.4 (26.6.2014) - Mauzen

// Use ConnectZombieBots(playerid, amount)
// to create <amount> zombie bots that keep following <playerid>
// They wont attack but can be killed for tests and stuff
// Either initialize MapAndreas properly, or go to line 78
// and change the last 1 in MoveRNPC to a 0
#define FILTERSCRIPT

#include <a_samp>
#include <rnpc>//Credits: Mauzen

new rnpcZombie[MAX_PLAYERS];
new rnpcZTimer[MAX_PLAYERS];

stock ConnectZombieBots(playerid, amount)
{
    new name[24];
    new id;
    // spawn the given amount of NPCs
    while(amount-- > 0)
	{
        format(name, 24, "Zombie_%d", 500-amount);
        id = ConnectRNPC(name);
        // Store their target player
        rnpcZombie[id] = playerid;
    }
}

public OnPlayerSpawn(playerid)
{
	if(IsPlayerNPC(playerid))
    {
		if (rnpcZombie[playerid] > 0)
		{
	        // Enable RNPC damage management
	        RNPC_SetShootable(playerid, 1);
	        RNPC_ToggleVehicleCollisionCheck(playerid, 1);

	        // Random skin for datz fun
	        SetPlayerSkin(playerid, random(299));

	        // Change name to avoid name collisions
	        new name[24];
	        format(name, 24, "Zombie_%d", playerid);
	        SetPlayerName(playerid, name);

	        // Spawn zombie somewhere in area around player
	        new Float:x, Float:y, Float:z;
	        GetPlayerPos(rnpcZombie[playerid], x, y, z);
	        x = x - 30.0 + random(60);
	        y = y - 30.0 + random(60);
	        // Set to position on ground
	        MapAndreas_FindZ_For2DCoord(x, y, z);
	        SetPlayerPos(playerid, x, y, z+0.7);

	        // If it was a respawn, kill the old timer
	        if (rnpcZTimer[playerid] > 0) KillTimer(rnpcZTimer[playerid]);
	        // Make him follow the player
	        rnpcZTimer[playerid] = SetTimerEx("RFollowPlayer", 5000, 1, "i", playerid);
	    }
    }
    #if defined RNPC_OnPlayerSpawn
            return RNPC_OnPlayerSpawn(playerid);
    #else
            return 1;
    #endif
}
#if defined _ALS_OnPlayerSpawn
        #undef OnPlayerSpawn
#else
        #define _ALS_OnPlayerSpawn
#endif
#define OnPlayerSpawn RNPCZ_OnPlayerSpawn
forward RNPCZ_OnPlayerSpawn(playerid);

forward RFollowPlayer(npcid);
public RFollowPlayer(npcid)
{
    if (IsPlayerConnected(rnpcZombie[npcid]))
	{
        new Float:x, Float:y, Float:z;
        GetPlayerPos(rnpcZombie[npcid], x, y, z);
        // Move RNPC to random point in area around target player
        MoveRNPC(npcid, x - 3.0 + random(600) / 100.0, y - 3.0 + random(600) / 100.0, z, RNPC_SPEED_RUN, 1);
    }
}
Anyone can help me with this please?

Plugin Loaded:
Quote:
[10:28:40] Loaded.
[10:28:40] Loading plugin: RNPC.so
[10:28:40] RNPC V0.4.1 by Mauzen (03.12.2014)
But then this:

Code:
[10:30:56] [debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[10:30:56] [debug]  Stack pointer (STK) is 0xB758, heap pointer (HEA) is 0xB71C
[10:30:56] [debug] AMX backtrace:
[10:30:56] [debug] #0 00002ccc in public RNPC_OnPlayerSpawn (0) from zombie.amx
I have 200 NPCs und 300maxplayers in server.cfg

After i searching about:
Code:
Run time error 3: "Stack/heap collision (insufficient stack size)
i remove this from script:

Code:
    #if defined RNPC_OnPlayerSpawn
            return RNPC_OnPlayerSpawn(playerid);
    #else
            return 1;
    #endif
}
#if defined _ALS_OnPlayerSpawn
        #undef OnPlayerSpawn
#else
        #define _ALS_OnPlayerSpawn
#endif

#define OnPlayerSpawn RNPCZ_OnPlayerSpawn
forward RNPCZ_OnPlayerSpawn(playerid);
and put in:
Code:
public OnPlayerSpawn(playerid)
this:

Code:
public OnPlayerSpawn(playerid)
{
	if(IsPlayerNPC(playerid))
    {
but now npcs doesnt join??
__________________

Last edited by PrettyDiamond; 06/12/2016 at 09:17 AM.
PrettyDiamond is offline   Reply With Quote
Old 20/03/2017, 05:56 PM   #972
WildWave
Big Clucker
 
WildWave's Avatar
 
Join Date: May 2014
Posts: 84
Reputation: 13
Default Re: RNPC - Recordfree NPCs | Control NPCs without recording | DEV

When im trying to upload my zombies to windows sever they connected successfully but when im trying to upload the zombies on linux server, they wont go up.

http://pastebin.com/Zhpgzd4u
__________________
My Scripts : (2)

Basic Admin System
SavedSkin System
WildWave is offline   Reply With Quote
Old 02/12/2017, 08:17 AM   #973
Ritzy2K
High-roller
 
Ritzy2K's Avatar
 
Join Date: Jun 2014
Location: India
Posts: 1,547
Reputation: 170
Default Re: RNPC - Recordfree NPCs | Control NPCs without recording | DEV

Uhh using MapAndreas and RNPC didn't worked out like I hoped for :/
__________________

Last edited by Ritzy2K; 02/12/2017 at 11:36 AM.
Ritzy2K is offline   Reply With Quote
Old 04/08/2020, 02:44 PM   #974
Radless
Little Clucker
 
Join Date: Jul 2019
Posts: 46
Reputation: 3
Default Re: RNPC - Recordfree NPCs | Control NPCs without recording | DEV

someone can give download link? please
Radless is offline   Reply With Quote
Old 08/08/2020, 12:43 AM   #975
Mauzen
High-roller
 
Mauzen's Avatar
 
Join Date: Jun 2007
Location: Western Germany
Posts: 4,878
Reputation: 1597
Default Re: RNPC - Recordfree NPCs | Control NPCs without recording | DEV

Fixed my link shortener, download should work again now
Mauzen is offline   Reply With Quote
Old 19/08/2020, 09:49 PM   #976
BigSmokeBB
Little Clucker
 
BigSmokeBB's Avatar
 
Join Date: Aug 2015
Posts: 29
Reputation: 3
Default Re: RNPC - Recordfree NPCs | Control NPCs without recording | DEV

Hello Mauzen, I am using an external fs to connect zombie bots with your plugin, all normal loading does not even throw any type of error, but the bots simply do not connect, it already checks all the lines many times and it seems everything is correct, I do not know that may be causing interference, help me?



BigSmokeBB is offline   Reply With Quote
Old 23/08/2020, 08:11 PM   #977
Mauzen
High-roller
 
Mauzen's Avatar
 
Join Date: Jun 2007
Location: Western Germany
Posts: 4,878
Reputation: 1597
Default Re: RNPC - Recordfree NPCs | Control NPCs without recording | DEV

Common problems are maxnpcs not being set in server.cfg, or the rnpc npcmode script not being compiled and in the npcmodes directory. Maybe its one of that?
Mauzen is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Control NPCs using Paths? Programie Scripting Help 2 16/06/2012 02:49 PM
Help with recording two npcs at once marharth Help Archive 3 13/08/2010 03:14 AM
Recording NPCs animation with new version (0.3b) Hernaner28 Help Archive 0 12/08/2010 01:17 AM
No NPCs regdude Server Support 5 08/07/2010 05:54 PM
[HELP] Npcs armyoftwo Help Archive 3 05/12/2009 08:43 AM


All times are GMT. The time now is 07:40 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.