[Include] ARNPC - Advanced Recordfree NPC
#1

Advanced Recordfree NPC (ARNPC) -
Introduction

Hey everybody. Today I'm going to release my ARNPC (Advanced Recordfree NPC). I think this is going to be useful specialy for who is going to use NPC on their servers.
This include has many features and very simple to use. This include is based on Mauzen's RNPC plugin!


Why this?
Since many people (mostly the newbie) has a lot of problems on using the RNPC plugin itself, this include gives you a simple way to manage your NPCs.

How to install?
This include is very simple to install, you just need very basic knowlage of how SA-MP Server package is structured.
  • Copy "a_rnpc.inc & YSI folder" to "pawno\include" directory
  • Copy "rnpc.dll or rnpc.so" to your "plugins" directory
  • Copy "RNPC.amx and RNPC.pwn (optional)" to your "npcmodes" directory
That's all. Now just go to your Gamemode/Filterscript and include the library using
pawn Code:
#include <a_rnpc>
on the top as any other include.



Changelog
Code:
  • 02/02/2013 - 1.0 Beta release
  • 02/02/2013 - 1.0 RC1 release: - Fixed bug when npc moves the guns disappear.
  • 05/02/2013 - 1.0 RC2 release:
    - Fix: SetRNPCHealth and SetRNPCArmour works perfectly
    - Add: SetRNPCSkillLevel function
    - Add: OnRNPCDeath callback
    - Fix: RNPC_StopPlayback is now WORKING!
    NOTE: Re-download RNPC.pwn & RNPC.amx and put them on npcmodes folder if you're running RC1 or less.
  • 14/02/2013 - 1.1 Stable release
    - Add: RNPCFollowPlayer
    - Add: RNPCShotAt / RNPCAimAt
    - Add: SetRNPCVehicleSiren / GetRNPCVehicleSiren
    - Fix: Fixed problem when a NPC connect with a previous ID it starts with the previous record.
    - Fix: Fixed npc angle on spawn point
    - Add: RNPCStopUseWeapon
  • 21/08/2013 - 1.1 R2 Review version
    - Now NPCs can connect even on loop (remember that npcs will connect itself after all them load)
    - Fixed when OnPlayerConnect gets called once on multiple connections
    - Added a simply Virtualworld for NPCs
Functions & Callbacks
pawn Code:
Functions
/*
// core
native CreateRNPC(npcname[])
native DestroyRNPC(npcid)
native IsPlayerRNPC(npcid)
native GetRNPCID(npcid)
native GetRNPCState(npcid)
native GetRNPCName(npcid)
native SetRNPCVirtualWorld(npcid, worldid)
native GetRNPCVirtualWorld(npcid)

// vehicle controls
native PutRNPCInVehicle(npcid, vehicleid, seatid) // not working with 0.2.1 plugin
native RemoveRNPCFromVehicle(npcid) // not working with 0.2.1 plugin
native SetRNPCVehicleSiren(npcid,vstate)
native GetRNPCVehicleSiren(npcid)

// on foot controls
native SetRNPCSkin(npcid, skin)
native SetRNPCPos(npcid, Float:x, Float:y, Float:z)
native GetRNPCPos(npcid, &Float:x, &Float:y, &Float:z)
native MoveRNPC(npcid, Float:x, Float:y, Float:z, Float:speed) // taken from the original rnpc include
native SetRNPCFacingAngle(npcid, Float:angle)
native SetRNPCHealth(npcid, health) // remember the health value must be an integer and not working with 0.3 plugin
native GetRNPCHealth(npcid)
native SetRNPCArmour(npcid, armour) // remember the armour value must be an integer and not working with 0.3 plugin
native GetRNPCArmour(npcid)
native SetRNPCWeapon(npcid, weaponid)
native GetRNPCWeapon(npcid)
native SetRNPCSkillLevel(npcid, skill, level)

// npc actions
native RNPCWalkTo(npcid,Float:X,Float:Y,Float:Z);
native RNPCRunTo(npcid,Float:X,Float:Y,Float:Z);
native RNPCSprintTo(npcid,Float:X,Float:Y,Float:Z);
native RNPCAimAt(npcid,Float:X,Float:Y);
native RNPCShotAt(npcid,Float:X,Float:Y);
native RNPCStopUseWeapon(npcid);
native RNPCDriveTo(npcid,Float:X,Float:Y,Float:Z,Float:speed);
native RNPCFollowPlayer(npcid, targetid, movemode = RNPC_SPEED_SPRINT)

// .rec part
native RNPC_StartPlayback(npcid, rec[])
native RNPC_StopPlayback(npcid)
native RNPC_StartBuildPlayback(npcid, slot=0, vehicleid=0)

*/


