Advertisement
EOussama

EO_Explosives Shop version 0.1

Nov 29th, 2016
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 23.20 KB | None | 0 0
  1. /*
  2.  
  3.  
  4.                                                                     _____________    _____________
  5.                                                                     ||___________   | ____________|
  6.                                                                     ||              ||           ||
  7.                                                                     ||              ||           ||
  8.                                                                     ||___________   ||           ||
  9.                                                                     ||___________   ||           ||
  10.                                                                     ||              ||           ||
  11.                                                                     ||              ||           ||
  12.                                                                     ||___________   ||___________||
  13.                                                                     ||___________   ||____________|
  14.  
  15.  
  16.                                                                             EO_Explosives Shop
  17.  
  18.  
  19.  
  20.  
  21.  
  22. **CopyRight Claim: Please do not upload this or edit it without my permission,All credits must be sacred,
  23.     and thus any attempt to include this on your server,
  24.     you will have to credit me as well,
  25.  
  26.  
  27.  
  28. =====================================================================================================================================================================
  29. =====================================================================================================================================================================
  30. ====================================================================================================================================================================*/
  31. #define FILTERSCRIPT
  32.  
  33. #include <a_samp>
  34. #include <sscanf2>
  35. #include <ZCMD>
  36. #include <YSI\y_ini>
  37.  
  38.  
  39. //Colors
  40.  
  41. #define Blren 0x058E6AFF
  42. #define Red 0xFF0000FF
  43.  
  44.  
  45. #if defined FILTERSCRIPT
  46.  
  47. public OnFilterScriptInit()
  48. {
  49.     print("\n--------------------------------------");
  50.     print(" EO_EO_Explosive Shop v0.1");
  51.     print("--------------------------------------\n");
  52.     return 1;
  53. }
  54.  
  55. public OnFilterScriptExit()
  56. {
  57.     return 1;
  58. }
  59.  
  60. #else
  61.  
  62. main()
  63. {
  64.     print("\n----------------------------------");
  65.     print(" EO_Explosive Shop by E.Oussama");
  66.     print("----------------------------------\n");
  67. }
  68.  
  69. #endif
  70.  
  71. new Float:gC[3];
  72.  
  73. new pBomb[MAX_PLAYERS];
  74. new pBombTimer[MAX_PLAYERS];
  75. new pABICheck[MAX_PLAYERS];
  76. new Float:pBombPos[MAX_PLAYERS][3];
  77. new Float:pABombPos[MAX_PLAYERS][3];
  78.  
  79.  
  80. //DIALOGS
  81. enum{
  82.     DIALOG_EVMINDEX,
  83.     DIALOG_EVMPSTATS,
  84.     DIALOG_EHELP,
  85.     DIALOG_TBomb
  86. };
  87.  
  88. enum E_PLAYER_BOMB_DATA{
  89.     bool:BombUse,
  90.     bool:BombEx,
  91.     bool:BombC4,
  92.     bool:AtBomb,
  93.     bool:CarBomb,
  94.     Bomb,
  95.     TBomb,
  96.     CBomb,
  97.     ABomb,
  98.     C4
  99. };
  100. new pbData[MAX_PLAYERS][E_PLAYER_BOMB_DATA];
  101. new vbData[MAX_VEHICLES][E_PLAYER_BOMB_DATA];
  102.  
  103. //TIMERS
  104. forward BombTimer(playerid);
  105. forward TimingBombTimer(playerid);
  106. forward VehicleCarBombClear(vehicleid);
  107. forward CarBombActivation(vehicleid);
  108. forward atomicbombimpact(playerid);
  109. /*=====================================================================================================================================================================
  110. =====================================================================================================================================================================
  111. ======================================================|| Configuration Panel ||=======================================================================================*/
  112. //Bombs Prices
  113. #define BombP 2500      // Normal bomb
  114. #define TBombP 5000     //Settable timed bomb
  115. #define C4P 10000       //C4 remote-controlled
  116. #define CBombP 12000    //Vehicle bomb
  117. #define ABombP 20000    //Atomic Bomb
  118.  
  119. //Timers
  120. #define BrakingTimer 300000 //Timer between using each bomb
  121. #define VehicleBombClearTimer 300000 //Time to clear all vehicle car bombs
  122. /*=====================================================================================================================================================================
  123. ====================================================================================================================================================================*/
  124.  
  125. public OnGameModeInit()
  126. {
  127.     SetGameModeText("EO_Explosive Shop version 0.1 by EOussama");
  128.     AddPlayerClass(0, 1173.1952,-1324.2224,15.3951, 269.1425, 0, 0, 0, 0, 0, 0);
  129.  
  130.     SetTimer("VehicleCarBombClear",VehicleBombClearTimer,true);
  131.     return 1;
  132. }
  133.  
  134. public OnGameModeExit()
  135. {
  136.     SetGameModeText("EO_Explosive Shop version 0.1 by EOussama");
  137.     AddPlayerClass(0, 1173.1952,-1324.2224,15.3951, 269.1425, 0, 0, 0, 0, 0, 0);
  138.     return 1;
  139. }
  140.  
  141. public OnPlayerRequestClass(playerid, classid)
  142. {
  143.     SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  144.     SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  145.     SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  146.     pbData[playerid][BombEx] = false;
  147.     pbData[playerid][BombC4] = false;
  148.     pbData[playerid][AtBomb] = false;
  149.     return 1;
  150. }
  151.  
  152. public OnPlayerConnect(playerid)
  153. {
  154.     pbData[playerid][Bomb] = 0;
  155.     pbData[playerid][BombEx] = false;
  156.     pbData[playerid][AtBomb] = false;
  157.     pbData[playerid][BombUse] = true;
  158.     pbData[playerid][BombC4] = false;
  159.     return 1;
  160. }
  161.  
  162. public OnPlayerDisconnect(playerid, reason)
  163. {
  164.     pbData[playerid][BombEx] = false;
  165.     pbData[playerid][BombC4] = false;
  166.     pbData[playerid][AtBomb] = false;
  167.     pbData[playerid][Bomb] = 0;
  168.     return 1;
  169. }
  170.  
  171. public OnPlayerSpawn(playerid)
  172. {
  173.     pbData[playerid][BombEx] = false;
  174.     pbData[playerid][BombC4] = false;
  175.     pbData[playerid][AtBomb] = false;
  176.     pbData[playerid][Bomb] = 0;
  177.     return 1;
  178. }
  179.  
  180. public OnPlayerDeath(playerid, killerid, reason)
  181. {
  182.     if(pbData[playerid][BombEx] == true){
  183.         SendClientMessage(playerid, Red, "[EO_INFO]: The Bomb you planted has been deactivated");
  184.     }
  185.     pbData[playerid][BombEx] = false;
  186.     pbData[playerid][BombC4] = false;
  187.     pbData[playerid][AtBomb] = false;
  188.     pbData[playerid][Bomb] = 0;
  189.     DestroyObject(pBomb[playerid]);
  190.     return 1;
  191. }
  192.  
  193. public OnVehicleSpawn(vehicleid)
  194. {
  195.     return 1;
  196. }
  197.  
  198. public OnVehicleDeath(vehicleid, killerid)
  199. {
  200.     return 1;
  201. }
  202.  
  203. public OnPlayerText(playerid, text[])
  204. {
  205.     return 1;
  206. }
  207.  
  208. CMD:makeevm(playerid, params[]){
  209.     new Float:x, Float:y, Float:z, Float:r;
  210.     GetPlayerFacingAngle(playerid, r);
  211.     GetPlayerPos(playerid, x, y, z);
  212.     if(IsPlayerAdmin(playerid)){
  213.         if(!IsPlayerInAnyVehicle(playerid)){
  214.             CreateObject(18885, x+1, y, z, 0.0, 0.0, -r);
  215.             SendClientMessage(playerid, 0xFFFF00, "[EO_EVM]: {FFFFFF}Explosives Vending Machine successfully created!");
  216.             return 1;
  217.         }
  218.         else{
  219.             SendClientMessage(playerid, 0xFF0000, "[ERROR]: You can't use this while in a vehicle");
  220.         }
  221.     }
  222.     else{
  223.         SendClientMessage(playerid, 0xFF0000AA, "[ERROR]: You can't use this command");
  224.     }
  225.     return 1;
  226. }
  227.  
  228.  
  229.  
  230. //explosives stats
  231. CMD:estats(playerid, params[]){
  232.     if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: You are not connected to the server");
  233.     new pname[MAX_PLAYER_NAME], str[250];
  234.     GetPlayerName(playerid, pname, sizeof(pname));
  235.     format(str, sizeof(str), "{CCCCFF}%s{FFFFFF}\n\nBombs: %i\tTiming Bombs: %i\tC4: %i\tCar Bomb: %i\nAtomic Bomb: %i",pname, pbData[playerid][Bomb],pbData[playerid][TBomb],pbData[playerid][C4],pbData[playerid][CBomb],pbData[playerid][ABomb]);
  236.     ShowPlayerDialog(playerid, DIALOG_EVMPSTATS, DIALOG_STYLE_MSGBOX, "EO_Explosive Stats", str, "Got it!", "");
  237.     return 1;
  238. }
  239. //Explosives help index
  240. CMD:ehelp(playerid, params[]){
  241.     if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: You are not connected to the server");
  242.     new str[1000];
  243.     strcat(str,"{FFFF00}Bomb: {FFFFFF}A 3 seconds timed bomb with a normal exploding radius, it can be used via /plantbomb\n");
  244.     strcat(str,"{FFFF00}Timing Bomb: {FFFFFF} It's a bomb whose detonation is triggered by a timer which has to be closed in 3 to 60 seconds,\n it can be used via /planttbomb\n");
  245.     strcat(str,"{FFFF00}C4: {FFFFFF}A Remote-controlled bomb, which can be setup somewhere using /plantc4 then detonated via /detonate\n");
  246.     strcat(str,"{FFFF00}Car Bomb: {FFFFFF}A Vehicle related bomb, in order to use it, you be inside of a vehicle, then use /plantvehbomb , after that, you will have to leave the vehicle immediately,\n the bomb will be activated within 3 seconds, and anybody who enters the vehicle by then, will be exploded\n");
  247.     strcat(str,"{FFFF00}Atomic Bomb: {FFFFFF} A bomb that derives its destructive power from the rapid release of nuclear energy, in ordet to use it you have to choose a position, then use /setabpos \nand to activate it, you have to be in a Pony or a Burrito and use /launchab");
  248.     ShowPlayerDialog(playerid, DIALOG_EHELP, DIALOG_STYLE_MSGBOX, "EO_Explosives Help Section", str, "Got it","");
  249.     return 1;
  250. }
  251.  
  252.  
  253.  
  254.  
  255. CMD:evmshop(playerid, params[]){
  256.     if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: You are not connected to the server");
  257.     ShowPlayerDialog(playerid, DIALOG_EVMINDEX, DIALOG_STYLE_LIST, "EO_Explosive Shop",
  258.     "Bomb\n\
  259.     Timing bomb\n\
  260.     C4\n\
  261.     Car bomb\n\
  262.     Atomic bomb"
  263.     ,"Select", "Cancel");
  264.     return 1;
  265. }
  266.  
  267.  
  268. //////////////////////////   BOMBS    ////////////////////////////////////////
  269.  
  270. //Bomb
  271. CMD:plantbomb(playerid, params[]){
  272.     if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: You are not connected to the server");
  273.     if(pbData[playerid][Bomb] == 0) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: You don't have a bomb");
  274.     if(pbData[playerid][BombUse] == false) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: Wait before using another bomb");
  275.     GetPlayerPos(playerid, gC[0], gC[1], gC[2]);
  276.     pBomb[playerid] = CreateObject(1252, gC[0], gC[1], gC[2], 0.0, 0.0,0.0);
  277.     pBombPos[playerid][0] = gC[0];
  278.     pBombPos[playerid][1] = gC[1];
  279.     pBombPos[playerid][2] = gC[2];
  280.     pBombTimer[playerid] = SetTimerEx("BombTimer", 3000, false, "i", playerid);
  281.     pbData[playerid][BombUse] = false;
  282.     pbData[playerid][Bomb]--;
  283.     pbData[playerid][BombEx] = true;
  284.     return 1;
  285. }
  286. //Timming Bomb
  287. CMD:planttbomb(playerid, params[]){
  288.     if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: You are not connected to the server");
  289.     if(pbData[playerid][TBomb] == 0) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: You don't have a timing bomb");
  290.     if(pbData[playerid][BombUse] == false) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: Wait before using another bomb");
  291.     ShowPlayerDialog(playerid, DIALOG_TBomb, DIALOG_STYLE_INPUT, "Timing Bomb","Setup the seconds of the bomb to explode", "Setup", "Cancel");
  292.     return 1;
  293. }
  294. //C4
  295. CMD:plantc4(playerid, params[]){
  296.     if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: You are not connected to the server");
  297.     if(pbData[playerid][C4] == 0) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: You don't have a C4");
  298.     if(pbData[playerid][BombUse] == false) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: Wait before using another bomb");
  299.     GetPlayerPos(playerid, gC[0], gC[1], gC[2]);
  300.     pBomb[playerid] = CreateObject(1252, gC[0], gC[1], gC[2]-1, 0.0, 0.0,0.0);
  301.     pBombPos[playerid][0] = gC[0];
  302.     pBombPos[playerid][1] = gC[1];
  303.     pBombPos[playerid][2] = gC[2];
  304.     pbData[playerid][BombUse] = false;
  305.     pbData[playerid][C4]--;
  306.     SendClientMessage(playerid, Blren, "[EO_INFO]: {FFFFFF}You can use {FFFF00}/detonate {FFFFFF}to activate the C4");
  307.     pbData[playerid][BombEx] = true;
  308.     pbData[playerid][BombC4] = true;
  309.     return 1;
  310. }
  311. CMD:detonate(playerid, params[]){
  312.     if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: You are not connected to the server");
  313.     if(pbData[playerid][BombC4] == false) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: There is no C4 to blowup");
  314.     SendClientMessage(playerid, Blren, "[EO_INFO]: {FFFFFF}You have detonated the C4");
  315.     CreateExplosion(pBombPos[playerid][0],pBombPos[playerid][1], pBombPos[playerid][2], 1, 5);
  316.     pbData[playerid][BombUse] = false;
  317.     SetTimerEx("BombBrakeTimer", BrakingTimer, false, "i", playerid);
  318.     DestroyObject(pBomb[playerid]);
  319.     pbData[playerid][BombC4] = false;
  320.     pbData[playerid][BombEx] = false;
  321.     return 1;
  322. }
  323. //Car bomb
  324. CMD:plantvehbomb(playerid, params[]){
  325.     new vehicleid = GetPlayerVehicleID(playerid);
  326.     if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: You are not connected to the server");
  327.     if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: You have to be in a vehicle to use this!");
  328.     if(pbData[playerid][CBomb] == 0) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: You don't have a Car bomb");
  329.     if(pbData[playerid][BombUse] == false) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: Wait before using another bomb");
  330.     vbData[vehicleid][CarBomb] = true;
  331.     SendClientMessage(playerid, Blren, "[EO_INFO]: You have planted a car bomb in this vehicle");
  332.     SendClientMessage(playerid, Blren, "[EO_INFO]: The car bomb will be activated if anyone attempts to drive it");
  333.     pbData[playerid][BombEx] = true;
  334.     pbData[playerid][BombUse] = false;
  335.     return 1;
  336. }
  337. //Atomic bomb
  338. CMD:setabpos(playerid, params[]){
  339.     if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: You are not connected to the server");
  340.     if(pbData[playerid][ABomb] == 0) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: You don't have an Atomic bomb");
  341.     if(pbData[playerid][BombUse] == false) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: Wait before using another bomb");
  342.     GetPlayerPos(playerid, gC[0], gC[1], gC[2]);
  343.     pABombPos[playerid][0] = gC[0];
  344.     pABombPos[playerid][1] = gC[1];
  345.     pABombPos[playerid][2] = gC[2]+100;
  346.     pbData[playerid][BombUse] = false;
  347.     pbData[playerid][ABomb]--;
  348.     pbData[playerid][BombEx] = true;
  349.     pbData[playerid][AtBomb] = true;
  350.     SendClientMessage(playerid, Blren, "[EO_INFO]: {FFFFFF}The atomic bomb impact position has been set!");
  351.     return 1;
  352. }
  353. CMD:launchab(playerid,params[]){
  354.     if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: You are not connected to the server");
  355.     if(pbData[playerid][AtBomb] == false) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: There is no posetion set to activate the atomic bomb");
  356.     pBomb[playerid] = CreateObject(3786, pABombPos[playerid][0], pABombPos[playerid][1], pABombPos[playerid][2], 0.0,-90,0.0);
  357.     MoveObject(pBomb[playerid],pABombPos[playerid][0], pABombPos[playerid][1], pABombPos[playerid][2]-100,30,0.0,-90,0.0);
  358.     SendClientMessage(playerid, Blren, "[EO_INFO]: {FFFFFF}The atomic bomb has been launched");
  359.     pABICheck[playerid] = SetTimer("atomicbombimpact", 100, true);
  360.     return 1;
  361. }
  362. public atomicbombimpact(playerid){
  363.     new Float:ax,Float:ay,Float:az;
  364.     GetObjectPos(pBomb[playerid],ax, ay, az);
  365.     if(ax == pABombPos[playerid][0] && ay == pABombPos[playerid][1] && az == pABombPos[playerid][2]-100){
  366.         CreateExplosion(pABombPos[playerid][0]+10,pABombPos[playerid][1]+5, pABombPos[playerid][2]-100, 2, 20);
  367.         CreateExplosion(pABombPos[playerid][0]+3,pABombPos[playerid][1]+2, pABombPos[playerid][2]-100, 3, 20);
  368.         CreateExplosion(pABombPos[playerid][0]-10,pABombPos[playerid][1], pABombPos[playerid][2]-100, 4, 20);
  369.         CreateExplosion(pABombPos[playerid][0],pABombPos[playerid][1]+8, pABombPos[playerid][2]-100, 1, 20);
  370.         CreateExplosion(pABombPos[playerid][0],pABombPos[playerid][1], pABombPos[playerid][2]-100, 2, 20);
  371.         CreateExplosion(pABombPos[playerid][0]+12,pABombPos[playerid][1]+4, pABombPos[playerid][2]-100, 2, 20);
  372.         CreateExplosion(pABombPos[playerid][0]+10,pABombPos[playerid][1]-6, pABombPos[playerid][2]-100, 2, 20);
  373.         CreateExplosion(pABombPos[playerid][0],pABombPos[playerid][1], pABombPos[playerid][2]-100, 13, 20);
  374.         CreateExplosion(pABombPos[playerid][0],pABombPos[playerid][1]+2, pABombPos[playerid][2]-100, 6, 20);
  375.        
  376.         CreateExplosion(pABombPos[playerid][0]-10,pABombPos[playerid][1]-5, pABombPos[playerid][2]-100, 2, 20);
  377.         CreateExplosion(pABombPos[playerid][0]-3,pABombPos[playerid][1]-2, pABombPos[playerid][2]-100, 3, 20);
  378.         CreateExplosion(pABombPos[playerid][0]+10,pABombPos[playerid][1], pABombPos[playerid][2]-100, 4, 20);
  379.         CreateExplosion(pABombPos[playerid][0],pABombPos[playerid][1]-8, pABombPos[playerid][2]-100, 1, 20);
  380.         CreateExplosion(pABombPos[playerid][0]+20,pABombPos[playerid][1], pABombPos[playerid][2]-100, 2, 20);
  381.         CreateExplosion(pABombPos[playerid][0]-12,pABombPos[playerid][1]-4, pABombPos[playerid][2]-100, 2, 20);
  382.         CreateExplosion(pABombPos[playerid][0]-10,pABombPos[playerid][1]+6, pABombPos[playerid][2]-100, 2, 20);
  383.         CreateExplosion(pABombPos[playerid][0],pABombPos[playerid][1]-2, pABombPos[playerid][2]-100, 7, 20);
  384.        
  385.         CreateExplosion(pABombPos[playerid][0]-15,pABombPos[playerid][1]-15, pABombPos[playerid][2]-100, 2, 20);
  386.         CreateExplosion(pABombPos[playerid][0]-13,pABombPos[playerid][1]-20, pABombPos[playerid][2]-100, 3, 20);
  387.         CreateExplosion(pABombPos[playerid][0]+15,pABombPos[playerid][1], pABombPos[playerid][2]-100, 4, 20);
  388.         CreateExplosion(pABombPos[playerid][0],pABombPos[playerid][1]-18, pABombPos[playerid][2]-100, 1, 20);
  389.         CreateExplosion(pABombPos[playerid][0]+18,pABombPos[playerid][1], pABombPos[playerid][2]-100, 2, 20);
  390.         CreateExplosion(pABombPos[playerid][0]-22,pABombPos[playerid][1]-24, pABombPos[playerid][2]-100, 2, 20);
  391.         CreateExplosion(pABombPos[playerid][0]-20,pABombPos[playerid][1]+16, pABombPos[playerid][2]-100, 2, 20);
  392.        
  393.         CreateExplosion(pABombPos[playerid][0]+30,pABombPos[playerid][1]+30, pABombPos[playerid][2]-100, 6, 20);
  394.         CreateExplosion(pABombPos[playerid][0]-30,pABombPos[playerid][1]+30, pABombPos[playerid][2]-100, 6, 20);
  395.         CreateExplosion(pABombPos[playerid][0]+30,pABombPos[playerid][1]+0, pABombPos[playerid][2]-100, 6, 20);
  396.         CreateExplosion(pABombPos[playerid][0]-30,pABombPos[playerid][1]+10, pABombPos[playerid][2]-100, 6, 20);
  397.         CreateExplosion(pABombPos[playerid][0]-30,pABombPos[playerid][1]-30, pABombPos[playerid][2]-100, 6, 20);
  398.         CreateExplosion(pABombPos[playerid][0]+20,pABombPos[playerid][1]-30, pABombPos[playerid][2]-100, 6, 20);
  399.        
  400.         DestroyObject(pBomb[playerid]);
  401.         for(new i=0;i<=MAX_PLAYERS;i++){
  402.             if(!IsPlayerConnected(i)) continue;
  403.             if(IsPlayerInRangeOfPoint(i,100,pABombPos[playerid][0],pABombPos[playerid][1], pABombPos[playerid][2]-100)){
  404.                 SetPlayerDrunkLevel (playerid, 5000);
  405.                 SetPlayerArmour(i,0);
  406.                 SetPlayerHealth(i,0);
  407.             }
  408.         }
  409.     }
  410. }
  411. ////////////////////////////////  TIMERS   //////////////////////////////////////
  412.  
  413. //Time to explode
  414. public BombTimer(playerid){
  415.     KillTimer(pBombTimer[playerid]);
  416.     CreateExplosion(pBombPos[playerid][0],pBombPos[playerid][1], pBombPos[playerid][2], 1, 5);
  417.     pbData[playerid][BombUse] = false;
  418.     SetTimerEx("BombBrakeTimer", BrakingTimer, false, "i", playerid);
  419.     DestroyObject(pBomb[playerid]);
  420.     pbData[playerid][BombEx] = false;
  421. }
  422. //Timed bomb exploding timer
  423. public TimingBombTimer(playerid){
  424.     if(pbData[playerid][BombEx] == true){
  425.         KillTimer(pBombTimer[playerid]);
  426.         CreateExplosion(pBombPos[playerid][0],pBombPos[playerid][1], pBombPos[playerid][2], 1, 5);
  427.         pbData[playerid][BombEx] = false;
  428.         DestroyObject(pBomb[playerid]);
  429.     }
  430. }
  431. //Car bomb clearing
  432. public VehicleCarBombClear(vehicleid){
  433.     new str[250],Count=0;
  434.     for(new i=0; i<=MAX_VEHICLES;i++){
  435.         if(vbData[i][CarBomb] == true) return Count++;
  436.         vbData[i][CarBomb] = false;
  437.     }
  438.     format(str,sizeof(str), "[EO_INFO]: {FFFFFF}All vehicle bombs were cleared, {FFFF00}(total: %i)",Count);
  439.     SendClientMessageToAll(Blren, str);
  440.     return 1;
  441. }
  442. /////////////////////////// Brake Timer    ///////////////////////////////////
  443. forward BombBrakeTimer(playerid);
  444. public BombBrakeTimer(playerid){
  445.     pbData[playerid][BombUse] = true;
  446. }
  447.  
  448.  
  449. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  450. {
  451.     new Float:x, Float:y, Float:z;
  452.     if(vbData[vehicleid][CarBomb] == true){
  453.         GetVehiclePos(vehicleid, x, y, z);
  454.         SetVehicleHealth(vehicleid, 0);
  455.         CreateExplosion(x,y, z, 2, 10);
  456.         pbData[playerid][BombEx] = false;
  457.         vbData[vehicleid][CarBomb] = false;
  458.     }
  459.     return 1;
  460. }
  461.  
  462. public OnPlayerExitVehicle(playerid, vehicleid)
  463. {
  464.     return 1;
  465. }
  466.  
  467. public OnPlayerStateChange(playerid, newstate, oldstate)
  468. {
  469.     return 1;
  470. }
  471.  
  472. public OnPlayerEnterCheckpoint(playerid)
  473. {
  474.     return 1;
  475. }
  476.  
  477. public OnPlayerLeaveCheckpoint(playerid)
  478. {
  479.     return 1;
  480. }
  481.  
  482. public OnPlayerEnterRaceCheckpoint(playerid)
  483. {
  484.     return 1;
  485. }
  486.  
  487. public OnPlayerLeaveRaceCheckpoint(playerid)
  488. {
  489.     return 1;
  490. }
  491.  
  492. public OnRconCommand(cmd[])
  493. {
  494.     return 1;
  495. }
  496.  
  497. public OnPlayerRequestSpawn(playerid)
  498. {
  499.     return 1;
  500. }
  501.  
  502. public OnObjectMoved(objectid)
  503. {
  504.     return 1;
  505. }
  506.  
  507. public OnPlayerObjectMoved(playerid, objectid)
  508. {
  509.     return 1;
  510. }
  511.  
  512. public OnPlayerPickUpPickup(playerid, pickupid)
  513. {
  514.     return 1;
  515. }
  516.  
  517. public OnVehicleMod(playerid, vehicleid, componentid)
  518. {
  519.     return 1;
  520. }
  521.  
  522. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  523. {
  524.     return 1;
  525. }
  526.  
  527. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  528. {
  529.     return 1;
  530. }
  531.  
  532. public OnPlayerSelectedMenuRow(playerid, row)
  533. {
  534.     return 1;
  535. }
  536.  
  537. public OnPlayerExitedMenu(playerid)
  538. {
  539.     return 1;
  540. }
  541.  
  542. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  543. {
  544.     return 1;
  545. }
  546.  
  547. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  548. {
  549.     return 1;
  550. }
  551.  
  552. public OnRconLoginAttempt(ip[], password[], success)
  553. {
  554.     return 1;
  555. }
  556.  
  557. public OnPlayerUpdate(playerid)
  558. {
  559.     return 1;
  560. }
  561.  
  562. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  563. {
  564.     if(dialogid == DIALOG_EVMINDEX){
  565.         switch(listitem){
  566.             case 0:{
  567.                 if(GetPlayerMoney(playerid) >= TBombP){
  568.                     pbData[playerid][Bomb]++;
  569.                     GivePlayerMoney(playerid, -TBombP);
  570.                 }
  571.                 else
  572.                     SendClientMessage(playerid, 0xFF000088, "[ERROR]: {FFFFFF}You an't afford this");
  573.             }
  574.             case 1:{
  575.                 if(GetPlayerMoney(playerid) >= TBombP){
  576.                     pbData[playerid][TBomb]++;
  577.                     GivePlayerMoney(playerid, -TBombP);
  578.                 }
  579.                 else
  580.                     SendClientMessage(playerid, 0xFF000088, "[ERROR]: {FFFFFF}You an't afford this");
  581.             }
  582.             case 2:{
  583.                 if(GetPlayerMoney(playerid) >= C4P){
  584.                     pbData[playerid][C4]++;
  585.                     GivePlayerMoney(playerid, -C4P);
  586.                 }
  587.                 else
  588.                     SendClientMessage(playerid, 0xFF000088, "[ERROR]: {FFFFFF}You an't afford this");
  589.             }
  590.             case 3:{
  591.                 if(GetPlayerMoney(playerid) >= CBombP){
  592.                     pbData[playerid][CBomb]++;
  593.                     GivePlayerMoney(playerid, -CBombP);
  594.                 }
  595.                 else
  596.                     SendClientMessage(playerid, 0xFF000088, "[ERROR]: {FFFFFF}You an't afford this");
  597.             }
  598.             case 4:{
  599.                 if(GetPlayerMoney(playerid) >= ABombP){
  600.                     pbData[playerid][ABomb]++;
  601.                     GivePlayerMoney(playerid, -ABombP);
  602.                 }
  603.                 else
  604.                     SendClientMessage(playerid, 0xFF000088, "[ERROR]: {FFFFFF}You an't afford this");
  605.             }
  606.         }
  607.     }
  608.     if(dialogid == DIALOG_TBomb){
  609.         if(strval(inputtext)>60 || strval(inputtext)<3) return SendClientMessage(playerid, 0xFF000088, "[ERROR]: The seconds value must be closed between 3 and 60");
  610.         pBombTimer[playerid] = SetTimerEx("TimingBombTimer",strval(inputtext)*1000, false, "i", playerid);
  611.         GetPlayerPos(playerid, gC[0], gC[1], gC[2]);
  612.         pBombPos[playerid][0] = gC[0];
  613.         pBombPos[playerid][1] = gC[1];
  614.         pBombPos[playerid][2] = gC[2];
  615.         pBomb[playerid] = CreateObject(1252, gC[0], gC[1], gC[2], 0.0, 0.0,0.0);
  616.         pbData[playerid][TBomb]--;
  617.         pbData[playerid][BombUse] = false;
  618.         pbData[playerid][BombEx] = true;
  619.     }
  620.     return 1;
  621. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement