23.01.2019, 15:00
(
Last edited by Lokii; 28/03/2019 at 08:49 PM.
)
COPS
current version (v1.0)
This include creates cop ai, they will kill anyone who is wanted, they can detect crimes like if player shoot, if player damage other player or a cop, if player killed someone, however for now they only follow wanted players otherwise they just stand, and they cant drive (will add later), no melee support yet.
How to include:current version (v1.0)
This include creates cop ai, they will kill anyone who is wanted, they can detect crimes like if player shoot, if player damage other player or a cop, if player killed someone, however for now they only follow wanted players otherwise they just stand, and they cant drive (will add later), no melee support yet.
Code:
#define FILTERSCRIPT #include <a_samp> #include <fcnpc> #include <cops> //requires fcnpc 2.0.0
Code:
CRIME_KILL 0 //called only if you kill players, for cops use oncopdeath CRIME_SHOOT 1 CRIME_DAMAGE 2 //called only if you shoot players, for cops use oncoptakedamage
Code:
native CreateCop(skinid, name[], Float:detection_area, Float:health, Float:x, Float:y, Float:z, Float:angle, weapon, Float:accuracy); native IsCopDead(cop_id); native IsCopInvulnerable(cop_id); native IsCopMoving(cop_id); native IsCopValid(cop_id); native GetCopHealth(cop_id); native GetCopTarget(cop_id); native GetClosestPlayerToCop(cop_id); native GetCopDetectionArea(cop_id); native GetCopPos(cop_id, &Float:x, &Float:y, &Float:z); native GetCopAngle(cop_id, &Float:angle); native GetCopCreationPos(cop_id, &Float:x, &Float:y, &Float:z); native GetCopCreationAngle(cop_id, &Float:angle); native GetCopInterior(cop_id); native GetCopVirtualWorld(cop_id); native GetCopSkin(cop_id); native GetCopCustomSkin(cop_id); native GetCopWeapon(cop_id); native SetCopWeapon(cop_id, weaponid); native SetCopInvulnerable(cop_id, bool:invulnerable); native SetCopSkin(cop_id, skinid); native SetCopInterior(cop_id, interiorid); native SetCopVirtualWorld(cop_id, worldid); native SetCopHealth(cop_id, Float:health); native RespawnCop(cop_id); native DestroyCop(cop_id);
Code:
OnCopDeath(cop_id, killerid, weaponid); OnCopTakeDamage(cop_id, damagerid, weaponid, bodypart, Float:health_loss); OnCopKillPlayer(cop_id, playerid); OnCrimeHappenNearCop(playerid, crime);
PHP Code:
#define FILTERSCRIPT
#include <a_samp>
#include <fcnpc>
#include <cops>
#include <zcmd>
new cop;
CMD:cop(playerid)
{
new Float:x, Float:y, Float:z;
if(!IsCopValid(cop)) //you could do without the check as well the include checks if cop allready exist
{
GetPlayerPos(playerid, x, y, z);
cop = CreateCop(284, "Cop01", 45.0, 100.0, x+4, y, z, -1, 22, 1.0);
}
return 1;
}
CMD:dcop(playerid)
{
if(IsCopValid(cop)) //could do without the check as well
{
DestroyCop(cop);
}
return 1;
}
public OnCrimeHappenNearCop(playerid, crime)
{
switch(crime)
{
case CRIME_KILL:
{
if(GetPlayerWantedLevel(playerid) < 5)
{
SetPlayerWantedLevel(playerid, 5);
}
}
case CRIME_SHOOT:
{
if(GetPlayerWantedLevel(playerid) < 2)
{
SetPlayerWantedLevel(playerid, 2);
}
}
case CRIME_DAMAGE:
{
if(GetPlayerWantedLevel(playerid) < 3)
{
SetPlayerWantedLevel(playerid, 3);
}
}
}
return 1;
}
public OnCopKillPlayer(cop_id, playerid)
{
if(GetPlayerWantedLevel(playerid) > 1)
{
SetPlayerWantedLevel(playerid, 0);
}
return 1;
}
Download: Click here
requires:
fcnpc 2.0.0
Bugs:
If you find any bugs please report them and i will fix them in the next update!
Credits:
SA-MP team - a_samp
ZIGGI - fcnpc
Lokii - cops
Pottus - colandreas & optimizing
Crayder - colandreas