- Notifications
You must be signed in to change notification settings - Fork32
FCNPC - Fully Controllable NPC
License
ziggi/FCNPC
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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 thereleases section.
This is a fork of theoriginal repository byOrMisicL.
If you encounter a bug or a crash, create an issue in theissues section with yourcrashlog and yourPawn script.
For more elaborate discussions see theforum thread(isn't working now, but we hope), or theRussian forum thread.
See thewiki for documentation.
FCNPC supports working withMapAndreas orColAndreas, for better NPC height positioning. Just add these plugins before FCNPC on theplugins
line in theserver.cfg
file.
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.
To build the project you can useVisual Studio. To generate the project you can useCMake.
On Windows, execute the following commands:
cd FCNPCmkdir buildcd buildcmake .. -A Win32
On Linux, execute the following commands:
cd FCNPCmkdir buildcd buildcmake ..make
- 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
#defineFCNPC_INCLUDE_VERSIONThe current FCNPC include version.#defineFCNPC_ENTITY_CHECK_NONE(0)#defineFCNPC_ENTITY_CHECK_PLAYER(1)#defineFCNPC_ENTITY_CHECK_NPC(2)#defineFCNPC_ENTITY_CHECK_ACTOR(4)#defineFCNPC_ENTITY_CHECK_VEHICLE(8)#defineFCNPC_ENTITY_CHECK_OBJECT(16)#defineFCNPC_ENTITY_CHECK_POBJECT_ORIG(32)#defineFCNPC_ENTITY_CHECK_POBJECT_TARG(64)#defineFCNPC_ENTITY_CHECK_MAP(128)#defineFCNPC_ENTITY_CHECK_ALL(255)#defineFCNPC_ENTITY_MODE_AUTO(-1)#defineFCNPC_ENTITY_MODE_NONE(0)#defineFCNPC_ENTITY_MODE_COLANDREAS(1)#defineFCNPC_MOVE_TYPE_AUTO(-1)#defineFCNPC_MOVE_TYPE_WALK(0)#defineFCNPC_MOVE_TYPE_RUN(1)#defineFCNPC_MOVE_TYPE_SPRINT(2)#defineFCNPC_MOVE_TYPE_DRIVE(3)#defineFCNPC_MOVE_MODE_AUTO(-1)#defineFCNPC_MOVE_MODE_NONE(0)#defineFCNPC_MOVE_MODE_MAPANDREAS(1)#defineFCNPC_MOVE_MODE_COLANDREAS(2)#defineFCNPC_MOVE_PATHFINDING_AUTO(-1)#defineFCNPC_MOVE_PATHFINDING_NONE(0)#defineFCNPC_MOVE_PATHFINDING_Z(1)#defineFCNPC_MOVE_PATHFINDING_RAYCAST(2)#defineFCNPC_MOVE_SPEED_AUTO(-1.0)#defineFCNPC_MOVE_SPEED_WALK(0.1552086)#defineFCNPC_MOVE_SPEED_RUN(0.56444)#defineFCNPC_MOVE_SPEED_SPRINT(0.926784)#defineFCNPC_MAX_NODES(64)#defineFCNPC_INVALID_MOVEPATH_ID(-1)#defineFCNPC_INVALID_RECORD_ID(-1)#undefFCNPC_DISABLE_VERSION_CHECK
forwardFCNPC_OnInit();forwardFCNPC_OnCreate(npcid);forwardFCNPC_OnDestroy(npcid);forwardFCNPC_OnSpawn(npcid);forwardFCNPC_OnRespawn(npcid);forwardFCNPC_OnDeath(npcid, killerid, reason);forwardFCNPC_OnUpdate(npcid);forwardFCNPC_OnTakeDamage(npcid, issuerid,Float:amount, weaponid, bodypart);forwardFCNPC_OnGiveDamage(npcid, damagedid,Float:amount, weaponid, bodypart);forwardFCNPC_OnReachDestination(npcid);forwardFCNPC_OnWeaponShot(npcid, weaponid, hittype, hitid,Float:fX,Float:fY,Float:fZ);forwardFCNPC_OnWeaponStateChange(npcid, weapon_state);forwardFCNPC_OnStreamIn(npcid, forplayerid);forwardFCNPC_OnStreamOut(npcid, forplayerid);forwardFCNPC_OnVehicleEntryComplete(npcid, vehicleid, seatid);forwardFCNPC_OnVehicleExitComplete(npcid, vehicleid);forwardFCNPC_OnVehicleTakeDamage(npcid, issuerid, vehicleid,Float:amount, weaponid,Float:fX,Float:fY,Float:fZ);forwardFCNPC_OnFinishPlayback(npcid);forwardFCNPC_OnFinishNode(npcid, nodeid);forwardFCNPC_OnFinishNodePoint(npcid, nodeid, pointid);forwardFCNPC_OnChangeNode(npcid, newnodeid, oldnodeid);forwardFCNPC_OnFinishMovePath(npcid, pathid);forwardFCNPC_OnFinishMovePathPoint(npcid, pathid, pointid);forwardFCNPC_OnChangeHeightPos(npcid,Float:newz,Float:oldz);// disabled by default, see FCNPC_SetMinHeightPosCall
nativeFCNPC_GetPluginVersion(version[],const size=sizeof(version));nativeFCNPC_SetUpdateRate(rate);nativeFCNPC_GetUpdateRate();nativeFCNPC_SetTickRate(rate);nativeFCNPC_GetTickRate();nativeFCNPC_UseMoveMode(mode,bool:use=true);nativebool:FCNPC_IsMoveModeUsed(mode);nativeFCNPC_UseMovePathfinding(pathfinding,bool:use=true);nativebool:FCNPC_IsMovePathfindingUsed(pathfinding);nativeFCNPC_UseCrashLog(bool:use=true);nativebool:FCNPC_IsCrashLogUsed();nativeFCNPC_Create(const name[]);nativeFCNPC_Destroy(npcid);nativeFCNPC_Spawn(npcid, skinid,Float:x,Float:y,Float:z);nativeFCNPC_Respawn(npcid);nativebool:FCNPC_IsSpawned(npcid);nativeFCNPC_Kill(npcid);nativebool:FCNPC_IsDead(npcid);nativebool:FCNPC_IsValid(npcid);nativebool:FCNPC_IsStreamedIn(npcid, forplayerid);nativebool:FCNPC_IsStreamedInForAnyone(npcid);nativeFCNPC_GetValidArray(npcs[],const size=sizeof(npcs));nativeFCNPC_SetPosition(npcid,Float:x,Float:y,Float:z);nativeFCNPC_GivePosition(npcid,Float:x,Float:y,Float:z);nativeFCNPC_GetPosition(npcid,&Float:x,&Float:y,&Float:z);nativeFCNPC_SetAngle(npcid,Float:angle);nativeFloat:FCNPC_GiveAngle(npcid,Float:angle);nativeFCNPC_SetAngleToPos(npcid,Float:x,Float:y);nativeFCNPC_SetAngleToPlayer(npcid, playerid);nativeFloat:FCNPC_GetAngle(npcid);nativeFCNPC_SetQuaternion(npcid,Float:w,Float:x,Float:y,Float:z);nativeFCNPC_GiveQuaternion(npcid,Float:w,Float:x,Float:y,Float:z);nativeFCNPC_GetQuaternion(npcid,&Float:w,&Float:x,&Float:y,&Float:z);nativeFCNPC_SetVelocity(npcid,Float:x,Float:y,Float:z,bool:update_pos=false);nativeFCNPC_GiveVelocity(npcid,Float:x,Float:y,Float:z,bool:update_pos=false);nativeFCNPC_GetVelocity(npcid,&Float:x,&Float:y,&Float:z);nativeFCNPC_SetSpeed(npcid,Float:speed);nativeFloat:FCNPC_GetSpeed(npcid);nativeFCNPC_SetInterior(npcid, interiorid);nativeFCNPC_GetInterior(npcid);nativeFCNPC_SetVirtualWorld(npcid, worldid);nativeFCNPC_GetVirtualWorld(npcid);nativeFCNPC_SetHealth(npcid,Float:health);nativeFloat:FCNPC_GiveHealth(npcid,Float:health);nativeFloat:FCNPC_GetHealth(npcid);nativeFCNPC_SetArmour(npcid,Float:armour);nativeFloat:FCNPC_GiveArmour(npcid,Float:armour);nativeFloat:FCNPC_GetArmour(npcid);nativeFCNPC_SetInvulnerable(npcid,bool:invulnerable=true);nativebool:FCNPC_IsInvulnerable(npcid);nativeFCNPC_SetSkin(npcid, skinid);nativeFCNPC_GetSkin(npcid);#if FCNPC_SAMP_03DLnativeFCNPC_GetCustomSkin(npcid);#endifnativeFCNPC_SetWeapon(npcid, weaponid);nativeFCNPC_GetWeapon(npcid);nativeFCNPC_SetAmmo(npcid, ammo);nativeFCNPC_GiveAmmo(npcid, ammo);nativeFCNPC_GetAmmo(npcid);nativeFCNPC_SetAmmoInClip(npcid, ammo);nativeFCNPC_GiveAmmoInClip(npcid, ammo);nativeFCNPC_GetAmmoInClip(npcid);nativeFCNPC_SetWeaponSkillLevel(npcid, skill, level);nativeFCNPC_GiveWeaponSkillLevel(npcid, skill, level);nativeFCNPC_GetWeaponSkillLevel(npcid, skill);nativeFCNPC_SetWeaponState(npcid, weapon_state);nativeFCNPC_GetWeaponState(npcid);nativeFCNPC_SetWeaponReloadTime(npcid, weaponid, time);nativeFCNPC_GetWeaponReloadTime(npcid, weaponid);nativeFCNPC_GetWeaponActualReloadTime(npcid, weaponid);nativeFCNPC_SetWeaponShootTime(npcid, weaponid, time);nativeFCNPC_GetWeaponShootTime(npcid, weaponid);nativeFCNPC_SetWeaponClipSize(npcid, weaponid, size);nativeFCNPC_GetWeaponClipSize(npcid, weaponid);nativeFCNPC_GetWeaponActualClipSize(npcid, weaponid);nativeFCNPC_SetWeaponAccuracy(npcid, weaponid,Float:accuracy);nativeFloat:FCNPC_GetWeaponAccuracy(npcid, weaponid);nativeFCNPC_SetWeaponInfo(npcid, weaponid, reload_time=-1, shoot_time=-1, clip_size=-1,Float:accuracy=1.0);nativeFCNPC_GetWeaponInfo(npcid, weaponid,&reload_time=-1,&shoot_time=-1,&clip_size=-1,&Float:accuracy=1.0);nativeFCNPC_SetWeaponDefaultInfo(weaponid, reload_time=-1, shoot_time=-1, clip_size=-1,Float:accuracy=1.0);nativeFCNPC_GetWeaponDefaultInfo(weaponid,&reload_time=-1,&shoot_time=-1,&clip_size=-1,&Float:accuracy=1.0);nativeFCNPC_SetKeys(npcid, ud_analog, lr_analog, keys);nativeFCNPC_GetKeys(npcid,&ud_analog,&lr_analog,&keys);nativeFCNPC_SetSpecialAction(npcid, actionid);nativeFCNPC_GetSpecialAction(npcid);nativeFCNPC_SetAnimation(npcid, animationid,Float:fDelta=4.1, loop=0, lockx=1, locky=1, freeze=0, time=1);nativeFCNPC_SetAnimationByName(npcid,const name[],Float:fDelta=4.1, loop=0, lockx=1, locky=1, freeze=0, time=1);nativeFCNPC_ResetAnimation(npcid);nativeFCNPC_GetAnimation(npcid,&animationid=0,&Float:fDelta=4.1,&loop=0,&lockx=1,&locky=1,&freeze=0,&time=1);nativeFCNPC_ApplyAnimation(npcid,const animlib[],const animname[],Float:fDelta=4.1, loop=0, lockx=1, locky=1, freeze=0, time=1);nativeFCNPC_ClearAnimations(npcid);nativeFCNPC_SetFightingStyle(npcid, style);nativeFCNPC_GetFightingStyle(npcid);nativeFCNPC_UseReloading(npcid,bool:use=true);nativebool:FCNPC_IsReloadingUsed(npcid);nativeFCNPC_UseInfiniteAmmo(npcid,bool:use=true);nativebool:FCNPC_IsInfiniteAmmoUsed(npcid);nativeFCNPC_GoTo(npcid,Float:x,Float:y,Float:z, type= FCNPC_MOVE_TYPE_AUTO,Float:speed= FCNPC_MOVE_SPEED_AUTO, mode= FCNPC_MOVE_MODE_AUTO, pathfinding= FCNPC_MOVE_PATHFINDING_AUTO,Float:radius=0.0,bool:set_angle=true,Float:min_distance=0.0, stop_delay=250);nativeFCNPC_GoToPlayer(npcid, playerid, type= FCNPC_MOVE_TYPE_AUTO,Float:speed= FCNPC_MOVE_SPEED_AUTO, mode= FCNPC_MOVE_MODE_AUTO, pathfinding= FCNPC_MOVE_PATHFINDING_AUTO,Float:radius=0.0,bool:set_angle=true,Float:min_distance=0.0,Float:dist_check=1.5, stop_delay=250);nativeFCNPC_Stop(npcid);nativebool:FCNPC_IsMoving(npcid);nativebool:FCNPC_IsMovingAtPlayer(npcid, playerid);nativeFCNPC_GetDestinationPoint(npcid,&Float:x,&Float:y,&Float:z);nativeFCNPC_AimAt(npcid,Float:x,Float:y,Float:z,bool:shoot=false, shoot_delay=-1,bool:set_angle=true,Float:offset_from_x=0.0,Float:offset_from_y=0.0,Float:offset_from_z=0.0, between_check_mode= FCNPC_ENTITY_MODE_AUTO, between_check_flags= FCNPC_ENTITY_CHECK_ALL);nativeFCNPC_AimAtPlayer(npcid, playerid,bool:shoot=false, shoot_delay=-1,bool:set_angle=true,Float:offset_x=0.0,Float:offset_y=0.0,Float:offset_z=0.0,Float:offset_from_x=0.0,Float:offset_from_y=0.0,Float:offset_from_z=0.0, between_check_mode= FCNPC_ENTITY_MODE_AUTO, between_check_flags= FCNPC_ENTITY_CHECK_ALL);nativeFCNPC_StopAim(npcid);nativeFCNPC_MeleeAttack(npcid, delay=-1,bool:fighting_style=false);nativeFCNPC_StopAttack(npcid);nativebool:FCNPC_IsAttacking(npcid);nativebool:FCNPC_IsAiming(npcid);nativebool:FCNPC_IsAimingAtPlayer(npcid, playerid);nativeFCNPC_GetAimingPlayer(npcid);nativebool:FCNPC_IsShooting(npcid);nativebool:FCNPC_IsReloading(npcid);nativeFCNPC_TriggerWeaponShot(npcid, weaponid, hittype, hitid,Float:x,Float:y,Float:z,bool:is_hit=true,Float:offset_from_x=0.0,Float:offset_from_y=0.0,Float:offset_from_z=0.0, between_check_mode= FCNPC_ENTITY_MODE_AUTO, between_check_flags= FCNPC_ENTITY_CHECK_ALL);nativeFCNPC_GetClosestEntityInBetween(npcid,Float:x,Float:y,Float:z,Float:range, between_check_mode= FCNPC_ENTITY_MODE_AUTO, between_check_flags= FCNPC_ENTITY_CHECK_ALL,Float:offset_from_x=0.0,Float:offset_from_y=0.0,Float:offset_from_z=0.0,&entity_id=-1,&entity_type=-1,&object_owner_id= INVALID_PLAYER_ID,&Float:point_x=0.0,&Float:point_y=0.0,&Float:point_z=0.0);nativeFCNPC_EnterVehicle(npcid, vehicleid, seatid, type= FCNPC_MOVE_TYPE_WALK);nativeFCNPC_ExitVehicle(npcid);nativeFCNPC_PutInVehicle(npcid, vehicleid, seatid);nativeFCNPC_RemoveFromVehicle(npcid);nativeFCNPC_GetVehicleID(npcid);nativeFCNPC_GetVehicleSeat(npcid);nativeFCNPC_UseVehicleSiren(npcid,bool:use=true);nativebool:FCNPC_IsVehicleSirenUsed(npcid);nativeFCNPC_SetVehicleHealth(npcid,Float:health);nativeFloat:FCNPC_GetVehicleHealth(npcid);nativeFCNPC_SetVehicleHydraThrusters(npcid, direction);nativeFCNPC_GetVehicleHydraThrusters(npcid);nativeFCNPC_SetVehicleGearState(npcid, gear_state);nativeFCNPC_GetVehicleGearState(npcid);nativeFCNPC_SetVehicleTrainSpeed(npcid,Float:speed);nativeFloat:FCNPC_GetVehicleTrainSpeed(npcid);nativeFCNPC_SetSurfingOffsets(npcid,Float:x,Float:y,Float:z);nativeFCNPC_GiveSurfingOffsets(npcid,Float:x,Float:y,Float:z);nativeFCNPC_GetSurfingOffsets(npcid,&Float:x,&Float:y,&Float:z);nativeFCNPC_SetSurfingVehicle(npcid, vehicleid);nativeFCNPC_GetSurfingVehicle(npcid);nativeFCNPC_SetSurfingObject(npcid, objectid);nativeFCNPC_GetSurfingObject(npcid);nativeFCNPC_SetSurfingPlayerObject(npcid, objectid);nativeFCNPC_GetSurfingPlayerObject(npcid);#ifdefined _streamer_includednativeFCNPC_SetSurfingDynamicObject(npcid, objectid);nativeFCNPC_GetSurfingDynamicObject(npcid);#endifnativeFCNPC_StopSurfing(npcid);nativeFCNPC_StartPlayingPlayback(npcid,const file[]="", recordid= FCNPC_INVALID_RECORD_ID,bool:auto_unload=false,Float:delta_x=0.0,Float:delta_y=0.0,Float:delta_z=0.0,Float:delta_qw=0.0,Float:delta_qx=0.0,Float:delta_qy=0.0,Float:delta_qz=0.0);nativeFCNPC_StopPlayingPlayback(npcid);nativeFCNPC_PausePlayingPlayback(npcid);nativeFCNPC_ResumePlayingPlayback(npcid);nativeFCNPC_LoadPlayingPlayback(const file[]);nativeFCNPC_UnloadPlayingPlayback(recordid);nativeFCNPC_SetPlayingPlaybackPath(npcid,const path[]);nativeFCNPC_GetPlayingPlaybackPath(npcid, path[],const size=sizeof(path));nativeFCNPC_OpenNode(nodeid);nativeFCNPC_CloseNode(nodeid);nativebool:FCNPC_IsNodeOpen(nodeid);nativeFCNPC_GetNodeType(nodeid);nativeFCNPC_SetNodePoint(nodeid, pointid);nativeFCNPC_GetNodePointPosition(nodeid,&Float:x,&Float:y,&Float:z);nativeFCNPC_GetNodePointCount(nodeid);nativeFCNPC_GetNodeInfo(nodeid,&vehnodes,&pednodes,&navinode);nativeFCNPC_PlayNode(npcid, nodeid, type= FCNPC_MOVE_TYPE_AUTO,Float:speed= FCNPC_MOVE_SPEED_AUTO, mode= FCNPC_MOVE_MODE_AUTO,Float:radius=0.0,bool:set_angle=true);nativeFCNPC_StopPlayingNode(npcid);nativeFCNPC_PausePlayingNode(npcid);nativeFCNPC_ResumePlayingNode(npcid);nativebool:FCNPC_IsPlayingNode(npcid);nativebool:FCNPC_IsPlayingNodePaused(npcid);nativeFCNPC_CreateMovePath();nativeFCNPC_DestroyMovePath(pathid);nativebool:FCNPC_IsValidMovePath(pathid);nativeFCNPC_AddPointToMovePath(pathid,Float:x,Float:y,Float:z);nativeFCNPC_AddPointsToMovePath(pathid,Float:points[][3],const size=sizeof(points));nativeFCNPC_AddPointsToMovePath2(pathid,Float:points_x[],Float:points_y[],Float:points_z[],const size=sizeof(points_x));nativeFCNPC_RemovePointFromMovePath(pathid, pointid);nativebool:FCNPC_IsValidMovePathPoint(pathid, pointid);nativeFCNPC_GetMovePathPoint(pathid, pointid,&Float:x,&Float:y,&Float:z);nativeFCNPC_GetNumberMovePathPoint(pathid);nativeFCNPC_GoByMovePath(npcid, pathid, pointid=0, type= FCNPC_MOVE_TYPE_AUTO,Float:speed= FCNPC_MOVE_SPEED_AUTO, mode= FCNPC_MOVE_MODE_AUTO, pathfinding= FCNPC_MOVE_PATHFINDING_AUTO,Float:radius=0.0,bool:set_angle=true,Float:min_distance=0.0);nativeFCNPC_SetMoveMode(npcid, mode);nativeFCNPC_GetMoveMode(npcid);nativeFCNPC_SetMinHeightPosCall(npcid,Float:height);nativeFloat:FCNPC_GetMinHeightPosCall(npcid);nativeFCNPC_ShowInTabListForPlayer(npcid, forplayerid);nativeFCNPC_HideInTabListForPlayer(npcid, forplayerid);
For some reasons FCNPC includes some another plugins. You don't need to use this plugins separately.
MapAndreas 1.2.1 included.
Latest ColAndreas version included.
About
FCNPC - Fully Controllable NPC