RSSy MYGO.pl Opublikowano Grudzień 23, 2020 o 17:58 RSSy Udostępnij Opublikowano Grudzień 23, 2020 o 17:58 Hey i want to add S.M4A1 for VIP for Human on my BB The flags i want he's "T" I post here my shop bb PHP Code: #include <amxmodx>#include <cstrike>#include <fun>#include <hamsandwich>#include <fakemeta> #define VERSION "4.0"#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )#define MAX_PLAYERS 32#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame new g_iMaxPlayers new const g_ModelSuperKnife[] = "models/x_knife_skin.mdl" new bool:g_HasSuperKnife[MAX_PLAYERS+1]new bool:g_HasSpeed[MAX_PLAYERS+1]new bool:g_HasGravityT[MAX_PLAYERS+1]new bool:g_HasGravityCt[MAX_PLAYERS+1] enum _:ItemsT { Item_SuperKnife_T = 1, Item_Gravity_T, Item_Speed}enum _:ItemsCT { Item_SuperKnife_Ct = 1, Item_Gravity_Ct, Item_M249, Item_G3SG1, Item_He, Item_Flash, Item_Smoke}new g_pCvarTCost[ItemsT], g_pCvarCTCost[ItemsCT]new g_pCvarQuantityGravityT, g_pCvarQuantityGravityCt public plugin_init(){ register_plugin("Shop", VERSION, "Ace67") register_clcmd("say /shop", "ShowShop") register_clcmd("say_team /shop", "ShowShop") g_pCvarTCost[Item_SuperKnife_T] = register_cvar("shopbb_cost_superknife_t", "10000") g_pCvarTCost[Item_Gravity_T] = register_cvar("shopbb_cost_gravity_t", "8000") g_pCvarTCost[Item_Speed] = register_cvar("shopbb_cost_speed", "6000") g_pCvarCTCost[Item_SuperKnife_Ct] = register_cvar("shopbb_cost_superknife_ct", "800") g_pCvarCTCost[Item_Gravity_Ct] = register_cvar("shopbb_cost_gravity_ct", "8000") g_pCvarCTCost[Item_M249] = register_cvar("shopbb_cost_m249", "7000") g_pCvarCTCost[Item_G3SG1] = register_cvar("shopbb_cost_g3sg1", "7000") g_pCvarCTCost[Item_He] = register_cvar("shopbb_cost_he", "2000") g_pCvarCTCost[Item_Flash] = register_cvar("shopbb_cost_flash", "2000") g_pCvarCTCost[Item_Smoke] = register_cvar("shopbb_cost_smoke", "2000") g_pCvarQuantityGravityT = register_cvar("shopbb_quantity_gravity_t", "0.125") g_pCvarQuantityGravityCt = register_cvar("shopbb_quantity_gravity_ct", "0.125") RegisterHam(Ham_Spawn, "player", "Player_Spawn_Post", 1) RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage_Pre") RegisterHam(Ham_Item_Deploy, "weapon_knife", "ham_ItemDeploy_Post", 1) RegisterHam(Ham_Player_ResetMaxSpeed, "player", "Player_ResetMaxSpeed", 1) g_iMaxPlayers = get_maxplayers() set_cvar_num("sv_maxspeed", 999)} public plugin_precache(){ precache_model(g_ModelSuperKnife)}public Player_ResetMaxSpeed( id ){ if ( is_user_alive ( id ) ) { if ( get_user_maxspeed(id) != -1.0 ) { if ( g_HasSpeed[id] ) { set_user_maxspeed(id, 600.0) } } }} public client_connect( id ){ client_cmd(id, "cl_forwardspeed 999;cl_sidespeed 999;cl_backspeed 999") g_HasSuperKnife[id] = false g_HasSpeed[id] = false;} public ShowShop(id){ if ( is_user_alive(id) ) { new Text[32] if ( cs_get_user_team(id) == CS_TEAM_T ) { new menu = menu_create ("\w^x03[\r ZOMBIE SHOP \w]", "ShopT") formatex(Text, charsmax(Text), "\wSuperKnife \y[\r%d $\y]", get_pcvar_num(g_pCvarTCost[Item_SuperKnife_T])) menu_additem(menu, Text, "1") formatex(Text, charsmax(Text), "\wLow Gravity \y[\r%d $\y]", get_pcvar_num(g_pCvarTCost[Item_Gravity_T])) menu_additem(menu, Text, "2") formatex(Text, charsmax(Text), "\wFast Speed \y[\r%d $\y]", get_pcvar_num(g_pCvarTCost[Item_Speed])) menu_additem(menu, Text, "3") menu_setprop(menu, MPROP_EXITNAME, "Quit") menu_setprop(menu, MPROP_EXIT, MEXIT_ALL) menu_display(id, menu) } else { new menu2 = menu_create ("\w^x03[\r HUMAN SHOP \w]", "ShopCt") formatex(Text, charsmax(Text), "\wSuperKnife \y[\r%d $\y]", get_pcvar_num(g_pCvarCTCost[Item_SuperKnife_Ct])) menu_additem(menu2, Text, "1") formatex(Text, charsmax(Text), "\wLow Gravity \y[\r%d $\y]", get_pcvar_num(g_pCvarCTCost[Item_Gravity_Ct])) menu_additem(menu2, Text, "2") formatex(Text, charsmax(Text), "\wM249 \y[\r%d $\y]", get_pcvar_num(g_pCvarCTCost[Item_M249])) menu_additem(menu2, Text, "3") formatex(Text, charsmax(Text), "\wG3SG1 \y[\r%d $\y]", get_pcvar_num(g_pCvarCTCost[Item_G3SG1])) menu_additem(menu2, Text, "4") formatex(Text, charsmax(Text), "\wHE Grenade \y[\r%d $\y]", get_pcvar_num(g_pCvarCTCost[Item_He])) menu_additem(menu2, Text, "5") formatex(Text, charsmax(Text), "\wFlashbang \y[\r%d $\y]", get_pcvar_num(g_pCvarCTCost[Item_Flash])) menu_additem(menu2, Text, "6") formatex(Text, charsmax(Text), "\wSmokeGrenade \y[\r%d $\y]", get_pcvar_num(g_pCvarCTCost[Item_Smoke])) menu_additem(menu2, Text, "7") menu_setprop(menu2, MPROP_EXITNAME, "Quit") menu_setprop(menu2, MPROP_EXIT, MEXIT_ALL) menu_display(id, menu2) } } else { client_print(id, print_chat, "You must be alive for buy !") }} public ShopT(id, menu, item){ if (item == MENU_EXIT) { menu_destroy(menu) return PLUGIN_HANDLED } if ( !is_user_alive(id) ) { client_print(id, print_chat, "You must be alive for buy !") menu_destroy(menu) return PLUGIN_HANDLED } new info[3] new access, callback menu_item_getinfo(menu, item, access, info, 2, _, _, callback) new key = str_to_num(info) new iNewMoney = cs_get_user_money(id) - get_pcvar_num(g_pCvarTCost[key]) if ( iNewMoney < 0 ) { client_print(id, print_chat, "You don't have enough money !") menu_destroy(menu) return PLUGIN_HANDLED } else { switch(key) { case Item_SuperKnife_T: { if ( g_HasSuperKnife[id] ) { client_print(id, print_chat, "You have already the SuperKnife !") menu_destroy(menu) return PLUGIN_HANDLED } cs_set_user_money(id, iNewMoney, 1) g_HasSuperKnife[id] = true; client_print(id, print_chat, "You have bought SuperKnife !") } case Item_Gravity_T: { if ( g_HasGravityT[id] ) { client_print(id, print_chat, "You have already Low Gravity !") menu_destroy(menu) return PLUGIN_HANDLED } cs_set_user_money(id, iNewMoney, 1) set_user_gravity(id, get_pcvar_float(g_pCvarQuantityGravityT) ) client_print(id, print_chat, "You have bought Low Gravity !") g_HasGravityT[id] = true; } case Item_Speed: { if ( g_HasSpeed[id] ) { client_print(id, print_chat, "You have already Fast Speed !") menu_destroy(menu) return PLUGIN_HANDLED } cs_set_user_money(id, iNewMoney, 1) g_HasSpeed[id] = true; client_print(id, print_chat, "You have bought Fast Speed !") } } } menu_destroy(menu) return PLUGIN_HANDLED} public ShopCt(id, menu2, item){ if (item == MENU_EXIT) { menu_destroy(menu2) return PLUGIN_HANDLED } if ( !is_user_alive(id) ) { client_print(id, print_chat, "You must be alive !") menu_destroy(menu2) return PLUGIN_HANDLED } new info[3] new access, callback menu_item_getinfo(menu2, item, access, info, 2, _, _, callback) new key = str_to_num(info) new iNewMoney = cs_get_user_money(id) - get_pcvar_num(g_pCvarCTCost[key]) if ( iNewMoney < 0 ) { client_print(id, print_chat, "You don't have enough money ! !") menu_destroy(menu2) return PLUGIN_HANDLED } else { switch(key) { case Item_SuperKnife_Ct: { if ( g_HasSuperKnife[id] ) { client_print(id, print_chat, "You have already the SuperKnife !") menu_destroy(menu2) return PLUGIN_HANDLED } cs_set_user_money(id, iNewMoney, 1) g_HasSuperKnife[id] = true; client_print(id, print_chat, "You have bought SuperKnife !") } case Item_Gravity_Ct: { if ( g_HasGravityCt[id] ) { client_print(id, print_chat, "You have already Low Gravity !") menu_destroy(menu2) return PLUGIN_HANDLED } cs_set_user_money(id, iNewMoney, 1) set_user_gravity(id, get_pcvar_float(g_pCvarQuantityGravityCt)) client_print(id, print_chat, "You have bought Low Gravity !") g_HasGravityCt[id] = true; } case Item_M249: { if ( user_has_weapon(id, CSW_M249) ) { client_print(id, print_chat, "You have already M249 !") menu_destroy(menu2) return PLUGIN_HANDLED } cs_set_user_money(id, iNewMoney, 1) give_item(id, "weapon_m249") client_print(id, print_chat, "You have bought M249 !") } case Item_G3SG1: { if ( user_has_weapon(id, CSW_G3SG1) ) { client_print(id, print_chat, "You have already G3SG1 !") menu_destroy(menu2) return PLUGIN_HANDLED } cs_set_user_money(id, iNewMoney, 1) give_item(id, "weapon_g3sg1") client_print(id, print_chat, "You have bought G3SG1 !") } case Item_He: { if ( user_has_weapon(id, CSW_HEGRENADE) ) { client_print(id, print_chat, "You have already Grenade !") menu_destroy(menu2) return PLUGIN_HANDLED } cs_set_user_money(id, iNewMoney, 1) give_item(id, "weapon_hegrenade") client_print(id, print_chat, "You have bought HeGrenade !") } case Item_Flash: { if ( cs_get_user_bpammo(id, CSW_FLASHBANG) == 2 ) { client_print(id, print_chat, "You have already 2 flashbangs !") menu_destroy(menu2) return PLUGIN_HANDLED } cs_set_user_money(id, iNewMoney, 1) give_item(id, "weapon_flashbang") client_print(id, print_chat, "You have bought Flashbang !") } case Item_Smoke: { if ( user_has_weapon(id, CSW_SMOKEGRENADE) ) { client_print(id, print_chat, "You have already Smoke !") menu_destroy(menu2) return PLUGIN_HANDLED } cs_set_user_money(id, iNewMoney, 1) give_item(id, "weapon_smokegrenade") client_print(id, print_chat, "You have bought SmokeGrenade !") } } } menu_destroy(menu2) return PLUGIN_HANDLED} public Player_Spawn_Post(id){ if ( is_user_alive ( id ) ) { client_print(id, print_chat, "Say /shop in the chat for buy an item !") if ( g_HasSuperKnife[id] && get_user_weapon(id) == CSW_KNIFE ) { set_pev(id, pev_viewmodel2, "models/v_knife.mdl") } g_HasSuperKnife[id] = false g_HasSpeed[id] = false; }} public ham_TakeDamage_Pre(victim, inflictor, attacker, Float:damage, damage_bits){ if ( IsPlayer(attacker) && g_HasSuperKnife[attacker] && is_user_alive(attacker) && inflictor == attacker && get_user_weapon(attacker) == CSW_KNIFE ) { SetHamParamFloat( 4, damage * 154.0 ) }} public ham_ItemDeploy_Post(weapon_ent){ static owner owner = get_pdata_cbase(weapon_ent, 41, 4) if ( is_user_alive(owner) && g_HasSuperKnife[owner] ) { set_pev(owner, pev_viewmodel2, g_ModelSuperKnife) }} Attached Files Get Plugin or Get Source (bb_shop.sma - 12.3 KB) Przeczytaj cały wpis Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi