Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #include <sourcemod>
- #include <sdktools>
- #include <zombiereloaded>
- #include <cstrike>
- #include <sdkhooks>
- public Plugin:myinfo = {
- name = "[pS] ZR Market Module",
- author = "SHUFEN from POSSESSION.tokyo",
- description = "Buy weapons from commands or menu, Advanced module for Z:R pS Mod Version.",
- version = "1.0",
- url = "http://possession.tokyo/"
- };
- //----------------------------------------------------------------------------------------------------
- // Purpose: Define
- //----------------------------------------------------------------------------------------------------
- #define BUY_SOUND "items/ammopickup.wav"
- #define DENY_SOUND "buttons/button11.wav"
- //----------------------------------------------------------------------------------------------------
- // Purpose: Handle
- //----------------------------------------------------------------------------------------------------
- new const String:item_entity[][] = {
- "weapon_cz75a",
- "weapon_deagle",
- "weapon_elite",
- "weapon_fiveseven",
- "weapon_glock",
- "weapon_hkp2000",
- "weapon_p250",
- "weapon_revolver",
- "weapon_tec9",
- "weapon_usp_silencer",
- "weapon_bizon",
- "weapon_mac10",
- "weapon_mp7",
- "weapon_mp9",
- "weapon_p90",
- "weapon_ump45",
- "weapon_m249",
- "weapon_negev",
- "weapon_ak47",
- "weapon_aug",
- "weapon_famas",
- "weapon_galilar",
- "weapon_m4a1",
- "weapon_m4a1_silencer",
- "weapon_sg556",
- "weapon_mag7",
- "weapon_nova",
- "weapon_sawedoff",
- "weapon_xm1014",
- "weapon_awp",
- "weapon_g3sg1",
- "weapon_scar20",
- "weapon_ssg08",
- "weapon_decoy",
- "weapon_flashbang",
- "weapon_hegrenade",
- "weapon_incgrenade",
- "weapon_molotov",
- "weapon_smokegrenade",
- "weapon_tagrenade",
- "weapon_c4",
- "weapon_healthshot",
- "weapon_knife",
- "weapon_taser",
- "item_defuser",
- "item_kevlar",
- "item_nvgs"
- };
- // Drop weapons slot (0 = Secondary, 1 = Primary, -1 = Other)
- new item_dropslot[] = {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1
- };
- new String:item_command[sizeof(item_entity)][32];
- //----------------------------------------------------------------------------------------------------
- // Purpose: General
- //----------------------------------------------------------------------------------------------------
- public OnPluginStart()
- {
- }
- public OnAllPluginsLoaded()
- {
- }
- public OnConfigsExecuted()
- {
- for (new i = 0; i < sizeof(item_entity); i++) {
- FormatEx(item_command[i], sizeof(item_command[]), "%s", item_entity[i]);
- ReplaceString(item_command[i], sizeof(item_command[]), "weapon_", "") & ReplaceString(item_command[i], sizeof(item_command[]), "item_", "");
- RegConsoleCmd(item_command[i], Command_Buy);
- }
- }
- public OnMapStart()
- {
- PrecacheSound(BUY_SOUND, true);
- PrecacheSound(DENY_SOUND, true);
- }
- //----------------------------------------------------------------------------------------------------
- // Purpose: Z:R pS Mod
- //----------------------------------------------------------------------------------------------------
- public Action:ZR_OnClientPurchase(&client, const String:weapon[], &bool:rebuy)
- {
- PrintToChat(client, "[ZR_OnClientPurchase] (%N, %s, %s)", client, weapon, rebuy ? "Rebuy" : "Non Rebuy");
- }
- public ZR_OnClientPurchased (client, bool:success)
- {
- if (success) {
- EmitSoundToAll(BUY_SOUND, client);
- PrintToChat(client, "[ZR_OnClientPurchased] (%N, %s)", client, success ? "Success" : "Failure");
- }
- else {
- EmitSoundToAll(DENY_SOUND, client);
- PrintToChat(client, "[ZR_OnClientPurchased] (%N, %s)", client, success ? "Success" : "Failure");
- }
- }
- //----------------------------------------------------------------------------------------------------
- // Purpose: General
- //----------------------------------------------------------------------------------------------------
- public Action:Command_Buy(client, args)
- {
- decl String:cmd[32];
- GetCmdArg(0, cmd, sizeof(cmd));
- for (new i = 0; i < sizeof(item_command); i++) {
- if (StrEqual(cmd, item_command[i], false)) {
- PrintToChat(client, "[PurchaseCount] (%i)", ZR_GetClientWeaponPurchaseCount(client, item_entity[i]));
- new Handle:arrayWeapon = ZR_GetWeaponData(item_entity[i]);
- new String:weaponname[32];
- GetArrayString(arrayWeapon, _:1, weaponname, sizeof(weaponname));
- ZR_EquipClientWeapon(client, item_entity[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement