Advertisement
DaRk_RaiN

Toxic Bomb, SAMP

Dec 6th, 2012
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.47 KB | None | 0 0
  1. // This is a Toxic script by DaRk_RaiN
  2. //Change any part of the script to be suitable 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.  
  26. //================================
  27.  
  28. public OnFilterScriptInit()
  29. {
  30. print("\n=======================================");
  31. print(" Toxic Bomb script by DaRk_RaiN loaded v1.0");
  32. print("=======================================\n");
  33. return 1;
  34. }
  35.  
  36. public OnFilterScriptExit()
  37. {
  38. Seifader_OnExit();
  39. print("\n--------------------------------------");
  40. print(" Toxic script by DaRk_RaiN Unloaded");
  41. print("--------------------------------------\n");
  42. return 1;
  43. }
  44. #endif
  45.  
  46. //================[Modifications when player connects]================
  47.  
  48. public OnPlayerConnect(playerid)
  49. {
  50. 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.
  51. GangZoneShowForPlayer(playerid,NukeZone,COLOR_RED);
  52. 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)
  53. 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)
  54. SendClientMessage(playerid,COLOR_LIGHTBLUE,"Toxic bomb script by DaRk_RaiN use {FF8000}/area{80FF80}(to show the Toxic Bomb launch area)");
  55. SendClientMessage(playerid,COLOR_LIGHTBLUE," {FF8000}/Zone {80FF80}(to show the Target zone and {FF8000}/money{80FF80} (for testings))");
  56. SendClientMessage(playerid,COLOR_LIGHTBLUE,"{FF8000}/Money {80FF80}(to get 50.000$ for testing)");
  57. return 1;
  58. }
  59.  
  60. //================[When the player spawns]================
  61.  
  62. public OnPlayerSpawn(playerid)
  63. {
  64. SetPlayerWeather(playerid,5);
  65. return 1;
  66. }
  67. //================[Making all the variables none affective when player disconnects to avoid bugs]================
  68.  
  69. public OnPlayerDisconnect(playerid, reason)
  70. {
  71. UseNuke[playerid]=0;//Avoiding bugs
  72. NukeUser[playerid]=0;
  73. NukeVictim[playerid]=0;
  74. return 1;
  75. }
  76. //================[When the player dies, this happenes]================
  77.  
  78. public OnPlayerDeath(playerid, killerid, reason)
  79. {
  80. if(NukeVictim[playerid] == 1)//proventing OnPlayerDeath to send death message as the victim suisided
  81. {
  82. SetPlayerChatBubble(playerid, "Toxic Bomb Vicim", COLOR_RED, 100.0, 2000);
  83. GameTextForPlayer(playerid,"~r~~d~.::Choked::.~d~",1500,0);
  84. for(new i = 0; i < MAX_PLAYERS; i++)
  85. if(NukeUser[i] ==1)//for each victim the nuke user gets 3 scores
  86. {
  87. GivePlayerScore(i,3);
  88. }
  89. return 1;
  90. }
  91. SetPlayerWeather(playerid,5);
  92. return 1;
  93. }
  94.  
  95. public OnPlayerCommandText(playerid, cmdtext[])
  96. {
  97.  
  98. //All these commands are for testing if you don't like them just erace.
  99.  
  100. if (strcmp("/Money", cmdtext, true, 10) == 0)
  101. {
  102. GivePlayerMoney(playerid, 50000);
  103. return 1;
  104. }
  105. if (strcmp("/Area", cmdtext, true, 10) == 0)
  106. {
  107. SetPlayerPos(playerid, 1579.8275,-1635.1654,13.5612);
  108. return 1;
  109. }
  110. if (strcmp("/zone", cmdtext, true, 10) == 0)
  111. {
  112. SetPlayerPos(playerid, 2486.5623,-1670.7930,13.3359);
  113. return 1;
  114. }
  115. return 0;
  116. }
  117. //================[When the player enters the Toxic bomb check point]================
  118.  
  119. public OnPlayerEnterDynamicCP(playerid, checkpointid)
  120. {
  121. if(checkpointid == NukeCp)
  122. {
  123. if(IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,COLOR_RED,"*You need to leave the vehicle first");
  124. if(UseNuke[playerid] == 1)return SendClientMessage(playerid,COLOR_RED,"*You can't send a Toxic Bomb again, wait until feather notice");
  125. if(GetPlayerMoney(playerid) <49999)return SendClientMessage(playerid, COLOR_RED, "You don't have enough money to launch{408080} Toxic Bomb(50.000$)");
  126. 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");
  127. return 1;
  128. }
  129. return 1;
  130. }
  131. //================[When the player leaves the checkpoint]================
  132.  
  133. public OnPlayerLeaveDynamicCP(playerid, checkpointid)
  134. {
  135. if(checkpointid == NukeCp)
  136. {
  137. return 1;
  138. }
  139. return 1;
  140. }
  141.  
  142. //================[The Toxic bomb dialog response]================
  143.  
  144. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  145. {
  146. new text[128];
  147. if(dialogid == 555 && response)//the dialog response
  148. {
  149. SendClientMessage(playerid,COLOR_RED,"You have launched a {FF8040}Toxic Bomb");
  150. format(text, sizeof(text), "====[{80FFFF}%s]{FF0000} has launched a{FF8040} Toxic Bomb====", Name(playerid));
  151. GameTextForAll("~r~Toxic Bomb landing in~n~~b~5 Sconds",5000,0);
  152. SendClientMessageToAll(COLOR_RED, text);
  153. UseNuke[playerid] =1;
  154. NukeUser[playerid] =1;
  155. SetTimerEx("Nuke1", 5000, 0, "i", playerid);
  156. SetTimerEx("Nuke2", 10000, 0, "i", playerid);
  157. SetTimerEx("KillAll", 12500, 0, "i", playerid);
  158. SetTimerEx("Again", 1000, 0, "i", playerid);
  159. SetTimerEx("Camera", 14000, 0, "i", playerid);//2 minutes before using nuke again
  160. }
  161. return 1;
  162. }
  163.  
  164. //================[The first timer]================
  165.  
  166. forward Nuke1(playerid);//In this part we flash the player screen
  167. public Nuke1(playerid)
  168. {
  169. for(new i = 0; i < MAX_PLAYERS; i++)//looping the players
  170. {
  171. if(IsPlayerInRangeOfPoint(i,100,2486.5623,-1670.7930,13.3359))
  172. {
  173. FlashPlayerScreen(i, COLOR_RED, 6,1);
  174. }
  175. }
  176. }
  177.  
  178. //================[The second timer]================
  179.  
  180. forward Nuke2(playerid);//Here we set his weather and edit the animation
  181. public Nuke2(playerid)
  182. {
  183. SetPlayerWeather(playerid, 165);
  184. for(new i = 0; i < MAX_PLAYERS; i++)
  185. {
  186. if(IsPlayerInRangeOfPoint(i,100,2486.5623,-1670.7930,13.3359))
  187. {
  188. SetPlayerWeather(i, 165);
  189. ApplyAnimation(i,"PED","KO_shot_stom",4.0,0,1,1,1,0);
  190. }
  191. }
  192. }
  193.  
  194. //================[The timer that wills every one, and sends the death message]================
  195.  
  196. forward KillAll(playerid);//Well you know what this does xD
  197. public KillAll(playerid)
  198. {
  199. for(new i = 0; i < MAX_PLAYERS; i++)
  200. {
  201. if(IsPlayerInRangeOfPoint(i,100,2486.5623,-1670.7930,13.3359))//Checks if the player is in area
  202. {
  203. SetPlayerHealth(i, 0);
  204. NukeVictim[i]= 1;//Variable to detect if he is a toxic bomb victim
  205. }
  206. if(NukeUser[playerid] == 1 && NukeVictim[i] ==1)//Sending the death message
  207. {
  208. SendDeathMessage(playerid, i, 41);
  209. SetTimer("Autho", 5000, 0);
  210. }
  211. }
  212. }
  213. //================[To stop any bug from appearing]================
  214.  
  215. forward Autho();//Avoid bugs when player dies
  216. public Autho()
  217. {
  218. for(new i = 0; i < MAX_PLAYERS; i++)
  219. {
  220. NukeVictim[i] = 0;
  221. NukeUser[i] = 0;
  222. }
  223. return 1;
  224. }
  225. //================[Make the player wait for two minutes before launching an other bomb]================
  226.  
  227. forward Again(playerid);//to provent abuse of the toxic bomb
  228. public Again(playerid)
  229. {
  230. SendClientMessage(playerid,COLOR_GOLD,"You now can launch a {FF8040}Toxic Bomb {FFFF00}again.");
  231. UseNuke[playerid] =0;
  232. }
  233. //================[Stocks]================
  234.  
  235. stock GivePlayerScore(playerid, score)//Stock for giving cash to player
  236. {
  237. SetPlayerScore(playerid, GetPlayerScore(playerid)+score);
  238. return 1;
  239. }
  240. stock Name(playerid)//Simple stock for player name
  241. {
  242. new name[MAX_PLAYER_NAME];
  243. GetPlayerName(playerid, name, sizeof(name));
  244. return name;
  245. }
  246. //end 246 lines
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement