Advertisement
Guest User

ZombieAttack

a guest
Jul 4th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.54 KB | None | 0 0
  1. public ZombieAttack(zombieid)
  2. {
  3.     if(GetRNPCHealth(dZombie[zombieid][dZombieID]) > 0)
  4.     {
  5.         new victim = GetZombieVictim(zombieid), Float:x, Float:y, Float:z;
  6.         GetPlayerPos(dZombie[zombieid][dZombieID], x, y, z);
  7.         if(victim != INVALID_PLAYER_ID)
  8.         {
  9.             if(IsPlayerInRangeOfPoint(victim, 1.0, x, y, z))
  10.             {
  11.                 RNPC_StopPlayback(dZombie[zombieid][dZombieID]);//RNPC_PauseRecordingPlayback(dZombie[zombieid][dZombieID]);
  12.                 RNPC_CreateBuild(dZombie[zombieid][dZombieID], PLAYER_RECORDING_TYPE_ONFOOT);
  13.                 RNPC_AddPause(100);
  14.                 RNPC_SetKeys(KEY_FIRE);
  15.                 RNPC_AddPause(100);
  16.                 RNPC_SetKeys(0);
  17.                 RNPC_FinishBuild();
  18.                 RNPC_StartBuildPlayback(dZombie[zombieid][dZombieID]);
  19.                 //---
  20.                 GivePlayerHealth(victim, -ZOMBIE_DAMAGE, 0, dZombie[zombieid][dZombieID]);
  21.             }
  22.             else
  23.             {
  24.                 RNPC_StopPlayback(dZombie[zombieid][dZombieID]);//RNPC_PauseRecordingPlayback(dZombie[zombieid][dZombieID]);
  25.                 new Float:x2, Float:y2, Float:z2, Float:angle = GetZAngleBetweenPos(x, y, x2, y2);
  26.                 GetPlayerPos(victim, x2, y2, z2);
  27.                 x2 = x + ((dZombie[zombieid][dZombieClass] == SPEED) ? 2.5 : 1.3) * floatsin(-angle, degrees);
  28.                 y2 = y + ((dZombie[zombieid][dZombieClass] == SPEED) ? 2.5 : 1.3) * floatcos(-angle, degrees);
  29.                 CA_FindZ_For2DCoord(x2, y2, z2);
  30.                 printf("x = %f - y = %f - z = %f - x2 = %f - y2 = %f - z2 = %f --- angle = %f", x, y, z, x2, y2, z2, angle);
  31.                 MoveRNPC(dZombie[zombieid][dZombieID], x2, y2, z2, (dZombie[zombieid][dZombieClass] == SPEED) ? RNPC_SPEED_SPRINT : RNPC_SPEED_RUN, 1);
  32.             }
  33.         }
  34.     }
  35.     return 1;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement