Как сделать чтоб вип игроки могли брать оружия со 2 раунда?
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <fakemeta>
#include <fakemeta_util>
#include <WPMGPrintChatColor>
#define PLUGIN "Vip Menu"
#define VERSION "1.0"
#define AUTHOR "vk.com/CSPlugin"
const MENU_LENGTH = 512;
new const Secondary[] = {CSW_P228, CSW_ELITE, CSW_FIVESEVEN, CSW_USP, CSW_GLOCK18, CSW_DEAGLE};
new const Primary[]={CSW_SCOUT,CSW_XM1014,CSW_MAC10,CSW_AUG,CSW_UMP45,CSW_SG550,CSW_GALIL,CSW_FAMAS,CSW_AWP,CSW_MP5NAVY,CSW_M249,CSW_M3,CSW_M4A1,CSW_TMP,CSW_G3SG1,CSW_SG552,CSW_AK47,CSW_P90}
enum _:STRITEM {
I_MONEY,
I_AWP,
I_AK47,
I_M4A1
}
new gCountUse[33][STRITEM];
new gMaxPlayer;
new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("HLTV", "NewRound", "a", "1=0", "2=0")
gMaxPlayer = get_maxplayers();
register_menu("Menu", keys, "MenuFunc");
register_clcmd("say /vipmenu","Menu")
register_clcmd("say_team /vipmenu","Menu")
register_clcmd("vipmenu","Menu")
}
public NewRound() {
for(new id=1;id<gMaxPlayer;id++) {
for(new i=0;i<sizeof(gCountUse[]);i++) {
gCountUse[id][i] = 1;
}
}
}
public client_putinserver(id) {
for(new i=0;i<sizeof(gCountUse[]);i++) {
gCountUse[id][i] = 1;
}
}
public Menu(id) {
if(!(get_user_flags(id) & read_flags("t")))
return PLUGIN_HANDLED;
static menu[MENU_LENGTH], len
len = 0;
len = formatex(menu[len], charsmax(menu) - len, "\r[\yPokemon VIP\r] \wv1.1 ツ^n^n");
len += formatex(menu[len], charsmax(menu) - len, "\r1. \wФункции VIP (В тестировании)^n");
len += formatex(menu[len], charsmax(menu) - len, "\r2. \wУсиленные оружия^n");
len += formatex(menu[len], charsmax(menu) - len, "\r3. \wЗаблокировать чат/микрофон^n");
len += formatex(menu[len], charsmax(menu) - len, "\r4. \wКикнуть игрока^n");
if(gCountUse[id][I_MONEY] > 0)
len += formatex(menu[len], charsmax(menu) - len, "\r5. \wВзять \y5000\r$^n");
else
len += formatex(menu[len], charsmax(menu) - len, "\d5. \dВзять \y5000\r$^n");
if(gCountUse[id][I_AWP] > 0)
len += formatex(menu[len], charsmax(menu) - len, "\r6. \wВзять \yAWP\r+\yDeagle^n");
else
len += formatex(menu[len], charsmax(menu) - len, "\d6. \dВзять \yAWP\r+\yDeagle^n");
if(gCountUse[id][I_AK47] > 0)
len += formatex(menu[len], charsmax(menu) - len, "\r7. \wВзять \yAK47\r+\yDeagle^n");
else
len += formatex(menu[len], charsmax(menu) - len, "\d7. \dВзять \yAK47\r+\yDeagle^n");
if(gCountUse[id][I_MONEY] > 0)
len += formatex(menu[len], charsmax(menu) - len, "\r8. \wВзять \yM4A1\r+\yDeagle^n^n");
else
len += formatex(menu[len], charsmax(menu) - len, "\d8. \dВзять \yM4A1\r+\yDeagle^n^n");
len += formatex(menu[len], charsmax(menu) - len, "\r0.\wЗакрыть");
show_menu(id, keys, menu, -1, "Menu");
return PLUGIN_HANDLED;
}
public MenuFunc(id, key) {
if(!(get_user_flags(id) & read_flags("t")))
return PLUGIN_HANDLED;
switch(key) {
case 0: {
client_cmd(id,"vipmenus");
}
case 1: {
client_cmd(id,"buyultimate");
}
case 2: {
client_cmd(id,"amx_gagmenu");
}
case 3: {
client_cmd(id,"amx_kickmenu");
}
case 4: {
if(gCountUse[id][I_MONEY] > 0) {
cs_set_user_money(id,cs_get_user_money(id) + 5000);
gCountUse[id][I_MONEY]--;
} else {
PrintChatColor(id, PRINT_COLOR_PLAYERTEAM,"!t[!gPokemon VIP!t] !tМожно брать деньги только !g1 !tраз за раунд.");
}
}
case 5: {
if(is_user_alive(id)) {
if(gCountUse[id][I_AWP] > 0) {
RemoveWeapon(id);
give_item(id, "weapon_awp");
give_item(id, "weapon_deagle");
give_item(id, "weapon_flashbang");
give_item(id, "weapon_hegrenade");
cs_set_user_bpammo(id, CSW_AWP, 90);
cs_set_user_bpammo(id, CSW_DEAGLE, 35);
gCountUse[id][I_AWP]--;
} else {
PrintChatColor(id, PRINT_COLOR_PLAYERTEAM,"!t[!gPokemon VIP!t] !tМожно брать awp набор только !g1 !tраз за раунд.");
}
} else {
PrintChatColor(id, PRINT_COLOR_PLAYERTEAM,"!t[!gPokemon VIP!t] !tВы должны быть живы.");
}
}
case 6: {
if(is_user_alive(id)) {
if(gCountUse[id][I_AK47] > 0) {
RemoveWeapon(id);
give_item(id, "weapon_ak47");
give_item(id, "weapon_deagle");
give_item(id, "weapon_flashbang");
give_item(id, "weapon_hegrenade");
cs_set_user_bpammo(id, CSW_AK47, 90);
cs_set_user_bpammo(id, CSW_DEAGLE, 35);
gCountUse[id][I_AK47]--;
} else {
PrintChatColor(id, PRINT_COLOR_PLAYERTEAM,"!t[!gPokemon VIP!t] !tМожно брать ak47 набор только !g1 !tраз за раунд.");
}
} else {
PrintChatColor(id, PRINT_COLOR_PLAYERTEAM,"!t[!gPokemon VIP!t] !tВы должны быть живы.");
}
}
case 7: {
if(is_user_alive(id)) {
if(gCountUse[id][I_M4A1] > 0) {
RemoveWeapon(id);
give_item(id, "weapon_m4a1");
give_item(id, "weapon_deagle");
give_item(id, "weapon_flashbang");
give_item(id, "weapon_hegrenade");
cs_set_user_bpammo(id, CSW_M4A1, 90);
cs_set_user_bpammo(id, CSW_DEAGLE, 35);
gCountUse[id][I_M4A1]--;
} else {
PrintChatColor(id, PRINT_COLOR_PLAYERTEAM,"!t[!gPokemon VIP!t] !tМожно брать M4A1 набор только !g1 !tраз за раунд.");
}
} else {
PrintChatColor(id, PRINT_COLOR_PLAYERTEAM,"!t[!gPokemon VIP!t] !tВы должны быть живы.");
}
}
}
return PLUGIN_HANDLED;
}
public RemoveWeapon(id) {
for (new i = 0; i < sizeof Secondary; ++i) {
if(user_has_weapon(id,Secondary[i]))
fm_strip_user_gun(id,Secondary[i])
}
for (new i = 0; i < sizeof Primary; ++i) {
if(user_has_weapon(id,Primary[i]))
fm_strip_user_gun(id,Primary[i])
}
}
// stock bool:fm_strip_user_gun(index, wid = 0, const wname[] = "") {
// new ent_class[32];
// if (!wid && wname[0])
// copy(ent_class, sizeof ent_class - 1, wname);
// else {
// new weapon = wid, clip, ammo;
// if (!weapon && !(weapon = get_user_weapon(index, clip, ammo)))
// return false;
// get_weaponname(weapon, ent_class, sizeof ent_class - 1);
// }
// new ent_weap = fm_find_ent_by_owner(-1, ent_class, index);
// if (!ent_weap)
// return false;
// engclient_cmd(index, "drop", ent_class);
// new ent_box = pev(ent_weap, pev_owner);
// if (!ent_box || ent_box == index)
// return false;
// dllfunc(DLLFunc_Think, ent_box);
// return true;
// }
Прикрепленные файлы
Сообщение отредактировал Lunia941: 20 Апрель 2018 - 10:24