Advertisement
Guest User

Code #3

a guest
Jul 29th, 2016
1,346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.54 KB | None | 0 0
  1. /* ---------------------------------
  2.     Охота на оленей
  3.  
  4. - Author: Виски.
  5. ---------------------------------*/
  6.  
  7. #define FILTERSCRIPT
  8.  
  9. #include <a_samp>
  10. #include <FCNPC>
  11.  
  12. new Float:spawn_deer[][4] = // Кол-во оленей
  13. {
  14.     {-1154.8103,2466.2136,109.7557,167.5862}
  15. };
  16.  
  17. new Float:Movement[][8] = // куда они бегут
  18. {
  19.     {-1173.1147,2418.3118,113.8704},
  20.     {-1260.1194,2393.2351,99.1603},
  21.     {-1311.4369,2446.5022,87.7836},
  22.     {-1296.5278,2499.5815,86.9498},
  23.     {-1157.3190,2505.4756,112.4002},
  24.     {-1186.0594,2501.7334,113.0903},
  25.     {-1158.6748,2374.9146,108.1565},
  26.     {-1221.4376,2479.6360,95.8251}
  27. };
  28. new interior_car, object_deer;
  29. new npc_id;
  30. public OnFilterScriptInit()
  31. {
  32.     FCNPC_SetUpdateRate(1);
  33.     printf("");
  34.     printf("-------------------------------------------------");
  35.     printf("  Система охоты на оленей by WH1SKEY");
  36.     printf("-------------------------------------------------");
  37.     printf("");
  38.     interior_car = CreateObject(19315, 0.0, 0.0, 0.0, 180.0, 0.0, 0.0);
  39.     object_deer = 594;
  40.     // Create NPCs
  41.     npc_id = FCNPC_Create("BotEx");
  42.     FCNPC_Spawn(npc_id, random(299), spawn_deer[0][0], spawn_deer[0][1], spawn_deer[0][2]);
  43.     FCNPC_SetAngle(npc_id, spawn_deer[0][3]);
  44.     FCNPC_SetInterior(npc_id, 0);
  45.     FCNPC_SetWeapon(npc_id, random(11) + 22);
  46.     FCNPC_SetAmmo(npc_id, 500);
  47.     object_deer = CreateVehicle(594,-1154.8103,2466.2136,109.7557,167.5862,-1,-1,60);
  48.     AttachObjectToVehicle(interior_car, object_deer,0.0,0.0,0.4,0.0,0.0,90.0);
  49.     LinkVehicleToInterior(object_deer,6);
  50.     FCNPC_PutInVehicle(npc_id, object_deer, 0);
  51. }
  52.  
  53. public FCNPC_OnDeath(npcid, killerid, weaponid)
  54. {
  55.     DestroyVehicle(object_deer);
  56.     FCNPC_Respawn(npcid);
  57.     object_deer = CreateVehicle(594,-1154.8103,2466.2136,109.7557,167.5862,-1,-1,60);
  58.     AttachObjectToVehicle(interior_car, object_deer,0.0,0.0,0.4,0.0,0.0,90.0);
  59.     LinkVehicleToInterior(object_deer,6);
  60.     FCNPC_PutInVehicle(npcid, object_deer, 0);
  61.     return 1;
  62. }
  63.  
  64. public FCNPC_OnCreate(npcid)
  65. {
  66.     return 1;
  67. }
  68.  
  69. new number_hits[MAX_PLAYERS char], notification[MAX_PLAYERS char];
  70. public OnPlayerUpdate(playerid)
  71. {
  72.     if(notification{playerid} == 1)
  73.     {
  74.         if (!IsPlayerInRangeOfPoint(playerid, 40.0, -1154.8103,2466.2136,109.7557)) notification{playerid} = 0;
  75.     }
  76.     return true;
  77. }
  78.  
  79. public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
  80. {
  81.     if (IsPlayerInRangeOfPoint(playerid, 40.0, -1154.8103,2466.2136,109.7557))
  82.     {
  83.         if(notification{playerid} == 0)
  84.         {
  85.             new rand = random(sizeof(Movement));
  86.             FCNPC_GoTo(npc_id, Movement[rand][0], Movement[rand][1], Movement[rand][2], MOVE_TYPE_DRIVE, 0.6, false), FCNPC_IsMoving(npc_id);
  87.             SendClientMessage(playerid, 0x0092F7FF, !"Вы распугали всех оленей!");
  88.             notification{playerid} = 1;
  89.         }
  90.     }
  91.     if(hittype == 3 && object_deer)
  92.     {
  93.         new rand = random(sizeof(Movement));
  94.         number_hits{playerid}++;
  95.         if(number_hits{playerid} == 1) FCNPC_GoTo(npc_id, Movement[rand][0], Movement[rand][1], Movement[rand][2], MOVE_TYPE_DRIVE, 0.6, false), FCNPC_IsMoving(npc_id);
  96.         if(number_hits{playerid} == 2)
  97.         {
  98.             FCNPC_SetHealth(npc_id, 0);
  99.             SendClientMessage(playerid, 0x0092F7FF, !"Вы убили оленя!");
  100.             number_hits{playerid} = 0;
  101.         }
  102.         return 1;
  103.     }
  104.     return 1;
  105. }
  106.  
  107. public OnPlayerCommandText(playerid, cmdtext[])
  108. {
  109.     if(!strcmp(cmdtext, "/tpol", true))
  110.     {
  111.         SetPlayerPos(playerid, -1154.8103,2466.2136,109.7557);
  112.         return 1;
  113.     }
  114.     return false;
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement