Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.41 KB | None | 0 0
  1. main ( ) { }
  2.  
  3. #include <a_samp>
  4. #include <foreach>
  5. #include <cnpc>
  6.  
  7. #define MAX_NPC_ZOMBIES ( 5 )
  8.  
  9. new badSkins [ ] = { 3, 4, 5, 6, 8, 42, 65, 74, 86, 119, 149, 208, 273, 289 };
  10.  
  11.  
  12. public OnGameModeInit ( )
  13. {
  14.     AddPlayerClass ( getRandomValidSkin ( ), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
  15.  
  16.     for ( new rP; rP < MAX_NPC_ZOMBIES; rP++ )
  17.     {
  18.         new
  19.             rX,
  20.             rY,
  21.             rZ,
  22.             NPCid,
  23.             NPCName[5];
  24.         valstr ( NPCName, rP );
  25.         NPCid = FindLastFreeSlot ( );
  26.         CreateNPC       ( NPCid, NPCName);
  27.         rX = random     ( 50 );
  28.         rY = random     ( 50 );
  29.         rZ = random     ( 5  );
  30.         SetSpawnInfo    ( NPCid, -1, getRandomValidSkin ( ), float ( rX ), float ( rY ), float ( rZ ), 90, 0, 0, 0, 0, 0, 0 );
  31.         SpawnNPC        ( NPCid );
  32.         printf          ( "NPC%d has been created and spawned.", NPCid );
  33.     }
  34.     return 1;
  35. }
  36.  
  37.  
  38. stock
  39.     isValidSkin ( skinid )
  40. {
  41.   if  ( skinid < 0 || skinid > 299 ) return false;
  42.   for ( new i = 0; i < sizeof ( badSkins ); i++ )
  43.   {
  44.       if ( skinid == badSkins [ i ] ) return false;
  45.   }
  46.   return true;
  47. }
  48.  
  49. stock
  50.     getRandomValidSkin ( )
  51. {
  52.     new skin;
  53.     do skin = random ( 300 );
  54.     while ( !isValidSkin ( skin ) );
  55.     return skin;
  56. }
  57.  
  58. public OnNPCGetDamage ( npcid, playerid, Float:health_loss, bodypart )
  59. {
  60.     new
  61.         Float:pX,
  62.         Float:pY,
  63.         Float:pZ;
  64.     GetPlayerPos ( playerid, pX, pY, pZ );
  65.     printf ( "OnNPCGetDamage ( %d, %d, %f, %d )", npcid, playerid, health_loss, bodypart );
  66.     NPC_RunTo ( npcid, pX, pY, pZ, false );
  67.     return 1;
  68. }
  69.  
  70. public OnRecordingPlaybackEnd ( npcid, reason )
  71. {
  72.     printf ( "OnRecordingPlaybackEnd ( %d, %d ) ", npcid, reason);
  73. }
  74.  
  75. public OnNPCMovingComplete ( npcid )
  76. {
  77.     new
  78.         Float:nX,
  79.         Float:nY,
  80.         Float:nZ,
  81.         Float:pX,
  82.         Float:pY,
  83.         Float:pZ;
  84.     GetNPCPos ( npcid, nX, nY, nZ );
  85.     printf ( "OnNPCMovingComplete ( %d ) ", npcid);
  86.     foreach (Player, i)
  87.     {
  88.         if ( IsPlayerInRangeOfPoint ( i, 2.0, nX, nY, nZ ) )
  89.         {
  90.             GetPlayerPos ( i, pX, pY, pZ );
  91.             NPC_LookAt ( npcid, pX, pY, pZ );
  92.             NPC_ShotAt ( npcid, pX, pY, pZ );
  93.         }
  94.     }
  95. }
  96.  
  97. public OnNPCSpawn(npcid)
  98. {
  99.     printf("OnNPCSpawn(%d)",npcid);
  100. }
  101.  
  102. public OnNPCDeath(npcid,killerid,reason)
  103. {
  104.     printf("OnNPCDeath(%d,%d,%d)",npcid,killerid,reason);
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement