Advertisement
dann1s

Untitled

Feb 4th, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.45 KB | None | 0 0
  1. forward NPC_PucajNa(npcid, target);
  2. public NPC_PucajNa(npcid, target)
  3. {
  4.     if(FCNPC_IsValid(npcid)) {
  5.         if(NPCInfo[NPC_UzmiID(npcid)][NPC_Mrtav]) {
  6.             NPCInfo[NPC_UzmiID(npcid)][NPC_AktivnaMeta] = INVALID_PLAYER_ID;
  7.             return 1;
  8.         }
  9.         NPCInfo[NPC_UzmiID(npcid)][NPC_AktivnaMeta] = target;
  10.         new Float:x, Float:y, Float:z, Float: tempdist;
  11.         FCNPC_GetPosition(npcid, x,y,z);
  12.         new Float:PPX, PPY, PPZ;
  13.         GetPlayerPos(target, PPX, PPY, PPZ);
  14.         tempdist = GetPlayerDistanceFromPoint(target, x, y, z);
  15.         if(tempdist < 30) {
  16.             new time, chance;
  17.             switch(FCNPC_GetWeapon(npcid)) {
  18.                 case 25, 26, 27: time = 400, chance = 35;
  19.                 case 33, 34: time = 500, chance = 50;
  20.                 case 24: time = 700, chance = 40;
  21.                 default: time = 200, chance = 40;
  22.             }
  23.             FCNPC_AimAtPlayer(npcid, target, false);
  24.             SetTimerEx("NPC_PucajNa", time, false, "ii", playerid, target);
  25.             if(random(100) < chance) {
  26.                 DamagePlayer(target, 5.0, INVALID_PLAYER_ID, FCNPC_GetWeapon(npcid));
  27.                 FCNPC_TriggerWeaponShot(npcid, FCNPC_GetWeapon(npcid), BULLET_HIT_TYPE_PLAYER, target, PPX,PPY,PPZ);
  28.             }
  29.             else {
  30.                 FCNPC_TriggerWeaponShot(npcid, FCNPC_GetWeapon(npcid), BULLET_HIT_TYPE_PLAYER, target, PPX+0.5,PPY+0.5,PPZ);
  31.             }
  32.             FCNPC_GiveAmmo(npcid, 1);
  33.         }
  34.         else {
  35.             FCNPC_StopAim(npcid);
  36.             NPCInfo[NPC_UzmiID(npcid)][NPC_AktivnaMeta] = INVALID_PLAYER_ID;
  37.         }
  38.     }
  39.     return 1;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement