Guest User

Untitled

a guest
Mar 10th, 2010
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. /*
  2. At line number 27 you will find #define BOMBPRICE with the number 300 as default. Change the number 300 to the ammount of cash you want the
  3. Player to pay to place a booby trap in hes current vehicle. Changing the number to 0 will result in the bomb is free!
  4. Note when changing the price you will need to compile every time!
  5.  
  6.  
  7. Vehicle Booby Trap system made by Desert 2010. Contact me on www.forum.sa-mp.com with the username Desert.
  8. Do not remove my credits or edit the text above
  9.  
  10. Regards and enjoy
  11. Desert
  12. */
  13.  
  14.  
  15.  
  16. #include <a_samp>
  17. #include <dutils>
  18.  
  19. #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  20. #pragma unused ret_memcpy
  21. #pragma tabsize 4
  22.  
  23. #define COLOUR_RED 0xFF3333AA
  24. #define COLOUR_YELLOW 0xFFFF00AA
  25.  
  26.  
  27. #define BOMBPRICE 300
  28.  
  29.  
  30. #define FILTERSCRIPT
  31.  
  32. new booby[MAX_VEHICLES];
  33.  
  34. public OnFilterScriptInit()
  35. {
  36. print("\n------------------------------------------------------------");
  37. print("Vehicle Booby Trap Filterscript has been succesfully loaded!");
  38. print("------------------------------------------------------------\n");
  39. return 1;
  40. }
  41.  
  42.  
  43. public OnPlayerCommandText(playerid, cmdtext[])
  44. {
  45. dcmd(boobytrap,9,cmdtext);
  46. return 0;
  47. }
  48.  
  49. dcmd_boobytrap(playerid,params[])
  50. {
  51. #pragma unused params
  52. new vehicle;
  53. if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOUR_RED,"You need to be in a vehicle to booby trap it!");
  54. else
  55. {
  56. vehicle = GetPlayerVehicleID(playerid);
  57. if(booby[vehicle] == 1) return SendClientMessage(playerid,COLOUR_RED,"This vehicle has already been booby trapped!");
  58. {
  59. new cash = BOMBPRICE;
  60. if(cash > 0)
  61. {
  62. if(GetPlayerMoney(playerid) < BOMBPRICE) return SendClientMessage(playerid,COLOUR_RED,"You do not have money enough for a booby trap!");
  63. else
  64. {
  65. SendClientMessage(playerid,COLOUR_YELLOW,"Planted booby trap inside the car!");
  66. PlayerPlaySound(playerid,1057,0,0,0);
  67. GivePlayerMoney(playerid,-BOMBPRICE);
  68. booby[vehicle] = 1;
  69. RemovePlayerFromVehicle(playerid);
  70. GameTextForPlayer(playerid,"~r~Booby trapped",10000,4);
  71. return 1;
  72. }
  73. }
  74. else
  75. {
  76. SendClientMessage(playerid,COLOUR_YELLOW,"Planted booby trap inside the car!");
  77. PlayerPlaySound(playerid,1057,0,0,0);
  78. booby[vehicle] = 1;
  79. RemovePlayerFromVehicle(playerid);
  80. return 1;
  81. }
  82. }
  83. }
  84. }
  85.  
  86. public OnPlayerStateChange(playerid, newstate, oldstate)
  87. {
  88. if(newstate == PLAYER_STATE_DRIVER)
  89. {
  90. new vehicle = GetPlayerVehicleID(playerid);
  91. if(booby[vehicle] == 1)
  92. {
  93. new Float:X,Float:Y,Float:Z;
  94. GetVehiclePos(vehicle,X,Y,Z);
  95. CreateExplosion(X,Y,Z,7,10);
  96. PlayerPlaySound(playerid,1057,0,0,0);
  97. booby[vehicle] = 0;
  98. SendClientMessage(playerid,COLOUR_RED,"Vehicle has been booby trapped!");
  99. GameTextForPlayer(playerid,"~r~Booby trapped",10000,4);
  100. return 1;
  101. }
  102. }
  103. return 1;
  104. }
Advertisement
Add Comment
Please, Sign In to add comment