Apache License 2.0

项目介绍

ziggi/FCNPC 是一个托管在 GitHub 上的开源项目,主要使用 C++ 编写,采用 Apache License 2.0 许可证,目前获得 151 个 Star、37 次 Fork。

仓库全名
ziggi/FCNPC
开源许可证
Apache License 2.0
Star 数
151
Fork 数
37
未关闭 Issue
35

README 摘要

FCNPC - Fully Controllable NPC ============================== Fully Controllable NPC (FCNPC) is a plugin for SA-MP servers which adds a lot of capabilities to the existing standard NPCs. The latest version can be found in the releases section. This is a fork of the original repository by OrMisicL. If you encounter a bug or a crash, create an issue in the issues section with your crashlog and your Pawn script. For…

完整内容见 GitHub 原始 README 或本页 。

常见问题

FCNPC 用什么语言开发?

主要使用 C++ 编写,采用 Apache License 2.0 许可证,目前有 151 个 Star。

FCNPC 可以免费商用吗?

仓库采用 Apache License 2.0 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 FCNPC 的源码?

可以直接克隆仓库:git clone https://github.com/ziggi/FCNPC.git,默认分支为 master;安装与运行步骤见仓库 README。

FCNPC 最近还在维护吗?

仓库最近一次更新为 2025年7月6日,当前有 35 个未关闭 Issue;Star 数为 151,可作为社区活跃度的参考。

关于

FCNPC - Fully Controllable NPC

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
239
价值分
101
活跃状态
活跃

README

FCNPC - Fully Controllable NPC

GitHub version Build Status Build status

Fully Controllable NPC (FCNPC) is a plugin for SA-MP servers which adds a lot of capabilities to the existing standard NPCs.

The latest version can be found in the releases section.

This is a fork of the original repository by OrMisicL.

If you encounter a bug or a crash, create an issue in the issues section with your crashlog and your Pawn script.

For more elaborate discussions see the forum thread (it was deleted), or the Russian forum thread (archive).

See the wiki for documentation.

Pathfinding

A pathfinding was planned for the 2.0 version of the plugin, but this version was released without this feature.

So at the moment, pathfinding can only be implemented using third-party plugins.

MapAndreas and ColAndreas support

FCNPC supports working with MapAndreas or ColAndreas, for better NPC height positioning. Just add these plugins before FCNPC on the plugins line in the server.cfg file.

Sources

To download the sources, use the following git command:

git clone --recursive https://github.com/ziggi/FCNPC.git

Note the use of the --recursive argument, because this repository contains submodules.

Building

To build the project you can use Visual Studio. To generate the project you can use CMake.
On Windows, execute the following commands:

cd FCNPC
mkdir build
cd build
cmake .. -A Win32

On Linux, execute the following commands:

cd FCNPC
mkdir build
cd build
cmake ..
make

Special thanks

  • SA-MP Team: SA-MP
  • OrMisicL: FCNPC creator
  • Zeex: Subhook library
  • kurta999: YSF plugin
  • Lorenc_, kurta999, Neutralneu, therainycat, Freaksken, karimcambridge: Contributors
  • urShadow, Incognito: Code samples in their plugins
  • Freaksken: Creating and updating the wiki
  • Whole SA-MP community: Testing

Constants

#define FCNPC_INCLUDE_VERSION		The current FCNPC include version.

#define FCNPC_ENTITY_CHECK_NONE		(0)
#define FCNPC_ENTITY_CHECK_PLAYER	(1)
#define FCNPC_ENTITY_CHECK_NPC		(2)
#define FCNPC_ENTITY_CHECK_ACTOR	(4)
#define FCNPC_ENTITY_CHECK_VEHICLE	(8)
#define FCNPC_ENTITY_CHECK_OBJECT	(16)
#define FCNPC_ENTITY_CHECK_POBJECT_ORIG	(32)
#define FCNPC_ENTITY_CHECK_POBJECT_TARG	(64)
#define FCNPC_ENTITY_CHECK_MAP		(128)
#define FCNPC_ENTITY_CHECK_ALL		(255)

#define FCNPC_ENTITY_MODE_AUTO		(-1)
#define FCNPC_ENTITY_MODE_NONE		(0)
#define FCNPC_ENTITY_MODE_COLANDREAS	(1)

#define FCNPC_MOVE_TYPE_AUTO		(-1)
#define FCNPC_MOVE_TYPE_WALK		(0)
#define FCNPC_MOVE_TYPE_RUN		(1)
#define FCNPC_MOVE_TYPE_SPRINT		(2)
#define FCNPC_MOVE_TYPE_DRIVE		(3)

#define FCNPC_MOVE_MODE_AUTO		(-1)
#define FCNPC_MOVE_MODE_NONE		(0)
#define FCNPC_MOVE_MODE_MAPANDREAS	(1)
#define FCNPC_MOVE_MODE_COLANDREAS	(2)

#define FCNPC_MOVE_PATHFINDING_AUTO	(-1)
#define FCNPC_MOVE_PATHFINDING_NONE	(0)
#define FCNPC_MOVE_PATHFINDING_Z	(1)
#define FCNPC_MOVE_PATHFINDING_RAYCAST	(2)

#define FCNPC_MOVE_SPEED_AUTO		(-1.0)
#define FCNPC_MOVE_SPEED_WALK		(0.1552086)
#define FCNPC_MOVE_SPEED_RUN		(0.56444)
#define FCNPC_MOVE_SPEED_SPRINT		(0.926784)

#define FCNPC_MAX_NODES			(64)

#define FCNPC_INVALID_MOVEPATH_ID	(-1)
#define FCNPC_INVALID_RECORD_ID		(-1)

#undef FCNPC_DISABLE_VERSION_CHECK

Callbacks

forward FCNPC_OnInit();
forward FCNPC_OnCreate(npcid);
forward FCNPC_OnDestroy(npcid);
forward FCNPC_OnSpawn(npcid);
forward FCNPC_OnRespawn(npcid);
forward FCNPC_OnDeath(npcid, killerid, reason);
forward FCNPC_OnUpdate(npcid);

forward FCNPC_OnTakeDamage(npcid, issuerid, Float:amount, weaponid, bodypart);
forward FCNPC_OnGiveDamage(npcid, damagedid, Float:amount, weaponid, bodypart);

forward FCNPC_OnReachDestination(npcid);

forward FCNPC_OnWeaponShot(npcid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
forward FCNPC_OnWeaponStateChange(npcid, weapon_state);

forward FCNPC_OnStreamIn(npcid, forplayerid);
forward FCNPC_OnStreamOut(npcid, forplayerid);

forward FCNPC_OnVehicleEntryComplete(npcid, vehicleid, seatid);
forward FCNPC_OnVehicleExitComplete(npcid, vehicleid);
forward FCNPC_OnVehicleTakeDamage(npcid, issuerid, vehicleid, Float:amount, weaponid, Float:fX, Float:fY, Float:fZ);

forward FCNPC_OnFinishPlayback(npcid);

forward FCNPC_OnFinishNode(npcid, nodeid);
forward FCNPC_OnFinishNodePoint(npcid, nodeid, pointid);
forward FCNPC_OnChangeNode(npcid, newnodeid, oldnodeid);

forward FCNPC_OnFinishMovePath(npcid, pathid);
forward FCNPC_OnFinishMovePathPoint(npcid, pathid, pointid);

forward FCNPC_OnChangeHeightPos(npcid, Float:newz, Float:oldz); // disabled by default, see FCNPC_SetMinHeightPosCall

Natives

native FCNPC_GetPluginVersion(version[], const size = sizeof(version));
native FCNPC_SetUpdateRate(rate);
native FCNPC_GetUpdateRate();
native FCNPC_SetTickRate(rate);
native FCNPC_GetTickRate();
native FCNPC_UseMoveMode(mode, bool:use = true);
native bool:FCNPC_IsMoveModeUsed(mode);
native FCNPC_UseMovePathfinding(pathfinding, bool:use = true);
native bool:FCNPC_IsMovePathfindingUsed(pathfinding);
native FCNPC_UseCrashLog(bool:use = true);
native bool:FCNPC_IsCrashLogUsed();

native FCNPC_Create(const name[]);
native FCNPC_Destroy(npcid);
native FCNPC_Spawn(npcid, skinid, Float:x, Float:y, Float:z);
native FCNPC_Respawn(npcid);
native bool:FCNPC_IsSpawned(npcid);
native FCNPC_Kill(npcid);
native bool:FCNPC_IsDead(npcid);
native bool:FCNPC_IsValid(npcid);
native bool:FCNPC_IsStreamedIn(npcid, forplayerid);
native bool:FCNPC_IsStreamedInForAnyone(npcid);
native FCNPC_GetValidArray(npcs[], const size = sizeof(npcs));

native FCNPC_SetPosition(npcid, Float:x, Float:y, Float:z);
native FCNPC_GivePosition(npcid, Float:x, Float:y, Float:z);
native FCNPC_GetPosition(npcid, &Float:x, &Float:y, &Float:z);
native FCNPC_SetAngle(npcid, Float:angle);
native Float:FCNPC_GiveAngle(npcid, Float:angle);
native FCNPC_SetAngleToPos(npcid, Float:x, Float:y);
native FCNPC_SetAngleToPlayer(npcid, playerid);
native Float:FCNPC_GetAngle(npcid);
native FCNPC_SetQuaternion(npcid, Float:w, Float:x, Float:y, Float:z);
native FCNPC_GiveQuaternion(npcid, Float:w, Float:x, Float:y, Float:z);
native FCNPC_GetQuaternion(npcid, &Float:w, &Float:x, &Float:y, &Float:z);
native FCNPC_SetVelocity(npcid, Float:x, Float:y, Float:z, bool:update_pos = false);
native FCNPC_GiveVelocity(npcid, Float:x, Float:y, Float:z, bool:update_pos = false);
native FCNPC_GetVelocity(npcid, &Float:x, &Float:y, &Float:z);
native FCNPC_SetSpeed(npcid, Float:speed);
native Float:FCNPC_GetSpeed(npcid);
native FCNPC_SetInterior(npcid, interiorid);
native FCNPC_GetInterior(npcid);
native FCNPC_SetVirtualWorld(npcid, worldid);
native FCNPC_GetVirtualWorld(npcid);

native FCNPC_SetHealth(npcid, Float:health);
native Float:FCNPC_GiveHealth(npcid, Float:health);
native Float:FCNPC_GetHealth(npcid);
native FCNPC_SetArmour(npcid, Float:armour);
native Float:FCNPC_GiveArmour(npcid, Float:armour);
native Float:FCNPC_GetArmour(npcid);

native FCNPC_SetInvulnerable(npcid, bool:invulnerable = true);
native bool:FCNPC_IsInvulnerable(npcid);

native FCNPC_SetSkin(npcid, skinid);
native FCNPC_GetSkin(npcid);
#if FCNPC_SAMP_03DL
	native FCNPC_GetCustomSkin(npcid);
#endif

native FCNPC_SetWeapon(npcid, weaponid);
native FCNPC_GetWeapon(npcid);
native FCNPC_SetAmmo(npcid, ammo);
native FCNPC_GiveAmmo(npcid, ammo);
native FCNPC_GetAmmo(npcid);
native FCNPC_SetAmmoInClip(npcid, ammo);
native FCNPC_GiveAmmoInClip(npcid, ammo);
native FCNPC_GetAmmoInClip(npcid);
native FCNPC_SetWeaponSkillLevel(npcid, skill, level);
native FCNPC_GiveWeaponSkillLevel(npcid, skill, level);
native FCNPC_GetWeaponSkillLevel(npcid, skill);
native FCNPC_SetWeaponState(npcid, weapon_state);
native FCNPC_GetWeaponState(npcid);

native FCNPC_SetWeaponReloadTime(npcid, weaponid, time);
native FCNPC_GetWeaponReloadTime(npcid, weaponid);
native FCNPC_GetWeaponActualReloadTime(npcid, weaponid);
native FCNPC_SetWeaponShootTime(npcid, weaponid, time);
native FCNPC_GetWeaponShootTime(npcid, weaponid);
native FCNPC_SetWeaponClipSize(npcid, weaponid, size);
native FCNPC_GetWeaponClipSize(npcid, weaponid);
native FCNPC_GetWeaponActualClipSize(npcid, weaponid);
native FCNPC_SetWeaponAccuracy(npcid, weaponid, Float:accuracy);
native Float:FCNPC_GetWeaponAccuracy(npcid, weaponid);
native FCNPC_SetWeaponInfo(npcid, weaponid, reload_time = -1, shoot_time = -1, clip_size = -1, Float:accuracy = 1.0);
native FCNPC_GetWeaponInfo(npcid, weaponid, &reload_time = -1, &shoot_time = -1, &clip_size = -1, &Float:accuracy = 1.0);
native FCNPC_SetWeaponDefaultInfo(weaponid, reload_time = -1, shoot_time = -1, clip_size = -1, Float:accuracy = 1.0);
native FCNPC_GetWeaponDefaultInfo(weaponid, &reload_time = -1, &shoot_time = -1, &clip_size = -1, &Float:accuracy = 1.0);

native FCNPC_SetKeys(npcid, ud_analog, lr_analog, keys);
native FCNPC_GetKeys(npcid, &ud_analog, &lr_analog, &keys);

native FCNPC_SetSpecialAction(npcid, actionid);
native FCNPC_GetSpecialAction(npcid);

native FCNPC_SetAnimation(npcid, animationid, Float:fDelta = 4.1, loop = 0, lockx = 1, locky = 1, freeze = 0, time = 1);
native FCNPC_SetAnimationByName(npcid, const name[], Float:fDelta = 4.1, loop = 0, lockx = 1, locky = 1, freeze = 0, time = 1);
native FCNPC_ResetAnimation(npcid);
native FCNPC_GetAnimation(npcid, &animationid = 0, &Float:fDelta = 4.1, &loop = 0, &lockx = 1, &locky = 1, &freeze = 0, &time = 1);
native FCNPC_ApplyAnimation(npcid, const animlib[], const animname[], Float:fDelta = 4.1, loop = 0, lockx = 1, locky = 1, freeze = 0, time = 1);
native FCNPC_ClearAnimations(npcid);

native FCNPC_SetFightingStyle(npcid, style);
native FCNPC_GetFightingStyle(npcid);

nat

提示:代码过长已自动截断

Vendor Natives

For some reasons FCNPC includes some another plugins. You don’t need to use this plugins separately.

MapAndreas

MapAndreas 1.2.1 included.

ColAndreas

Latest ColAndreas version included.

评论

暂无评论