Advertisement
dann1s

Untitled

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