Guest User

DM Arena

a guest
Aug 31st, 2013
727
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.88 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3.  
  4. new InDMArena[MAX_PLAYERS];
  5. public OnPlayerConnect(playerid)
  6. {
  7. InDMArena[playerid] = 0;
  8. return 1;
  9. }
  10. public OnFilterScriptInit()
  11. {
  12. print("\n--------------------------------------");
  13. print(" Deathmatch Arena-By bensmart469");
  14. print("--------------------------------------\n");
  15. CreatePickup(1210,1, 2695.3411,-1704.1940,11.8438, -1);
  16. Create3DTextLabel("DM Arena\n/dmarena to enter!", 0x00FF00FF, 2695.3411,-1704.1940,11.8438, 30, -1);
  17. return 1;
  18. }
  19. CMD:dmarena(playerid,params[])
  20. {
  21. if(!IsPlayerInRangeOfPoint(playerid,2,2695.3411,-1704.1940,11.8438)) return SendClientMessage(playerid,0xFF0000FF,"You are not near the DM arena location!");
  22. ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"DM Arenas","Minigun DM\nDildo DM","Choose","Cancel");
  23. return 1;
  24. }
  25. CMD:leavedm(playerid,params[])
  26. {
  27. if(!InDMArena[playerid]) return SendClientMessage(playerid,0xFF0000FF,"You are not in a DM Arena!");
  28. SetPlayerInterior(playerid,0);
  29. SetPlayerPos(playerid,2695.3411,-1704.1940,11.8438);
  30. if(InDMArena[playerid] == 1)
  31. {
  32. ResetPlayerWeaponsEx(playerid,38);
  33. }
  34. if(InDMArena[playerid] == 2)
  35. {
  36. ResetPlayerWeaponsEx(playerid,10);
  37. }
  38. InDMArena[playerid] = 0;
  39. SendClientMessage(playerid,0xFFFFFFFF,"You left the arena, come back soon!");
  40. return 1;
  41. }
  42. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  43. {
  44. if(dialogid == 1)
  45. {
  46. if(response)
  47. {
  48. switch(listitem)
  49. {
  50. case 0:
  51. {
  52. new rand = random(4);
  53. SetPlayerInterior(playerid,1);
  54. if(rand == 0)
  55. {
  56. SetPlayerPos(playerid,936.2902,2120.2339,1011.0234);
  57. }
  58. else if(rand == 1)
  59. {
  60. SetPlayerPos(playerid,956.7552,2109.2249,1011.0234);
  61. }
  62. else if(rand == 2)
  63. {
  64. SetPlayerPos(playerid,948.3972,2173.8577,1011.0303);
  65. }
  66. else if(rand == 3)
  67. {
  68. SetPlayerPos(playerid,962.9377,2173.5430,1011.0234);
  69. }
  70. InDMArena[playerid] = 1;
  71. GivePlayerWeapon(playerid,38,10000);
  72. }
  73. case 1:
  74. {
  75. new rand = random(3);
  76. SetPlayerInterior(playerid,2);
  77. if(rand == 0)
  78. {
  79. SetPlayerPos(playerid,1205.4014,10.7419,1000.9219);
  80. }
  81. else if(rand == 1)
  82. {
  83. SetPlayerPos(playerid,1221.3037,8.2171,1001.3356);
  84. }
  85. else if(rand == 2)
  86. {
  87. SetPlayerPos(playerid,1221.2495,-14.0743,1000.9219);
  88. }
  89. InDMArena[playerid] = 2;
  90. GivePlayerWeapon(playerid,10,10000);
  91. }
  92. }
  93. }
  94. }
  95. return 0;
  96. }
  97. stock ResetPlayerWeaponsEx(playerid,...) // Credits to Kyoshiro :)
  98. {
  99. new W[] =
  100. {
  101. 0,0,1,1,1,1,1,1,1,1,10,10,10,10,10,10,8,8,
  102. 8,0,0,0,2,2,2,3,3,3,4,4,5,5,4,6,6,7,7,7,7,
  103. 8,12,9,9,9,11,11,11,11
  104. };
  105.  
  106. new
  107. idx = 0,
  108. tmp = 0,
  109. weapons,
  110. args = numargs() - 1,
  111. bool:Reset[13] = {true,...};
  112.  
  113.  
  114. if(IsPlayerConnected(playerid))
  115. {
  116. if(args > 0)
  117. {
  118. if(args <= 46)
  119. {
  120. while(args > idx++)
  121. {
  122. new wep = getarg(idx);
  123.  
  124. if(0 <= wep <= 46)
  125. {
  126. GetPlayerWeaponData(playerid,W[wep],weapons,tmp);
  127.  
  128. if(weapons == wep)
  129. {
  130. Reset[W[wep]] = false;
  131. }
  132. }
  133. else
  134. {
  135. printf("ResetPlayerWeaponEx warning: invalid argument (argument: #%d)! \"%d\" is not a valid weapon!", idx+1,wep);
  136. }
  137. }
  138.  
  139. for(new a = 0; a < 13; a ++)
  140. {
  141. if(Reset[a])
  142. {
  143. GetPlayerWeaponData(playerid,a,weapons,tmp);
  144.  
  145. if(weapons)
  146. {
  147. SetPlayerAmmo(playerid,weapons,0);
  148.  
  149. weapons = -1;
  150. }
  151. }
  152. else
  153. {
  154. Reset[a] = true;
  155. }
  156. }
  157. return 1;
  158. }
  159. print("ResetPlayerWeaponsEx Error: You have specified over 46 weapons! Check for duplicate weapons");
  160. return 1;
  161. }
  162. ResetPlayerWeapons(playerid);
  163. return 1;
  164. }
  165. return 1;
  166. }
Advertisement
Add Comment
Please, Sign In to add comment