Advertisement
Guest User

Untitled

a guest
Aug 12th, 2013
530
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.17 KB | None | 0 0
  1. #include <a_samp>
  2. #include <ZCMD>
  3. #include <sscanf2>
  4. #include <sscanf>
  5. #include <streamer>
  6.  
  7. #define COLOR_LIGHTRED 0xFF6347AA
  8. #define COLOR_ORANGE 0xFF8000FF
  9. #define COLOR_LIGHTBLUE 0x33CCFFAA
  10. #define COLOR_WHITE 0xFFFFFFAA
  11. #define COLOR_GRAD1 0xB4B5B7FF
  12. #define COLOR_GREY 0xAFAFAFAA
  13. #define COLOR_PURPLE 0xC2A2DAAA
  14.  
  15. #define CRATEGUN 1
  16.  
  17. new dynamiccrate;
  18. new Text3D:dynamiccrate3DText;
  19.  
  20. forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
  21. public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  22. {
  23. if(IsPlayerConnected(playerid))
  24. {
  25. new Float:posx, Float:posy, Float:posz;
  26. new Float:oldposx, Float:oldposy, Float:oldposz;
  27. new Float:tempposx, Float:tempposy, Float:tempposz;
  28. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  29. for(new i = 0; i < MAX_PLAYERS; i++)
  30. {
  31. if(IsPlayerConnected(i))
  32. {
  33. GetPlayerPos(i, posx, posy, posz);
  34. tempposx = (oldposx -posx);
  35. tempposy = (oldposy -posy);
  36. tempposz = (oldposz -posz);
  37. if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
  38. {
  39. if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
  40. {
  41. SendClientMessage(i, col1, string);
  42. }
  43. else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
  44. {
  45. SendClientMessage(i, col2, string);
  46. }
  47. else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
  48. {
  49. SendClientMessage(i, col3, string);
  50. }
  51. else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
  52. {
  53. SendClientMessage(i, col4, string);
  54. }
  55. else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  56. {
  57. SendClientMessage(i, col5, string);
  58. }
  59. }
  60. }
  61. }
  62. }
  63. }
  64.  
  65. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  66. {
  67. if(dialogid == CRATEGUN)
  68. {
  69. if(response) // If they clicked 'Yes' or pressed enter
  70. {
  71. if(listitem == 0) // Shotgun
  72. {
  73. GivePlayerWeapon(playerid, 25, 99999);
  74. SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a Shotgun!");
  75. }
  76. if(listitem == 1) // MP5
  77. {
  78. GivePlayerWeapon(playerid, 29, 99999);
  79. SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a MP5!");
  80. }
  81. if(listitem == 2) // Rifle
  82. {
  83. GivePlayerWeapon(playerid, 33, 99999);
  84. SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a Rifle!");
  85. }
  86. if(listitem == 3) // Desert Eagle
  87. {
  88. GivePlayerWeapon(playerid, 24, 99999);
  89. SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a Desert Eagle!");
  90. }
  91. if(listitem == 4) // AK-47
  92. {
  93. GivePlayerWeapon(playerid, 30, 99999);
  94. SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken an AK-47!");
  95. }
  96. if(listitem == 5) // M4
  97. {
  98. GivePlayerWeapon(playerid, 31, 99999);
  99. SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken an M4!");
  100. }
  101. if(listitem == 6) // SPAS-12
  102. {
  103. GivePlayerWeapon(playerid, 27, 99999);
  104. SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a SPAS-12!");
  105. }
  106. if(listitem == 7) // Sniper
  107. {
  108. GivePlayerWeapon(playerid, 34, 99999);
  109. SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a Sniper!");
  110. }
  111. if(listitem == 8) // Kevlar vest
  112. {
  113. SetPlayerArmour(playerid, 100.0);
  114. SendClientMessage(playerid, COLOR_LIGHTBLUE," You have taken a Kevlar vest!");
  115. }
  116. if(listitem == 9)
  117. {
  118. SetPlayerHealth(playerid, 100);
  119. }
  120. }
  121. return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
  122. }
  123.  
  124. return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
  125. }
  126.  
  127. CMD:opencrate(playerid, params[])
  128. {
  129. if(dynamiccrate != 0)
  130. {
  131. new Float:Position[3];
  132. GetDynamicObjectPos(dynamiccrate, Position[0], Position[1], Position[2]);
  133.  
  134. if(IsPlayerInRangeOfPoint(playerid, 5.0, Position[0], Position[1], Position[2]))
  135. {
  136. ShowPlayerDialog(playerid, CRATEGUN, DIALOG_STYLE_LIST, "Crate Equipment","Shotgun\nMP5\nRifle\nDesert Eagle\nAK-47\nM4\nSPAS-12\nSniper\nKevlar vest\nFirst Aid Kit", "Take", "Cancel");
  137. }
  138. else
  139. {
  140. SendClientMessage(playerid, COLOR_WHITE, "* You're not near the crate!");
  141. }
  142. }
  143. return 1;
  144. }
  145.  
  146. CMD:spawncrate(playerid, params[])
  147. {
  148. if (IsPlayerAdmin(playerid))
  149. {
  150. if(IsPlayerInAnyVehicle(playerid))
  151. {
  152. SendClientMessage(playerid, COLOR_GREY, "You must be on foot to use this command.");
  153. return 1;
  154. }
  155.  
  156. new Float:Position[4];
  157. if(dynamiccrate == 0)
  158. {
  159. GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
  160. GetPlayerFacingAngle(playerid, Position[3]);
  161. dynamiccrate = CreateDynamicObject(964, Position[0], Position[1], Position[2]-1.28, 0.0, 0.0, Position[3], -1, -1, -1, 200.0);
  162. dynamiccrate3DText = CreateDynamic3DTextLabel("/opencrate\nTo open the crate.",COLOR_ORANGE,Position[0], Position[1], Position[2]+0.0,8.0);
  163. SetPlayerPos(playerid, Position[0], Position[1], Position[2]+3);
  164. SendClientMessageToAll(COLOR_LIGHTRED, "Crate: The crate has been placed!");
  165. }
  166. else
  167. {
  168. DestroyDynamicObject(dynamiccrate);
  169. dynamiccrate = 0;
  170. DestroyDynamic3DTextLabel( Text3D:dynamiccrate3DText );
  171. SendClientMessageToAll(COLOR_LIGHTRED, "Crate: The crate has been destroyed!");
  172. }
  173. }
  174. return 1;
  175. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement