Advertisement
FoxHound

C4-System

Mar 8th, 2011
915
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.19 KB | None | 0 0
  1.              /**//**//**//**//**//**//**//**//**/
  2.             /*+--------------------------------+*/
  3.             /*|                                |*/
  4.             /*|            C4 SYSTEM           |*/
  5.             /*|          FILTERSCRIPT          |*/
  6.             /*|      bY PSPgamer/FoxHound      |*/
  7.             /*|            2 0 0 9             |*/
  8.             /*|                                |*/
  9.             /*+--------------------------------+*/
  10.             /*|         21 Januar 2010         |*/
  11.             /*+--------------------------------+*/
  12.              /**//**//**//**//**//**//**//**//**/
  13.  
  14. #include <a_samp>
  15.  
  16. #define MAX_BOMBS 3
  17.  
  18. new pBombStatus[MAX_PLAYERS];
  19. new pPlacedBomb[MAX_PLAYERS];
  20. new BombObject[MAX_PLAYERS][MAX_BOMBS+1];
  21. new PlaceBombFunc[MAX_PLAYERS];
  22. new PlaceBombTimer[MAX_PLAYERS];
  23.  
  24. public OnPlayerConnect(playerid)
  25. {
  26.     pBombStatus[playerid] = 0;
  27.     pPlacedBomb[playerid] = 0;
  28.     PlaceBombFunc[playerid] = 0;
  29.     return 1;
  30. }
  31.  
  32. public OnPlayerDisconnect(playerid, reason)
  33. {
  34.     DestroyBombsFromPlayer(playerid);
  35.     return 1;
  36. }
  37.  
  38. public OnPlayerDeath(playerid, killerid, reason)
  39. {
  40.     DestroyBombsFromPlayer(playerid);
  41.     return 1;
  42. }
  43.  
  44. public OnPlayerCommandText(playerid, cmdtext[])
  45. {
  46.     if(strcmp(cmdtext,"/c4",true) == 0)
  47.     {
  48.         if(PlaceBombFunc[playerid] == 0)
  49.         {
  50.             if(pBombStatus[playerid] < MAX_BOMBS)
  51.             {
  52.                 new Float:x,Float:y,Float:z;
  53.                 GetPlayerPos(playerid,x,y,z);
  54.                 for(new i=0;i<MAX_PLAYERS;i++) { PlayerPlaySound(i,1055,x,y,z-0.85); }
  55.                 pBombStatus[playerid] += 1;
  56.                 TogglePlayerControllable(playerid, 0);
  57.                 ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 2000);
  58.                 PlaceBombFunc[playerid] = 1;
  59.                 PlaceBombTimer[playerid] = SetTimerEx("PlaceBomb",500,1,"u",playerid);
  60.                 pPlacedBomb[playerid] = 1;
  61.             }
  62.             return 1;
  63.         }
  64.     }
  65.     return 0;
  66. }
  67.  
  68. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  69. {
  70.     if(newkeys == KEY_FIRE)
  71.     {
  72.         if(GetPlayerWeapon(playerid) == 0 || GetPlayerWeapon(playerid) == 4)
  73.         {
  74.             if(pPlacedBomb[playerid] == 1)
  75.             {
  76.                 if(PlaceBombFunc[playerid] == 0)
  77.                 {
  78.                     new Float:x,Float:y,Float:z;
  79.                     GetObjectPos(BombObject[playerid][pBombStatus[playerid]],x,y,z);
  80.                     for(new i=0;i<MAX_PLAYERS;i++) { PlayerPlaySound(i,1055,x,y,z); }
  81.                     CreateExplosion(x,y,z,1,10.0);
  82.                     DestroyObject(BombObject[playerid][pBombStatus[playerid]]);
  83.                     pBombStatus[playerid] -= 1;
  84.                 }
  85.             }
  86.         }
  87.     }
  88.     return 1;
  89. }
  90.  
  91. public OnPlayerUpdate(playerid)
  92. {
  93.     if(pBombStatus[playerid] == 0) { pPlacedBomb[playerid] = 0; }
  94.     return 1;
  95. }
  96.  
  97. forward DestroyBombsFromPlayer(playerid);
  98. public DestroyBombsFromPlayer(playerid)
  99. {
  100.     if(pBombStatus[playerid] > 0)
  101.     {
  102.         for(new i = 0; i<MAX_BOMBS+1; i++)
  103.         {
  104.             DestroyObject(BombObject[playerid][i]);
  105.         }
  106.     }
  107.     pPlacedBomb[playerid] = 0;
  108.     pBombStatus[playerid] = 0;
  109.     return 1;
  110. }
  111.  
  112. forward PlaceBomb(playerid);
  113. public PlaceBomb(playerid)
  114. {
  115.     PlaceBombFunc[playerid] += 1;
  116.     if(PlaceBombFunc[playerid] == 4)
  117.     {
  118.         new Float:x,Float:y,Float:z;
  119.         GetPlayerPos(playerid,x,y,z);
  120.         BombObject[playerid][pBombStatus[playerid]] = CreateObject(2742,x,y,z-0.90,270.0,0.0,0.0);
  121.     }
  122.     if(PlaceBombFunc[playerid] == 5)
  123.     {
  124.         KillTimer(PlaceBombTimer[playerid]);
  125.         PlaceBombFunc[playerid] = 0;
  126.         TogglePlayerControllable(playerid, 1);
  127.     }
  128.     return 1;
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement