[Plugin] FCNPC - Fully Controllable NPC v0.1 Beta 1
FCNPC - Fully Controllable NPC
by OrMisicL
Introduction
Yes, this plugin gives you full control over the server NPCs, it looks like the old CNPC plugin, but its very different from it. Im releasing it because i have seen many people requesting this and hoping to see it
I also took authorization from the SAMP team to release as there is no harm that can be caused by my plugin (it uses a very different way of creating NPCs that dosent allow anyone to change them to fake players)
Features
+50 functions to control all the aspects of the NPC
NPC damage detection
NPC mouvement sync (walk, run, sprint ...)
Vehicle entry and exit sync (not perfect but still good)
Functions
FCNPC_SetUpdateRate
Parameters:
rate: the update rate (in ms) for each NPC(limit bandwidh usage)
Return: None
FCNPC_Create
Parameters:
name: the desired NPC name
Return:
The ID of the created NPC
FCNPC_Destroy
Parameters:
ID: the NPC ID to destroy
Return: None
FCNPC_Spawn
Parameters:
ID: the NPC ID to spawn
skinid: the NPC skin to spawn with
X: the X coord to spawn
Y: the Y coord to spawn
Z: the Z coord to spawn
Return:
1 if the NPC is successfully spawned, 0 if not
FCNPC_Respawn
Parameters:
ID: the NPC ID to respawn
Return:
1 if the NPC is successfully respawned, 0 if not
FCNPC_Kill
Parameters:
ID: the NPC ID to kill
Return: None
FCNPC_IsDead
Parameters:
ID: the NPC ID to check for death
Return:
1 if the NPC is dead, 0 if not
FCNPC_SetPosition
Parameters:
ID: the NPC ID
X: the X coord to set
Y: the Y coord to set
Z: the Z coord to set
Return: None
FCNPC_GetPosition
Parameters:
ID: the NPC ID
X: the X coord to get
Y: the Y coord to get
Z: the Z coord to get
Return: None
FCNPC_SetAngle
Parameters:
ID: the NPC ID
A: the angle value to set
Return: None
FCNPC_GetAngle
Parameters:
ID: the NPC ID
Return:
The angle value
FCNPC_SetVelocity
Parameters:
ID: the NPC ID
X: the X coord to set
Y: the Y coord to set
Z: the Z coord to set
Return: None
FCNPC_GetVelocity
Parameters:
ID: the NPC ID
X: the X coord to get
Y: the Y coord to get
Z: the Z coord to get
Return: None
FCNPC_SetQuaternion
Parameters:
ID: the NPC ID
X: the X coord to set
Y: the Y coord to set
Z: the Z coord to set
A: the angle to set
Return: None
FCNPC_GetQuaternion
Parameters:
ID: the NPC ID
X: the X coord to get
Y: the Y coord to get
Z: the Z coord to get
A: the quaternion angle to get
Return: None
FCNPC_SetInterior
Parameters:
ID: the NPC ID
interior: the interior value to set
Return: None
FCNPC_GetInterior
Parameters:
ID: the NPC ID
Return:
The interior ID
FCNPC_SetHealth
Parameters:
ID: the NPC ID
health: the health value to set
Return: None
FCNPC_GetHealth
Parameters:
ID: the NPC ID
Return:
The NPC health
FCNPC_SetArmour
Parameters:
ID: the NPC ID
armour: the armour value to set
Return: None
FCNPC_GetArmour
Parameters:
ID: the NPC ID
Return:
The NPC armour value
FCNPC_SetSkin
Parameters:
ID: the NPC ID
skinid: the skin ID to set
Return: None
Note: This will respawn the NPC in order for the changes to take effect
FCNPC_GetSkin
Parameters:
ID: the NPC ID
Return:
The NPC skin ID
FCNPC_SetSpecialAction
Parameters:
ID: the NPC ID
actionid: the action id to perform
Return: None
FCNPC_GetSpecialAction
Parameters:
ID: the NPC ID
Return:
The special action ID
FCNPC_SetWeapon
Parameters:
ID: the NPC ID
weaponid: the weapon ID to give
Return: None
FCNPC_GetWeapon
Parameters:
ID: the NPC ID
Return:
The NPC weapon ID
FCNPC_SetAmmo
Parameters:
ID: the NPC ID
ammo: the ammo to give
Return: None
FCNPC_GetAmmo
Parameters:
ID: the NPC ID
Return:
The NPC ammo value
FCNPC_SetWeaponSkillLevel
Parameters:
ID: the NPC ID
weapontype: the weapon typeto set its skill
level: the skill level
Return: None
FCNPC_SetKeys
Parameters:
ID: the NPC ID
keys: the keys to set for the player (No analogs)
Return: None
FCNPC_GetKeys
Parameters:
ID: the NPC ID
UDAnalog: the up/down analog value
LRAnalog: the left/right analog value
keys: the NPC keys
Return: None
FCNPC_GoTo
Parameters:
ID: the NPC ID
X: the X coordinate to go to
Y: the Y coordinate to go to
Z: the Z coordinate to go to
type: mouvement type
MOVE_TYPE_WALK: Walk the NPC
MOVE_TYPE_RUN: Run the NPC
MOVE_TYPE_SPRINT: Sprint the NPC
MOVE_TYPE_DRIVE: Drive the NPC (only in car)
UseZMap: Flag to indicate the ZMap usage
Return: None
FCNPC_Stop
Parameters:
ID: the NPC ID
Return: None
FCNPC_IsMoving
Parameters:
ID: the NPC ID
Return:
1 if moving, 0 if not
FCNPC_AimAt
Parameters:
ID: the NPC ID
X: the X coordinate to aim at
Y: the Y coordinate to aim at
Z: the Z coordinate to aim at
shoot: 1 to make the NPC shoot, 0 to aim only
Return: None
FCNPC_StopAim
Parameters:
ID: the NPC ID
Return: None
FCNPC_MeleeAttack
Parameters:
ID: the NPC ID
delay: the delay (in ms) between each melee attack
Return: None
FCNPC_StopMelee
Parameters:
ID: the NPC ID
Return: None
FCNPC_IsAiming
Parameters:
ID: the NPC ID
Return:
1 if aiming, 0 if not
FCNPC_IsShooting
Parameters:
ID: the NPC ID
Return:
1 if shooting, 0 if not
FCNPC_IsReloading
Parameters:
ID: the NPC ID
Return:
1 if reloading, 0 if not
FCNPC_EnterVehicle
Parameters:
ID: the NPC ID
vehicleid: the vehicle ID to enter
seat: the NPC seat in vehicle
Return:
1 if sucessfully entering, 0 if not
Note: This will make the NPC go to the vehicle and TRY to perform the enter vehicle animation, you may notice that sometimes the NPC enters the vehicle even before doing the animation (because we dont have each vehicle door coordinates)
FCNPC_ExitVehicle
Parameters:
ID: the NPC ID
Return:
1 if sucessfully exiting, 0 if not
Note: This will perform the exit vehicle animation and wait for some time before the NPC state will be onfoot, and you may notice that the NPC changes position after exiting vehicle (because we dont have each vehicle door coordinates)
FCNPC_PutInVehicle
Parameters:
ID: the NPC ID
vehicleid: the vehicle ID to enter
seat: the NPC seat in vehicle
Return:
1 if sucessfully put in vehicle, 0 if not
FCNPC_RemoveFromVehicle
Parameters:
ID: the NPC ID
Return:
1 if sucessfully removed from the vehicle, 0 if not
FCNPC_GetVehicleID
Parameters:
ID: the NPC ID
Return:
Returns the vehicle ID if he has any or INVALID_VEHICLE_ID if he's not in any vehicle
FCNPC_GetVehicleSeat
Parameters:
ID: the NPC ID
Return:
Returns the seat ID if he has any or ( 128 ) if he's not in any vehicle
FCNPC_StartRecordingPlayback
Parameters:
ID: the NPC ID
File: the recorded file name (should be located in "npcmodes/recordings/")
Return:
Returns 1 if the recording has successfully started, 0 otherwise
FCNPC_StopRecordingPlayback
Parameters:
ID: the NPC ID
Return:
Returns 1 if the recording has successfully stopped, 0 otherwise
FCNPC_PauseRecordingPlayback
Parameters:
ID: the NPC ID
Return: None
FCNPC_ResumeRecordingPlayback
Parameters:
ID: the NPC ID
Return: None
FCNPC_OpenNode
Parameters:
ID: the node ID
Return: 1 if the node is successfully opened, 0 otherwise
FCNPC_CloseNode
Parameters:
ID: the node ID
Return: None
FCNPC_IsNodeOpen
Parameters:
ID: the node ID
Return: 1 is the node is already open, 0 otherwise
FCNPC_SetNodePoint
Parameters:
ID: the node ID
point: the node point value to set
Return: None
FCNPC_GetNodePointPosition
Parameters:
ID: the node ID
X: the node X position to get (pointer)
Y: the node Y position to get (pointer)
Z: the node Z position to get (pointer)
Return: None
FCNPC_GetNodePointCount
Parameters:
ID: the node ID
Return: the total points in the node
FCNPC_GetNodeInfo
Parameters:
ID: the node ID
vehnodes: the total vehicle nodes in the node (pointer)
pednodes: the total ped nodes in the node (pointer)
navinodes: the total navinodes in the node (pointer)
Return: None
FCNPC_PlayNode
Parameters:
npcid: the NPC ID
nodeid: the node ID to play
type: the node type
types are:
NODE_TYPE_PED: Ped node
NODE_TYPE_VEHICLE: Vehicle node
NODE_TYPE_BOAT: Boatnode
Return: None
FCNPC_StopPlayingNode
Parameters:
ID: the NPC ID
Return: None
Callbacks
FCNPC_OnCreate
Description: gets called when the NPC is created
Parameters:
npcid: the NPC ID
Return: None
FCNPC_OnSpawn
Description: gets called when the NPC is spawned
Parameters:
npcid: the NPC ID that spawned
Return: None
FCNPC_OnRespawn
Description: gets called when the NPC is respawned
Parameters:
npcid: the NPC ID that spawned
Return: None
FCNPC_OnDeath
Description: gets called when the NPC is dead
Parameters:
npcid: the NPC ID that died
killerid: the player ID that killed the NPC ( INVALID_PLAYER_ID if the NPC has died )
weaponid: the weapon id in which the NPC was killed with
Return: None
FCNPC_OnReachDestination
Description: gets called when the NPC has reached his destination (FCNPC_GoTo)
Parameters:
npcid: the NPC ID
Return: None
FCNPC_OnVehicleEntryComplete
Description: gets called when the NPC has completed his vehicle entry (FCNPC_EnterVehicle)
Parameters:
npcid: the NPC ID
vehicleid: the vehicle ID
seat: the seat ID
Return: None
FCNPC_OnVehicleExitComplete
Description: gets called when the NPC has completed his vehicle exit(FCNPC_ExitVehicle)
Parameters:
npcid: the NPC ID
Return: None
FCNPC_OnTakeDamage
Description: gets called when the NPC got damaged
Parameters:
npcid: the NPC ID that died
damagerid: the player ID that damagedthe NPC
weaponid: the weapon id in which the NPC was damaged with
Return: None
FCNPC_OnFinishPlayback
Description: gets called when the NPC has completed playing a playback (.rec file)
Parameters:
npcid: the NPC ID
Return: None
FCNPC_OnFinishNode
Description: gets called when the NPC has completed playing a node
Parameters:
npcid: the NPC ID
Return: None
FCNPC_OnFinishNodePoint
Description: gets called when the NPC has completed playing a node point
Parameters:
npcid: the NPC ID
point: the finished point
Return: 1 to continue playing the node, 0 to stop
Installation
Put "FCNPC.dll" or "FCNPC.so" in your "plugins" folder
Put "FCNPC.inc" in your include "pawno/includes" folder
Put "FCNPC" folder in your "scriptfiles" folder
Add "FCNPC" to the plugins list in "server.cfg"
Requirements
Latest version of the SAMP server (0.3x R1-2)
Download
https://code.google.com/p/fcnpc/
Google Code
Compiled files (aswell as include and sample file) are included in the "Download" tab in google code
Notes
This is a beta release and may contain bugs and crashes, please report any bugs/crashes that you find
I took authorization from the SAMP team to release this plugin so dont ask about that
The plugin is a memory hacking plugin which means it should be updated with every server update, but i'll try to keep it always up to date and working with the latest version of the SAMP server
This plugin is different from the old CNPC plugin and dosent have any relation with it (only the idea maybe?) as its coded entirely by me only and from scratch
Dont ask to provide mirrors for this plugin, the only downloading sources are listed above in the "Download" section
Changelog
Plugin updated:
Beta 9:
Fixed damage detection (very accurate as it uses "OnPlayerGiveDamage" callback hook)
Fixed vehicle flips over when an NPC enters it
Added support for NPC jacking players vehicle
Fixed melee attack delay
Beta 8 R2:
Fixed the creation method (cleaner and more efficient method that removed all the dirty hooks and patches)
Hopefully fixed linux crashes
Fixed weapons damage values
Added checks for maxplayers and maxnpc values
Beta 8:
Fixed damage detection (accurate damage detection with bodypart and weapon damage value)
Added linux version (can be found in the download package)
Added melee attack support (FCNPC_MeleeAttack and FCNPC_StopAttack)
Fixed other minor bugs
Beta 7:
Added full support for the GTA SA nodes (see citiziens.pwn for more infos)
Fixed the player mouvement
Fixed the driving (now works very smooth)
Fixed setting or getting player stats in vehicle (position, velocity ...)
Beta 6:
NPCs now uses normal IDs (playerid), no more custom IDs
Added MOVE_TYPE_DRIVE now NPCs are able to drive
Fixed vehicle sets on fire when NPC enters as a driver
Fixed small bug related to NPC creation and added some checking for creation fail
Fixed wrong vehicle ID when entering vehicle
Beta 5 R3:
Fixed creation method (fixed crashes related to it)
Beta 5 R2:
Fixed crash when creating NPC
Fixed high CPU usage
Beta 5:
Changed the NPC creation method (no more samp-npc.exe needed) all the crashing bugs and problems related to NPC creation are fixed
Added temporary solution for damage detection (only players can shoot NPCs)
Fixed aiming Z angle (now NPCs are able to hit the target when shooting)
Added FCNPC_GetNPCID to get the NPC ID from the player id
Improved the vehicle entry (now animation gets applied properly)
Beta 4:
Fixed NPCs starting from (maxplayers in config.cfg) instead of 500
Fixed crash when having alot of NPCs (now u can create as much as you want without crashing)
Added FCNPC_GetPlayerID (to return the player real ID)
Added the possibility to disable ZMap usage when moving
Beta 3:
Fixed or limited the bandwidh usage for each NPC (can be controlled through FCNPC_SetUpdateRate)
Fixed vehicle entry and exit animations (kinda perfect now)
Added FCNPC_SetPlayerWeaponSkill
Fixed NPC mouvement sprinting speed and reaching destination
Added ZMap for NPC mouvement (no more flying while moving)
Beta 2:
Fixed crash when creating NPC
Fixed NPCs start from slot 500
Fixed vehicle sets on fire when NPC enters it
Fixed wrong parameters passed to callbacks such as (FCNPC_Spawn and FCNPC_Create ...) (Caused many problems)
Fixed vehicle id in FCNPC_EnterVehicle
Beta 1 R2:
Fixed port issue
Bugs
Damage detection is not that perfect
Credits
SA-MP Team: SAMP
OrMisicL: Developer
kurta999: Linux testing
iJumbo: Linux testing
__________________
[Plugin] FCNPC - Fully Controllable NPC
FCNPC - Fully Controllable NPC
by OrMisicL
Introduction
Yes, this plugin gives you full control over the server NPCs, it looks like the old CNPC plugin, but its very different from it. Im releasing it because i have seen many people requesting this and hoping to see it
I also took authorization from the SAMP team to release as there is no harm that can be caused by my plugin (it uses a very different way of creating NPCs that dosent allow anyone to change them to fake players)
Features
+50 functions to control all the aspects of the NPC
NPC damage detection
NPC mouvement sync (walk, run, sprint ...)
Vehicle entry and exit sync (not perfect but still good)
Functions
FCNPC_SetUpdateRate
Parameters:
rate: the update rate (in ms) for each NPC(limit bandwidh usage)
Return: None
FCNPC_Create
Parameters:
name: the desired NPC name
Return:
The ID of the created NPC
FCNPC_Destroy
Parameters:
ID: the NPC ID to destroy
Return: None
FCNPC_Spawn
Parameters:
ID: the NPC ID to spawn
skinid: the NPC skin to spawn with
X: the X coord to spawn
Y: the Y coord to spawn
Z: the Z coord to spawn
Return:
1 if the NPC is successfully spawned, 0 if not
FCNPC_Respawn
Parameters:
ID: the NPC ID to respawn
Return:
1 if the NPC is successfully respawned, 0 if not
FCNPC_Kill
Parameters:
ID: the NPC ID to kill
Return: None
FCNPC_IsDead
Parameters:
ID: the NPC ID to check for death
Return:
1 if the NPC is dead, 0 if not
FCNPC_SetPosition
Parameters:
ID: the NPC ID
X: the X coord to set
Y: the Y coord to set
Z: the Z coord to set
Return: None
FCNPC_GetPosition
Parameters:
ID: the NPC ID
X: the X coord to get
Y: the Y coord to get
Z: the Z coord to get
Return: None
FCNPC_SetAngle
Parameters:
ID: the NPC ID
A: the angle value to set
Return: None
FCNPC_GetAngle
Parameters:
ID: the NPC ID
Return:
The angle value
FCNPC_SetVelocity
Parameters:
ID: the NPC ID
X: the X coord to set
Y: the Y coord to set
Z: the Z coord to set
Return: None
FCNPC_GetVelocity
Parameters:
ID: the NPC ID
X: the X coord to get
Y: the Y coord to get
Z: the Z coord to get
Return: None
FCNPC_SetQuaternion
Parameters:
ID: the NPC ID
X: the X coord to set
Y: the Y coord to set
Z: the Z coord to set
A: the angle to set
Return: None
FCNPC_GetQuaternion
Parameters:
ID: the NPC ID
X: the X coord to get
Y: the Y coord to get
Z: the Z coord to get
A: the quaternion angle to get
Return: None
FCNPC_SetInterior
Parameters:
ID: the NPC ID
interior: the interior value to set
Return: None
FCNPC_GetInterior
Parameters:
ID: the NPC ID
Return:
The interior ID
FCNPC_SetHealth
Parameters:
ID: the NPC ID
health: the health value to set
Return: None
FCNPC_GetHealth
Parameters:
ID: the NPC ID
Return:
The NPC health
FCNPC_SetArmour
Parameters:
ID: the NPC ID
armour: the armour value to set
Return: None
FCNPC_GetArmour
Parameters:
ID: the NPC ID
Return:
The NPC armour value
FCNPC_SetSkin
Parameters:
ID: the NPC ID
skinid: the skin ID to set
Return: None
Note: This will respawn the NPC in order for the changes to take effect
FCNPC_GetSkin
Parameters:
ID: the NPC ID
Return:
The NPC skin ID
FCNPC_SetSpecialAction
Parameters:
ID: the NPC ID
actionid: the action id to perform
Return: None
FCNPC_GetSpecialAction
Parameters:
ID: the NPC ID
Return:
The special action ID
FCNPC_SetWeapon
Parameters:
ID: the NPC ID
weaponid: the weapon ID to give
Return: None
FCNPC_GetWeapon
Parameters:
ID: the NPC ID
Return:
The NPC weapon ID
FCNPC_SetAmmo
Parameters:
ID: the NPC ID
ammo: the ammo to give
Return: None
FCNPC_GetAmmo
Parameters:
ID: the NPC ID
Return:
The NPC ammo value
FCNPC_SetWeaponSkillLevel
Parameters:
ID: the NPC ID
weapontype: the weapon typeto set its skill
level: the skill level
Return: None
FCNPC_SetKeys
Parameters:
ID: the NPC ID
keys: the keys to set for the player (No analogs)
Return: None
FCNPC_GetKeys
Parameters:
ID: the NPC ID
UDAnalog: the up/down analog value
LRAnalog: the left/right analog value
keys: the NPC keys
Return: None
FCNPC_GoTo
Parameters:
ID: the NPC ID
X: the X coordinate to go to
Y: the Y coordinate to go to
Z: the Z coordinate to go to
type: mouvement type
MOVE_TYPE_WALK: Walk the NPC
MOVE_TYPE_RUN: Run the NPC
MOVE_TYPE_SPRINT: Sprint the NPC
MOVE_TYPE_DRIVE: Drive the NPC (only in car)
UseZMap: Flag to indicate the ZMap usage
Return: None
FCNPC_Stop
Parameters:
ID: the NPC ID
Return: None
FCNPC_IsMoving
Parameters:
ID: the NPC ID
Return:
1 if moving, 0 if not
FCNPC_AimAt
Parameters:
ID: the NPC ID
X: the X coordinate to aim at
Y: the Y coordinate to aim at
Z: the Z coordinate to aim at
shoot: 1 to make the NPC shoot, 0 to aim only
Return: None
FCNPC_StopAim
Parameters:
ID: the NPC ID
Return: None
FCNPC_MeleeAttack
Parameters:
ID: the NPC ID
delay: the delay (in ms) between each melee attack
Return: None
FCNPC_StopMelee
Parameters:
ID: the NPC ID
Return: None
FCNPC_IsAiming
Parameters:
ID: the NPC ID
Return:
1 if aiming, 0 if not
FCNPC_IsShooting
Parameters:
ID: the NPC ID
Return:
1 if shooting, 0 if not
FCNPC_IsReloading
Parameters:
ID: the NPC ID
Return:
1 if reloading, 0 if not
FCNPC_EnterVehicle
Parameters:
ID: the NPC ID
vehicleid: the vehicle ID to enter
seat: the NPC seat in vehicle
Return:
1 if sucessfully entering, 0 if not
Note: This will make the NPC go to the vehicle and TRY to perform the enter vehicle animation, you may notice that sometimes the NPC enters the vehicle even before doing the animation (because we dont have each vehicle door coordinates)
FCNPC_ExitVehicle
Parameters:
ID: the NPC ID
Return:
1 if sucessfully exiting, 0 if not
Note: This will perform the exit vehicle animation and wait for some time before the NPC state will be onfoot, and you may notice that the NPC changes position after exiting vehicle (because we dont have each vehicle door coordinates)
FCNPC_PutInVehicle
Parameters:
ID: the NPC ID
vehicleid: the vehicle ID to enter
seat: the NPC seat in vehicle
Return:
1 if sucessfully put in vehicle, 0 if not
FCNPC_RemoveFromVehicle
Parameters:
ID: the NPC ID
Return:
1 if sucessfully removed from the vehicle, 0 if not
FCNPC_GetVehicleID
Parameters:
ID: the NPC ID
Return:
Returns the vehicle ID if he has any or INVALID_VEHICLE_ID if he's not in any vehicle
FCNPC_GetVehicleSeat
Parameters:
ID: the NPC ID
Return:
Returns the seat ID if he has any or ( 128 ) if he's not in any vehicle
FCNPC_StartRecordingPlayback
Parameters:
ID: the NPC ID
File: the recorded file name (should be located in "npcmodes/recordings/")
Return:
Returns 1 if the recording has successfully started, 0 otherwise
FCNPC_StopRecordingPlayback
Parameters:
ID: the NPC ID
Return:
Returns 1 if the recording has successfully stopped, 0 otherwise
FCNPC_PauseRecordingPlayback
Parameters:
ID: the NPC ID
Return: None
FCNPC_ResumeRecordingPlayback
Parameters:
ID: the NPC ID
Return: None
FCNPC_OpenNode
Parameters:
ID: the node ID
Return: 1 if the node is successfully opened, 0 otherwise
FCNPC_CloseNode
Parameters:
ID: the node ID
Return: None
FCNPC_IsNodeOpen
Parameters:
ID: the node ID
Return: 1 is the node is already open, 0 otherwise
FCNPC_SetNodePoint
Parameters:
ID: the node ID
point: the node point value to set
Return: None
FCNPC_GetNodePointPosition
Parameters:
ID: the node ID
X: the node X position to get (pointer)
Y: the node Y position to get (pointer)
Z: the node Z position to get (pointer)
Return: None
FCNPC_GetNodePointCount
Parameters:
ID: the node ID
Return: the total points in the node
FCNPC_GetNodeInfo
Parameters:
ID: the node ID
vehnodes: the total vehicle nodes in the node (pointer)
pednodes: the total ped nodes in the node (pointer)
navinodes: the total navinodes in the node (pointer)
Return: None
FCNPC_PlayNode
Parameters:
npcid: the NPC ID
nodeid: the node ID to play
type: the node type
types are:
NODE_TYPE_PED: Ped node
NODE_TYPE_VEHICLE: Vehicle node
NODE_TYPE_BOAT: Boatnode
Return: None
FCNPC_StopPlayingNode
Parameters:
ID: the NPC ID
Return: None
Callbacks
FCNPC_OnCreate
Description: gets called when the NPC is created
Parameters:
npcid: the NPC ID
Return: None
FCNPC_OnSpawn
Description: gets called when the NPC is spawned
Parameters:
npcid: the NPC ID that spawned
Return: None
FCNPC_OnRespawn
Description: gets called when the NPC is respawned
Parameters:
npcid: the NPC ID that spawned
Return: None
FCNPC_OnDeath
Description: gets called when the NPC is dead
Parameters:
npcid: the NPC ID that died
killerid: the player ID that killed the NPC ( INVALID_PLAYER_ID if the NPC has died )
weaponid: the weapon id in which the NPC was killed with
Return: None
FCNPC_OnReachDestination
Description: gets called when the NPC has reached his destination (FCNPC_GoTo)
Parameters:
npcid: the NPC ID
Return: None
FCNPC_OnVehicleEntryComplete
Description: gets called when the NPC has completed his vehicle entry (FCNPC_EnterVehicle)
Parameters:
npcid: the NPC ID
vehicleid: the vehicle ID
seat: the seat ID
Return: None
FCNPC_OnVehicleExitComplete
Description: gets called when the NPC has completed his vehicle exit(FCNPC_ExitVehicle)
Parameters:
npcid: the NPC ID
Return: None
FCNPC_OnTakeDamage
Description: gets called when the NPC got damaged
Parameters:
npcid: the NPC ID that died
damagerid: the player ID that damagedthe NPC
weaponid: the weapon id in which the NPC was damaged with
Return: None
FCNPC_OnFinishPlayback
Description: gets called when the NPC has completed playing a playback (.rec file)
Parameters:
npcid: the NPC ID
Return: None
FCNPC_OnFinishNode
Description: gets called when the NPC has completed playing a node
Parameters:
npcid: the NPC ID
Return: None
FCNPC_OnFinishNodePoint
Description: gets called when the NPC has completed playing a node point
Parameters:
npcid: the NPC ID
point: the finished point
Return: 1 to continue playing the node, 0 to stop
Installation
Put "FCNPC.dll" or "FCNPC.so" in your "plugins" folder
Put "FCNPC.inc" in your include "pawno/includes" folder
Put "FCNPC" folder in your "scriptfiles" folder
Add "FCNPC" to the plugins list in "server.cfg"
Requirements
Latest version of the SAMP server (0.3x R1-2)
Download
https://code.google.com/p/fcnpc/
Google Code
Compiled files (aswell as include and sample file) are included in the "Download" tab in google code
Notes
This is a beta release and may contain bugs and crashes, please report any bugs/crashes that you find
I took authorization from the SAMP team to release this plugin so dont ask about that
The plugin is a memory hacking plugin which means it should be updated with every server update, but i'll try to keep it always up to date and working with the latest version of the SAMP server
This plugin is different from the old CNPC plugin and dosent have any relation with it (only the idea maybe?) as its coded entirely by me only and from scratch
Dont ask to provide mirrors for this plugin, the only downloading sources are listed above in the "Download" section
Changelog
Plugin updated:
Beta 9:
Fixed damage detection (very accurate as it uses "OnPlayerGiveDamage" callback hook)
Fixed vehicle flips over when an NPC enters it
Added support for NPC jacking players vehicle
Fixed melee attack delay
Beta 8 R2:
Fixed the creation method (cleaner and more efficient method that removed all the dirty hooks and patches)
Hopefully fixed linux crashes
Fixed weapons damage values
Added checks for maxplayers and maxnpc values
Beta 8:
Fixed damage detection (accurate damage detection with bodypart and weapon damage value)
Added linux version (can be found in the download package)
Added melee attack support (FCNPC_MeleeAttack and FCNPC_StopAttack)
Fixed other minor bugs
Beta 7:
Added full support for the GTA SA nodes (see citiziens.pwn for more infos)
Fixed the player mouvement
Fixed the driving (now works very smooth)
Fixed setting or getting player stats in vehicle (position, velocity ...)
Beta 6:
NPCs now uses normal IDs (playerid), no more custom IDs
Added MOVE_TYPE_DRIVE now NPCs are able to drive
Fixed vehicle sets on fire when NPC enters as a driver
Fixed small bug related to NPC creation and added some checking for creation fail
Fixed wrong vehicle ID when entering vehicle
Beta 5 R3:
Fixed creation method (fixed crashes related to it)
Beta 5 R2:
Fixed crash when creating NPC
Fixed high CPU usage
Beta 5:
Changed the NPC creation method (no more samp-npc.exe needed) all the crashing bugs and problems related to NPC creation are fixed
Added temporary solution for damage detection (only players can shoot NPCs)
Fixed aiming Z angle (now NPCs are able to hit the target when shooting)
Added FCNPC_GetNPCID to get the NPC ID from the player id
Improved the vehicle entry (now animation gets applied properly)
Beta 4:
Fixed NPCs starting from (maxplayers in config.cfg) instead of 500
Fixed crash when having alot of NPCs (now u can create as much as you want without crashing)
Added FCNPC_GetPlayerID (to return the player real ID)
Added the possibility to disable ZMap usage when moving
Beta 3:
Fixed or limited the bandwidh usage for each NPC (can be controlled through FCNPC_SetUpdateRate)
Fixed vehicle entry and exit animations (kinda perfect now)
Added FCNPC_SetPlayerWeaponSkill
Fixed NPC mouvement sprinting speed and reaching destination
Added ZMap for NPC mouvement (no more flying while moving)
Beta 2:
Fixed crash when creating NPC
Fixed NPCs start from slot 500
Fixed vehicle sets on fire when NPC enters it
Fixed wrong parameters passed to callbacks such as (FCNPC_Spawn and FCNPC_Create ...) (Caused many problems)
Fixed vehicle id in FCNPC_EnterVehicle
Beta 1 R2:
Fixed port issue
Bugs
Damage detection is not that perfect
Credits
SA-MP Team: SAMP
OrMisicL: Developer
kurta999: Linux testing
iJumbo: Linux testing
__________________
[Plugin] FCNPC - Fully Controllable NPC