Callbacks
forward OnRNPCCreated(npcid);
forward OnRNPCDestroyed(npcid);
forward OnRNPCSpawn(npcid);
forward OnRNPCPlaybackFinished(npcid); // it's usable but already called so DO NOT uncomment this
forward OnRNPCDeath(npcid);
Download
Click here to download 1.1 R2 Package (includes, RNPC Plugin 0.3.1, YSI package)
Click here to watch the gamemode tested with this include - pastebin. (GM edited as with 1.1R2 version

Bugs
PutRNPCInVehicle works only with driver sits.

Notes
  • IF YOU USE A TIMER WITH ANY FUNCTION KILL THEM BEFORE USING A NEW ONE!
  • THIS INCLUDE WAS TESTED ONLY WITH 0.3e and (not R2) and 0.3x SERVER.
  • THIS INCLUDE NEEDS y_hooks.
  • DO NOT USE RNPC PLUGIN BELOW 0.3 VERSION.
  • SOMETIMES THE NPCS MAY NOT BE SYNCED WELL.
  • THE GAMEMODE .pwn FILE REQUIRES EXTRA INCLUDES THAT THE PACKAGE DOESN'T INCLUDE.
  • PLEASE DO NOT REMOVE ANY CREDITS FROM THE INCLUDE.
Sserver Notes
  • Use "RemoveRNPCFromVehicle" if a NPC is in a car, before using another function.
  • When multiple npcs get connected the order of connection may be wrong
  • Since this include and the plugin either have not a damage system whatsoever I can't/ I have not time for a good one. You can take a look HERE.. - Thanks to [uL]Pottus

Credits
Me for the include
Mauzen for his RNPC Plugin and Joe Staff's code based.
****** for y_hooks.
Reply


Messages In This Thread
ARNPC - Advanced Recordfree NPC - by TheArcher - 02.02.2013, 18:31
Re: ARNPC - Advanced Recordfree NPC - by MP2 - 02.02.2013, 18:37
Re: ARNPC - Advanced Recordfree NPC - by T0pAz - 02.02.2013, 18:38
Re: ARNPC - Advanced Recordfree NPC - by tiernantheman - 03.02.2013, 12:48
Re: ARNPC - Advanced Recordfree NPC - by Lordzy - 03.02.2013, 13:09
Re: ARNPC - Advanced Recordfree NPC - by Glad2BeHere - 04.02.2013, 01:17
Re: ARNPC - Advanced Recordfree NPC - by Kitten - 04.02.2013, 01:47
Re: ARNPC - Advanced Recordfree NPC - by DrAke$ - 04.02.2013, 01:54
Re: ARNPC - Advanced Recordfree NPC - by Niko_boy - 04.02.2013, 05:45
Re: ARNPC - Advanced Recordfree NPC - by Lorenc_ - 04.02.2013, 05:50
Re: ARNPC - Advanced Recordfree NPC - by TheArcher - 04.02.2013, 11:30
Re: ARNPC - Advanced Recordfree NPC - by TheArcher - 05.02.2013, 19:11
Re: ARNPC - Advanced Recordfree NPC - by Michael@Belgium - 12.02.2013, 10:04
Re: ARNPC - Advanced Recordfree NPC - by Nanory - 14.02.2013, 12:18
Re: ARNPC - Advanced Recordfree NPC - by Michael@Belgium - 14.02.2013, 15:29
Re: ARNPC - Advanced Recordfree NPC - by TheArcher - 14.02.2013, 15:50
Re: ARNPC - Advanced Recordfree NPC - by TheArcher - 14.02.2013, 19:02
Re: ARNPC - Advanced Recordfree NPC - by xDaidal0S - 15.02.2013, 07:37
Re: ARNPC - Advanced Recordfree NPC - by Michael@Belgium - 15.02.2013, 12:49
Re: ARNPC - Advanced Recordfree NPC - by TheArcher - 15.02.2013, 13:03
Re: ARNPC - Advanced Recordfree NPC - by Michael@Belgium - 17.02.2013, 11:08
Re: ARNPC - Advanced Recordfree NPC - by rbN. - 17.02.2013, 12:07
Re: ARNPC - Advanced Recordfree NPC - by TheArcher - 17.02.2013, 12:15
Respuesta: ARNPC - Advanced Recordfree NPC - by [CRZ]xRicard[O]x. - 23.03.2013, 04:47
Re: ARNPC - Advanced Recordfree NPC - by TheArcher - 23.03.2013, 10:49
Re: ARNPC - Advanced Recordfree NPC - by PaulDinam - 23.03.2013, 12:05
Re: ARNPC - Advanced Recordfree NPC - by TheArcher - 23.03.2013, 12:19
Re: ARNPC - Advanced Recordfree NPC - by PaulDinam - 23.03.2013, 12:21
AW: ARNPC - Advanced Recordfree NPC - by DogZone - 27.03.2013, 14:40
Re: AW: ARNPC - Advanced Recordfree NPC - by TheArcher - 27.03.2013, 18:34
Respuesta: ARNPC - Advanced Recordfree NPC - by ThePhenix - 16.08.2014, 19:44
Re: ARNPC - Advanced Recordfree NPC - by Team_PRO - 16.08.2014, 21:29
Re: Respuesta: ARNPC - Advanced Recordfree NPC - by TheArcher - 17.08.2014, 12:32
Re: ARNPC - Advanced Recordfree NPC - by Dayrion - 17.10.2016, 13:24
Re: ARNPC - Advanced Recordfree NPC - by TheArcher - 25.10.2016, 02:56
Re: ARNPC - Advanced Recordfree NPC - by Primes007 - 21.05.2017, 09:36
Re: ARNPC - Advanced Recordfree NPC - by TheArcher - 31.05.2017, 16:02

Forum Jump:


Users browsing this thread: 1 Guest(s)