Advertisement
DaRk_RaiN

Toxic Bomb, SAMP, 1.1V

Dec 22nd, 2012
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 8.43 KB | None | 0 0
  1. // This is a Toxic script by DaRk_RaiN
  2. //Change any part of the script to be sutable for you.
  3. #define FILTERSCRIPT
  4. //================[Includes]================
  5.  
  6. #include <a_samp>
  7. #include <streamer>
  8. #include <fader>
  9. #include <COLORS>
  10.  
  11. //================[Defines]================
  12.  
  13. #if defined FILTERSCRIPT
  14.  
  15. //================[Variables]================
  16.  
  17. new UseNuke[MAX_PLAYERS];
  18. new NukeUser[MAX_PLAYERS];
  19. new NukeVictim[MAX_PLAYERS];
  20.  
  21. //================================
  22.  
  23. new NukeCp;
  24. new NukeZone;
  25. new Missile;
  26. //========[For the countdown]=======
  27. new CDT = 6;
  28. new CountDownTime;
  29. //================================
  30.  
  31. public OnFilterScriptInit()
  32. {
  33.     print("\n=======================================");
  34.     print(" Toxic Bomb script by DaRk_RaiN loaded v1.1");
  35.     print("=======================================\n");
  36.     return 1;
  37. }
  38.  
  39. public OnFilterScriptExit()
  40. {
  41.     Seifader_OnExit();
  42.     print("\n--------------------------------------");
  43.     print(" Toxic Bomb script by DaRk_RaiN Unloaded");
  44.     print("--------------------------------------\n");
  45.     return 1;
  46. }
  47. #endif
  48.  
  49. //================[Modifications when player connects]================
  50.  
  51. public OnPlayerConnect(playerid)
  52. {
  53.     NukeZone = GangZoneCreate(2440.3601, -1623.2374,2541.6348,-1721.8169);//This is a gang zone i added to make the detection of the target place easy.
  54.     GangZoneShowForPlayer(playerid,NukeZone,COLOR_RED);
  55.     SetPlayerMapIcon(playerid,547,1579.8275,-1635.1654,13.5612,23,COLOR_RED,MAPICON_GLOBAL);//change the x y z if you wanna use the nuke somewhere else(map icon)
  56.     NukeCp = CreateDynamicCP(1579.8275,-1635.1654,13.5612, 1.0, -1, -1, -1, 100);//change the x y z if you wanna use the nuke somewhere else(Checkpoint)
  57.     SendClientMessage(playerid,COLOR_LIGHTBLUE,"Toxic bomb script by DaRk_RaiN use {FF8000}/area{80FF80}(to show the Toxic Bomb launch area)");
  58.     SendClientMessage(playerid,COLOR_LIGHTBLUE," {FF8000}/Zone {80FF80}(to show the Target zone and {FF8000}/money{80FF80} (for testings))");
  59.     SendClientMessage(playerid,COLOR_LIGHTBLUE,"{FF8000}/Money {80FF80}(to get 50.000$ for testing)");
  60.     return 1;
  61. }
  62.  
  63. //================[When the player spawns]================
  64.  
  65. public OnPlayerSpawn(playerid)
  66. {
  67.     SetPlayerWeather(playerid,5);
  68.     return 1;
  69. }
  70. //================[Making all the variables none affective when player disconnects to avoid bugs]================
  71.  
  72. public OnPlayerDisconnect(playerid, reason)
  73. {
  74.     UseNuke[playerid]=0;//Avoiding bugs
  75.     NukeUser[playerid]=0;
  76.     NukeVictim[playerid]=0;
  77.     return 1;
  78. }
  79. //================[When the player dies, this happenes]================
  80.  
  81. public OnPlayerDeath(playerid, killerid, reason)
  82. {
  83.     if(NukeVictim[playerid] == 1)//proventing OnPlayerDeath to send death message as the victim suisided
  84.     {
  85.     SetPlayerChatBubble(playerid, "Toxic Bomb Vicim", COLOR_RED, 100.0, 2000);
  86.     GameTextForPlayer(playerid,"~r~~d~.::Choked::.~d~",1500,0);
  87.     for(new i = 0; i < MAX_PLAYERS; i++)
  88.     if(NukeUser[i] ==1)//for each victim the nuke user gets 3 scores
  89.     {
  90.     GivePlayerScore(i,3);
  91.     }
  92.     return 1;
  93.     }
  94.     SetPlayerWeather(playerid,5);
  95.     return 1;
  96. }
  97.  
  98. public OnPlayerCommandText(playerid, cmdtext[])
  99. {
  100.  
  101. //All these commands are for testing if you don't like them just erace.
  102.  
  103.     if (strcmp("/Money", cmdtext, true, 10) == 0)
  104.     {
  105.     GivePlayerMoney(playerid, 50000);
  106.     return 1;
  107.     }
  108.     if (strcmp("/Area", cmdtext, true, 10) == 0)
  109.     {
  110.     SetPlayerPos(playerid, 1579.8275,-1635.1654,13.5612);
  111.     return 1;
  112.     }
  113.     if (strcmp("/zone", cmdtext, true, 10) == 0)
  114.     {
  115.     SetPlayerPos(playerid, 2486.5623,-1670.7930,13.3359);
  116.     return 1;
  117.     }
  118.     return 0;
  119. }
  120. //================[When the player enters the Toxic bomb check point]================
  121.  
  122. public OnPlayerEnterDynamicCP(playerid, checkpointid)
  123. {
  124.     if(checkpointid == NukeCp)
  125.     {
  126.     if(IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,COLOR_RED,"*You need to leave the vehicle first");
  127.     if(UseNuke[playerid] == 1)return SendClientMessage(playerid,COLOR_RED,"*You can't send a Toxic Bomb again, wait until feather notice");
  128.     if(GetPlayerMoney(playerid) <49999)return SendClientMessage(playerid, COLOR_RED, "You don't have enough money to launch{408080} Toxic Bomb(50.000$)");
  129.     ShowPlayerDialog(playerid,555,DIALOG_STYLE_MSGBOX,"{800080}Nuke Area","Do you really want to buy and launch a {FF0000}Toxic Bomb?{0080C0} Cost:50.000$","Yes","No");
  130.     return 1;
  131. }
  132.     return 1;
  133. }
  134. //================[When the player leaves the checkpoint]================
  135.  
  136. public OnPlayerLeaveDynamicCP(playerid, checkpointid)
  137. {
  138.     if(checkpointid == NukeCp)
  139.     {
  140.     return 1;
  141. }
  142.     return 1;
  143. }
  144.  
  145. //================[The Toxic bomb dialog response]================
  146.  
  147. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  148. {
  149.     new text[128];
  150.     if(dialogid == 555 && response)//the dialog response
  151.     {
  152.     SendClientMessage(playerid,COLOR_RED,"You have launched a {FF8040}Toxic Bomb");
  153.     format(text, sizeof(text), "====[{80FFFF}%s]{FF0000} has launched a{FF8040} Toxic Bomb====", Name(playerid));
  154.     SendClientMessageToAll(COLOR_RED, text);
  155.     UseNuke[playerid] =1;
  156.     NukeUser[playerid] =1;
  157.     CountDownTime = SetTimer("CountDown", 1000, 0);//The countdown timer
  158.     SetTimerEx("Nuke1", 5000, 0, "i", playerid);
  159.     SetTimer("Nuke01", 5500, 0);
  160.     SetTimerEx("Nuke2", 10000, 0, "i", playerid);
  161.     SetTimerEx("KillAll", 12500, 0, "i", playerid);
  162.     SetTimerEx("Again", 60*1000, 0, "i", playerid);
  163.     CountDownTime = SetTimer("Countdown",900,1);
  164.     SetTimerEx("Weather", 14000, 0, "i", playerid);//2 minutes before using nuke again
  165.     }
  166.     return 1;
  167. }
  168.  
  169. //================[Countdown system]================
  170. forward Weather(playerid);
  171. public Weather(playerid)
  172. {
  173. SetPlayerWeather(playerid,5);
  174. }
  175. forward Countdown();
  176. public Countdown()
  177. {
  178.      CDT--;
  179.      new string[128];
  180.      if(CDT == 0)
  181.      {
  182.      KillTimer(CountDownTime);
  183.      GameTextForAll("~r~Boom!",1000,6);
  184.      CDT = 6;
  185.      }
  186.      else
  187.      {
  188.  
  189.            format(string, sizeof(string), "~r~Bomb landing in:~b~%d", CDT);
  190.            GameTextForAll(string, 1000, 6);
  191.      }
  192.      return 1;
  193. }
  194. //================[The first timer]================
  195. forward Nuke1(playerid);//In this part we flash the player screen
  196. public Nuke1(playerid)
  197. {
  198.     for(new i = 0; i < MAX_PLAYERS; i++)//looping the players
  199.     {
  200.     if(IsPlayerInRangeOfPoint(i,100,2486.5623,-1670.7930,13.3359))
  201.     {
  202.     FlashPlayerScreen(i, COLOR_RED, 6,1);
  203.     }
  204.     }
  205.     Missile = CreateObject(3786, 2491.45, -1668.08, 45.91,   0.00, -90.00, 0.00);
  206.     MoveObject(Missile,2491.45, -1668.08, 13.45,50 , 0.00, -90.00, 0.51);
  207. }
  208.  
  209. //================[The second timer]================
  210.  
  211. forward Nuke2(playerid);//Here we set his weather and edit the animation
  212. public Nuke2(playerid)
  213. {
  214.     SetPlayerWeather(playerid, 165);
  215.     for(new i = 0; i < MAX_PLAYERS; i++)
  216.     {
  217.     if(IsPlayerInRangeOfPoint(i,100,2486.5623,-1670.7930,13.3359))
  218.     {
  219.     SetPlayerWeather(i, 165);
  220.     ApplyAnimation(i,"PED","KO_shot_stom",4.0,0,1,1,1,0);
  221.     }
  222.     }
  223. }
  224. forward Nuke01(playerid);//The explosion..
  225. public Nuke01(playerid)
  226. {
  227.     CreateExplosion(2491.45, -1668.08, 13.45,6,1);
  228.     DestroyObject(Missile);
  229. }
  230.  
  231. //================[The timer that kills every one, and sends the death message]================
  232.  
  233. forward KillAll(playerid);//Well you know what this does xD
  234. public KillAll(playerid)
  235. {
  236.     for(new i = 0; i < MAX_PLAYERS; i++)
  237.     {
  238.     if(IsPlayerInRangeOfPoint(i,100,2486.5623,-1670.7930,13.3359))//Checks if the player is in area
  239.     {
  240.     SetPlayerHealth(i, 0);
  241.     NukeVictim[i]= 1;//Variable to detect if he is a toxic bomb victim
  242.     }
  243.     if(NukeUser[playerid] == 1 && NukeVictim[i] ==1)//Sending the death message
  244.     {
  245.     SendDeathMessage(playerid, i, 41);
  246.     SetTimer("Autho", 5000, 0);
  247.     }
  248.     }
  249. }
  250. //================[To stop any bug from appearing]================
  251.  
  252. forward Autho();//Avoid bugs when player dies
  253. public Autho()
  254.     {
  255.     for(new i = 0; i < MAX_PLAYERS; i++)
  256.     {
  257.     NukeVictim[i] = 0;
  258.     NukeUser[i] = 0;
  259.     }
  260.     return 1;
  261. }
  262. //================[Make the player wait for two minutes before launching an other bomb]================
  263.  
  264. forward Again(playerid);//to provent abuse of the toxic bomb
  265. public Again(playerid)
  266. {
  267.     SendClientMessage(playerid,COLOR_GOLD,"You now can launch a {FF8040}Toxic Bomb {FFFF00}again.");
  268.     UseNuke[playerid] =0;
  269. }
  270. //================[Stocks]================
  271.  
  272. stock GivePlayerScore(playerid, score)//Stock for giving cash to player
  273. {
  274.     SetPlayerScore(playerid, GetPlayerScore(playerid)+score);
  275.     return 1;
  276. }
  277. stock Name(playerid)//Simple stock for player name
  278. {
  279.     new name[MAX_PLAYER_NAME];
  280.     GetPlayerName(playerid, name, sizeof(name));
  281.     return name;
  282. }
  283. //end 283 lines
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement