Advertisement
SHUFEN

Untitled

May 16th, 2016
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.54 KB | None | 0 0
  1. #pragma semicolon 1
  2.  
  3. #include <sourcemod>
  4. #include <sdktools>
  5. #include <zombiereloaded>
  6. #include <cstrike>
  7. #include <sdkhooks>
  8.  
  9. public Plugin:myinfo = {
  10. name = "[pS] ZR Market Module",
  11. author = "SHUFEN from POSSESSION.tokyo",
  12. description = "Buy weapons from commands or menu, Advanced module for Z:R pS Mod Version.",
  13. version = "1.0",
  14. url = "http://possession.tokyo/"
  15. };
  16.  
  17.  
  18. //----------------------------------------------------------------------------------------------------
  19. // Purpose: Define
  20. //----------------------------------------------------------------------------------------------------
  21. #define BUY_SOUND "items/ammopickup.wav"
  22. #define DENY_SOUND "buttons/button11.wav"
  23.  
  24.  
  25. //----------------------------------------------------------------------------------------------------
  26. // Purpose: Handle
  27. //----------------------------------------------------------------------------------------------------
  28. new const String:item_entity[][] = {
  29. "weapon_cz75a",
  30. "weapon_deagle",
  31. "weapon_elite",
  32. "weapon_fiveseven",
  33. "weapon_glock",
  34. "weapon_hkp2000",
  35. "weapon_p250",
  36. "weapon_revolver",
  37. "weapon_tec9",
  38. "weapon_usp_silencer",
  39.  
  40. "weapon_bizon",
  41. "weapon_mac10",
  42. "weapon_mp7",
  43. "weapon_mp9",
  44. "weapon_p90",
  45. "weapon_ump45",
  46.  
  47. "weapon_m249",
  48. "weapon_negev",
  49.  
  50. "weapon_ak47",
  51. "weapon_aug",
  52. "weapon_famas",
  53. "weapon_galilar",
  54. "weapon_m4a1",
  55. "weapon_m4a1_silencer",
  56. "weapon_sg556",
  57.  
  58. "weapon_mag7",
  59. "weapon_nova",
  60. "weapon_sawedoff",
  61. "weapon_xm1014",
  62.  
  63. "weapon_awp",
  64. "weapon_g3sg1",
  65. "weapon_scar20",
  66. "weapon_ssg08",
  67.  
  68. "weapon_decoy",
  69. "weapon_flashbang",
  70. "weapon_hegrenade",
  71. "weapon_incgrenade",
  72. "weapon_molotov",
  73. "weapon_smokegrenade",
  74. "weapon_tagrenade",
  75.  
  76. "weapon_c4",
  77. "weapon_healthshot",
  78. "weapon_knife",
  79. "weapon_taser",
  80. "item_defuser",
  81. "item_kevlar",
  82. "item_nvgs"
  83. };
  84.  
  85. // Drop weapons slot (0 = Secondary, 1 = Primary, -1 = Other)
  86. new item_dropslot[] = {
  87. 0,
  88. 0,
  89. 0,
  90. 0,
  91. 0,
  92. 0,
  93. 0,
  94. 0,
  95. 0,
  96. 0,
  97.  
  98. 1,
  99. 1,
  100. 1,
  101. 1,
  102. 1,
  103. 1,
  104.  
  105. 1,
  106. 1,
  107.  
  108. 1,
  109. 1,
  110. 1,
  111. 1,
  112. 1,
  113. 1,
  114. 1,
  115.  
  116. 1,
  117. 1,
  118. 1,
  119. 1,
  120.  
  121. 1,
  122. 1,
  123. 1,
  124. 1,
  125.  
  126. -1,
  127. -1,
  128. -1,
  129. -1,
  130. -1,
  131. -1,
  132. -1,
  133.  
  134. -1,
  135. -1,
  136. -1,
  137. -1,
  138. -1,
  139. -1,
  140. -1
  141. };
  142.  
  143. new String:item_command[sizeof(item_entity)][32];
  144.  
  145.  
  146. //----------------------------------------------------------------------------------------------------
  147. // Purpose: General
  148. //----------------------------------------------------------------------------------------------------
  149. public OnPluginStart()
  150. {
  151.  
  152. }
  153.  
  154. public OnAllPluginsLoaded()
  155. {
  156.  
  157. }
  158.  
  159. public OnConfigsExecuted()
  160. {
  161. for (new i = 0; i < sizeof(item_entity); i++) {
  162. FormatEx(item_command[i], sizeof(item_command[]), "%s", item_entity[i]);
  163. ReplaceString(item_command[i], sizeof(item_command[]), "weapon_", "") & ReplaceString(item_command[i], sizeof(item_command[]), "item_", "");
  164. RegConsoleCmd(item_command[i], Command_Buy);
  165. }
  166. }
  167.  
  168. public OnMapStart()
  169. {
  170. PrecacheSound(BUY_SOUND, true);
  171. PrecacheSound(DENY_SOUND, true);
  172. }
  173.  
  174. //----------------------------------------------------------------------------------------------------
  175. // Purpose: Z:R pS Mod
  176. //----------------------------------------------------------------------------------------------------
  177. public Action:ZR_OnClientPurchase(&client, const String:weapon[], &bool:rebuy)
  178. {
  179. PrintToChat(client, "[ZR_OnClientPurchase] (%N, %s, %s)", client, weapon, rebuy ? "Rebuy" : "Non Rebuy");
  180. }
  181.  
  182. public ZR_OnClientPurchased (client, bool:success)
  183. {
  184. if (success) {
  185. EmitSoundToAll(BUY_SOUND, client);
  186. PrintToChat(client, "[ZR_OnClientPurchased] (%N, %s)", client, success ? "Success" : "Failure");
  187. }
  188. else {
  189. EmitSoundToAll(DENY_SOUND, client);
  190. PrintToChat(client, "[ZR_OnClientPurchased] (%N, %s)", client, success ? "Success" : "Failure");
  191. }
  192. }
  193.  
  194.  
  195. //----------------------------------------------------------------------------------------------------
  196. // Purpose: General
  197. //----------------------------------------------------------------------------------------------------
  198. public Action:Command_Buy(client, args)
  199. {
  200. decl String:cmd[32];
  201. GetCmdArg(0, cmd, sizeof(cmd));
  202.  
  203. for (new i = 0; i < sizeof(item_command); i++) {
  204. if (StrEqual(cmd, item_command[i], false)) {
  205. PrintToChat(client, "[PurchaseCount] (%i)", ZR_GetClientWeaponPurchaseCount(client, item_entity[i]));
  206. new Handle:arrayWeapon = ZR_GetWeaponData(item_entity[i]);
  207.  
  208. new String:weaponname[32];
  209.  
  210. GetArrayString(arrayWeapon, _:1, weaponname, sizeof(weaponname));
  211.  
  212. ZR_EquipClientWeapon(client, item_entity[i]);
  213. }
  214. }
  215. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement