Guest User

Bullet Hole

a guest
Jul 30th, 2014
938
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.56 KB | None | 0 0
  1.  
  2. #include    <a_samp>
  3. #include    <zcmd>
  4. #include    <streamer>
  5. #define     MAX_HOLES   700
  6.  
  7. enum hInfo
  8. {
  9.     hCreated,
  10.     Float:hX,
  11.     Float:hY,
  12.     Float:hZ,
  13.     hCount,
  14.     hObject,
  15. };
  16. new HoleInfo[MAX_HOLES][hInfo];
  17.  
  18. public OnFilterScriptInit()
  19. {
  20.     for(new i; i < MAX_HOLES; i++) { i = 0; return 1;}
  21.     print("\n--------------------------------------");
  22.     print(" Blank Filterscript by your name here");
  23.     print("--------------------------------------\n");
  24.     return 1;
  25. }
  26.  
  27. stock CreateHole(Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:Angle)
  28. {
  29.     for(new i = 0; i < sizeof(HoleInfo); i++)
  30.     {
  31.         if(HoleInfo[i][hCreated] == 0)
  32.         {
  33.             HoleInfo[i][hCreated]=1;
  34.             HoleInfo[i][hX]=x;
  35.             HoleInfo[i][hY]=y;
  36.             HoleInfo[i][hZ]=z;
  37.             HoleInfo[i][hObject] = CreateObject(3106, x, y, z, rx, ry, Angle);
  38.             HoleInfo[i][hCount] += 1;
  39.             SetObjectMaterial(HoleInfo[i][hObject], 0, 19341, "egg_texts", "easter_egg01", 0xFF000000);
  40.             return 1;
  41.         }
  42.         if(HoleInfo[i][hCount] == MAX_HOLES) { return DeleteAllHoles(); }
  43.     }
  44.     return 0;
  45. }
  46.  
  47. CMD:clear(playerid, params[])
  48. {
  49.     DeleteAllHoles();
  50.     return 1;
  51. }
  52.  
  53. stock DeleteAllHoles()
  54. {
  55.     for(new i = 0; i < sizeof(HoleInfo); i++)
  56.     {
  57.         if(HoleInfo[i][hCreated] == 1)
  58.         {
  59.             HoleInfo[i][hCreated]=0;
  60.             HoleInfo[i][hX]=0.0;
  61.             HoleInfo[i][hY]=0.0;
  62.             HoleInfo[i][hZ]=0.0;
  63.             HoleInfo[i][hCount] = 0;
  64.             DestroyObject(HoleInfo[i][hObject]);
  65.         }
  66.     }
  67.     return 0;
  68. }
  69.  
  70.  
  71. public OnFilterScriptExit()
  72. {
  73.     return 1;
  74. }
  75.  
  76. GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  77. {
  78.     new Float:a;
  79.     GetPlayerPos(playerid, x, y, a);
  80.     GetPlayerFacingAngle(playerid, a);
  81.     if (GetPlayerVehicleID(playerid))
  82.     {
  83.       GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  84.     }
  85.     x += (distance * floatsin(-a, degrees));
  86.     y += (distance * floatcos(-a, degrees));
  87. }
  88.  
  89. CMD:gun(playerid, params[])
  90. {
  91.     GivePlayerWeapon(playerid, 24, 100);
  92.     GivePlayerWeapon(playerid, 34, 100);
  93.     GivePlayerWeapon(playerid, 38, 100);
  94.     return 1;
  95. }
  96.  
  97. public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
  98. {
  99.     if(weaponid == 38 || weaponid == 37 || weaponid == 36 || weaponid == 35) return 1;
  100.     else{
  101.         if(hittype == 0 && fX != 0)
  102.         {
  103.             new Float: A, Float: rX, Float: rY;
  104.             GetXYInFrontOfPlayer(playerid, rX, rY, 5.0);
  105.             GetPlayerFacingAngle(playerid, A);
  106.             CreateHole(fX, fY, fZ, rX, rY, A-90);
  107.         }
  108.     }
  109.     return 1;
  110. }
Advertisement
Add Comment
Please, Sign In to add comment