Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main ( ) { }
- #include <a_samp>
- #include <foreach>
- #include <cnpc>
- #define MAX_NPC_ZOMBIES ( 5 )
- new badSkins [ ] = { 3, 4, 5, 6, 8, 42, 65, 74, 86, 119, 149, 208, 273, 289 };
- public OnGameModeInit ( )
- {
- AddPlayerClass ( getRandomValidSkin ( ), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
- for ( new rP; rP < MAX_NPC_ZOMBIES; rP++ )
- {
- new
- rX,
- rY,
- rZ,
- NPCid,
- NPCName[5];
- valstr ( NPCName, rP );
- NPCid = FindLastFreeSlot ( );
- CreateNPC ( NPCid, NPCName);
- rX = random ( 50 );
- rY = random ( 50 );
- rZ = random ( 5 );
- SetSpawnInfo ( NPCid, -1, getRandomValidSkin ( ), float ( rX ), float ( rY ), float ( rZ ), 90, 0, 0, 0, 0, 0, 0 );
- SpawnNPC ( NPCid );
- printf ( "NPC%d has been created and spawned.", NPCid );
- }
- return 1;
- }
- stock
- isValidSkin ( skinid )
- {
- if ( skinid < 0 || skinid > 299 ) return false;
- for ( new i = 0; i < sizeof ( badSkins ); i++ )
- {
- if ( skinid == badSkins [ i ] ) return false;
- }
- return true;
- }
- stock
- getRandomValidSkin ( )
- {
- new skin;
- do skin = random ( 300 );
- while ( !isValidSkin ( skin ) );
- return skin;
- }
- public OnNPCGetDamage ( npcid, playerid, Float:health_loss, bodypart )
- {
- new
- Float:pX,
- Float:pY,
- Float:pZ;
- GetPlayerPos ( playerid, pX, pY, pZ );
- printf ( "OnNPCGetDamage ( %d, %d, %f, %d )", npcid, playerid, health_loss, bodypart );
- NPC_RunTo ( npcid, pX, pY, pZ, false );
- return 1;
- }
- public OnRecordingPlaybackEnd ( npcid, reason )
- {
- printf ( "OnRecordingPlaybackEnd ( %d, %d ) ", npcid, reason);
- }
- public OnNPCMovingComplete ( npcid )
- {
- new
- Float:nX,
- Float:nY,
- Float:nZ,
- Float:pX,
- Float:pY,
- Float:pZ;
- GetNPCPos ( npcid, nX, nY, nZ );
- printf ( "OnNPCMovingComplete ( %d ) ", npcid);
- foreach (Player, i)
- {
- if ( IsPlayerInRangeOfPoint ( i, 2.0, nX, nY, nZ ) )
- {
- GetPlayerPos ( i, pX, pY, pZ );
- NPC_LookAt ( npcid, pX, pY, pZ );
- NPC_ShotAt ( npcid, pX, pY, pZ );
- }
- }
- }
- public OnNPCSpawn(npcid)
- {
- printf("OnNPCSpawn(%d)",npcid);
- }
- public OnNPCDeath(npcid,killerid,reason)
- {
- printf("OnNPCDeath(%d,%d,%d)",npcid,killerid,reason);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement