Advertisement
Sasino97

[NO LANG]A.I. Leatherface Script

Jul 17th, 2011
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.77 KB | None | 0 0
  1. #include <a_samp> // SA-MP Team
  2. #include <MapAndreas> // Kalcor
  3. #include <cnpc> //009, updated to 0.3c by m0niSx and adamis
  4. #include <AI_NPCS> //By Skorch
  5.  
  6. #define public: public
  7. #define private:%0(%1)  forward %0(%1); public %0(%1)
  8.  
  9. /*
  10.  
  11.   There are 6 Assassins with a CHAINSAW. Locations:
  12.   When you are near one of them, he will follow you and when it's very near he
  13.   will use his chainsaw to kill you
  14.  
  15.   1 - The Panopticon
  16.   2 - Palomino Creek
  17.   3 - Angel Pine
  18.   4 - Mount Chilliad
  19.   5 - Mount Chilliad
  20.   6 - Shady Creeks
  21.  
  22. */
  23.  
  24. public: OnGameModeInit()
  25. {
  26.     CreateBOT(0, -1, "[CNPC]Leatherface1", 162, 0, -525.3379, -102.2816, 63.2968, 270.0000);
  27.     SetTimerEx("AI_AttackNearestPlayer", 500, true, "ii", FindLastFreeSlot()+1, 9);
  28.     CreateBOT(1, -1, "[CNPC]Leatherface2", 162, 0, 2160.6884, -98.3574, 2.8141, 270.0000);
  29.     SetTimerEx("AI_AttackNearestPlayer", 500, true, "ii", FindLastFreeSlot()+1, 9);
  30.     CreateBOT(2, -1, "[CNPC]Leatherface3", 162, 0, -503.8879, -573.3398, 24.4884, 270.0000);
  31.     SetTimerEx("AI_AttackNearestPlayer", 500, true, "ii", FindLastFreeSlot()+1, 9);
  32.     CreateBOT(3, -1, "[CNPC]Leatherface4", 162, 0, -2004.5357, -2371.2932, 30.6250, 270.0000);
  33.     SetTimerEx("AI_AttackNearestPlayer", 500, true, "ii", FindLastFreeSlot()+1, 9);
  34.     CreateBOT(4, -1, "[CNPC]Leatherface5", 162, 0, -2302.1198, -1675.4301, 483.6986, 270.0000);
  35.     SetTimerEx("AI_AttackNearestPlayer", 500, true, "ii", FindLastFreeSlot()+1, 9);
  36.     CreateBOT(5, -1, "[CNPC]Leatherface6", 162, 0, -2798.7006, -1523.5063, 139.2609, 270.0000);
  37.     SetTimerEx("AI_AttackNearestPlayer", 500, true, "ii", FindLastFreeSlot()+1, 9);
  38.     return 1;
  39. }
  40.  
  41. stock CreateBOT(botid, playerid, npcName[MAX_PLAYER_NAME], skin, worldid, Float:X, Float:Y, Float:Z, Float:Rot)
  42. {
  43.     if(playerid == -1) playerid = FindLastFreeSlot();
  44.     CreateNPC(playerid, npcName);
  45.     SetSpawnInfo(playerid, 0, skin, X, Y, Z, Rot, 0, 0, 0, 0, 0, 0);
  46.     SpawnNPC(playerid);
  47.     SetPVarInt(playerid, "botid", botid);
  48.     SetNPCFacingAngle(playerid, Rot);
  49.     SetPlayerVirtualWorld(playerid, worldid);
  50. }
  51.  
  52. private: AI_AttackNearestPlayer(npcid, weapon)
  53. {
  54.     Loop(playerid, 300)
  55.     {
  56.         if(!IsPlayerConnected(playerid)) continue;
  57.         new Float:Distance;
  58.             Distance = GetDistanceBetweenTwoPlayers(npcid, playerid);
  59.         if(Distance <= 2.0)
  60.         {
  61.                 CancelAllNPCActions(npcid);
  62.             SetNPCShootPlayer(npcid, playerid, weapon);
  63.         break;
  64.         }
  65.         else if(Distance > 2.0 && Distance <= 50.0)
  66.         {
  67.             CancelAllNPCActions(npcid);
  68.             new Float:X, Float:Y, Float:Z;
  69.             GetPlayerPos(playerid, X, Y, Z);
  70.             NPC_RunTo(npcid, X, Y, Z, 1);
  71.                 break;
  72.         }
  73.         else
  74.         {
  75.         StopNPC(npcid);
  76.         }
  77.         continue;
  78.     }
  79.     return 1;
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement