RSSy MYGO.pl Opublikowano Kwiecień 16, 2023 o 23:28 RSSy Udostępnij Opublikowano Kwiecień 16, 2023 o 23:28 So, I'm using this biohazard shop plugin for the biohazard mod, but I want to change the "Infect me" item for this "Invisibility" item. It would be awesome if the CT can buy 15 seconds of invisibility instead of being able to infect himself. I have no problem if you guys think there's a better version of the invisibility plugin or there's a better way to do it. Thanks! PHP Code: #include <amxmodx> #include <fun> #include <cstrike> #include <fakemeta> #include <engine> #include <xs> #include <hamsandwich> #include <dhudmessage> #include <biohazard> #define PLUGIN_NAME "[Biohazard] Shop" #define PLUGIN_AUTHORS "YONTU" #define PLUGIN_VERSION "1.0" #define is_user_player(%1) (1 <= %1 <= max_players) #define DMG_HEGRENADE (1<<24) #define ENG_NULLENT -1 #define EV_INT_WEAPONKEY EV_INT_impulse #define GAK_WEAPONKEY 6871 #define TASK_DELAY 91249 new g_HostName[64], g_Ak47Gold[33], g_Ak47GoldenZoom[33], g_HealthRegen[33], Float:g_RegenDelay[33]; new g_user_xp[33], g_item[4][33], g_msg_ItemPickUp; new g_PowerGlobalDelay = 0, g_PowerDelay[33]; new SpriteTexture, Lightning, PowerSprite, ShockWave; new menu, text_menu[128], text_items[5][128], menu_callback, money; new data[6], name[64], access, CallBack; new max_players, cvar_hostname; new bool:ignorecost = false; enum { COST_GOLDEN_AK47 = 0, COST_REGENERATOR_HUMAN, COST_FROSTNADE, COST_INFECTME } enum { COST_NOFLASH = 0, COST_SPEED, COST_HEALTH, COST_GRAVITY, COST_STRIPW } // Costul itemelor din shop-ul oamenilor new const SHOP_HUMANS[] = { 16000, // COSTUL AK-47 DE AUR 3000, // COSTUL REGENERATORULUI DE VIATA (VIATA MAXIMA = 200) 4000, // COSTUL GRENADEI FROST 15000 // COSTUL AUTO-INFECTIEI } // Costul itemelor din shop-ul zombilor new const SHOP_ZOMBIES[] = { 2, // NO FLASH 4, // SPEED BOOST 6, // EXTRA HEALTH 3, // LOW GRAVITY 8 // STRIP HUMANS WEAPONS } // Poti adauga mai multe ore respectand matricea de mai jos. Intre orele respective, costul itemelor va fi ignorat, adica itemele vor fi gratuite. // NOTA: Dupa ultima linie a matriciei nu se pune virgula (vezi mai jos) new ignore_cost_hours[][] = { {00, 22}, // intre ora 00:00 si 07:00 {16, 17} // intre ora 16:00 si 17:00 } new const GoldenAK[][] = { "models/biohazard/v_ak47_golden.mdl", "models/biohazard/p_ak47_golden.mdl", "models/biohazard/w_ak47_golden.mdl" } new const TAG[] = "[Biohazard]"; new const TargetAimingSound[][] = { "biohazard/target.wav", "biohazard/target2.wav" }; new const PowerSound[] = "biohazard/wizard_skill.wav"; new const SpritePower[] = "sprites/biohazard/wizard.spr"; const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90) const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE) public plugin_init() { register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHORS); is_biomod_active() ? plugin_init2() : pause("ad") } public plugin_init2() { new o, m, s, i; time(o, m, s); for(i = 0; i < sizeof ignore_cost_hours; i++) { if(o >= ignore_cost_hours[i][0] && o < ignore_cost_hours[i][1]) { ignorecost = true; } } register_event("HLTV", "event_NewRound", "a", "1=0", "2=0"); register_event("CurWeapon", "event_CurWeapon", "be", "1=1"); register_event("Damage", "event_Damage", "be"); register_event("DeathMsg", "event_DeathMsg", "a"); RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamagePre"); RegisterHam(Ham_Item_AddToPlayer, "weapon_ak47", "fw_AddToPlayer"); RegisterHam(Ham_TraceAttack, "worldspawn", "fw_TraceAttack", 1); RegisterHam(Ham_TraceAttack, "player", "fw_TraceAttack", 1); register_forward(FM_SetModel, "fw_SetModel"); register_forward(FM_CmdStart, "fw_CmdStart"); register_forward(FM_PlayerPreThink, "fw_PlayerPreThink"); register_message(get_user_msgid("ScreenFade"), "msg_ScreenFade"); register_clcmd("say /shop", "ShowShopMenu"); register_clcmd("say_team /shopS", "ShowShopMenu"); register_clcmd("say shop", "ShowShopMenu"); register_clcmd("say_team shop", "ShowShopMenu"); register_clcmd("drop", "cmd_use_power"); g_msg_ItemPickUp = get_user_msgid("ItemPickup"); cvar_hostname = get_cvar_pointer("hostname"); max_players = get_maxplayers(); } public plugin_precache() { new i; for(i = 0; i < sizeof GoldenAK; i++) precache_model(GoldenAK[i]); for(i = 0; i < sizeof TargetAimingSound; i++) precache_sound(TargetAimingSound[i]); precache_sound(PowerSound); precache_sound("weapons/zoom.wav"); Lightning = precache_model("sprites/lgtning.spr"); ShockWave = precache_model("sprites/shockwave.spr"); PowerSprite = precache_model(SpritePower); SpriteTexture = precache_model("sprites/dot.spr"); } public plugin_cfg() { get_pcvar_string(cvar_hostname, g_HostName, charsmax(g_HostName)); } public client_putinserver(id) { reset_vars(id); } public ShowShopMenu(id) { if(!is_user_alive(id)) { ColorChat(id, "!4%s!1 Trebuie sa fii in viata pentru a deschide shop-ul.", TAG); return PLUGIN_HANDLED; } else if(!game_started()) { ColorChat(id, "!4%s!1 Trebuie sa astepti pana incepe infectia pentru a deschide shop-ul.", TAG); return PLUGIN_HANDLED; } if(!is_user_zombie(id)) HumanShop(id); else ZombieShop(id); return PLUGIN_CONTINUE; } public HumanShop(id) { !ignorecost ? formatex(text_menu, charsmax(text_menu), "\wHumans SHOP_HUMANS | Money:\r %d^n\y%s", cs_get_user_money(id), g_HostName) : formatex(text_menu, charsmax(text_menu), "\wHumans SHOP_HUMANS | FREE ITEMS^n\y%s", g_HostName); menu = menu_create(text_menu, "HumansHandler"); menu_callback = menu_makecallback("CallBackMenuH"); !ignorecost ? formatex(text_items[0], charsmax(text_items[]), "Golden AK-47 -\r %d $", SHOP_HUMANS[COST_GOLDEN_AK47]) : formatex(text_items[0], charsmax(text_items[]), "Golden AK-47"); menu_additem(menu, text_items[0], "1", 0, menu_callback); !ignorecost ? formatex(text_items[1], charsmax(text_items[]), "Health Regenerator (200 HP) -\r %d $", SHOP_HUMANS[COST_REGENERATOR_HUMAN]) : formatex(text_items[1], charsmax(text_items[]), "Health Regenerator (200 HP)"); menu_additem(menu, text_items[1], "2", 0, menu_callback); !ignorecost ? formatex(text_items[2], charsmax(text_items[]), "Frost Nade -\r %d $", SHOP_HUMANS[COST_FROSTNADE]) : formatex(text_items[2], charsmax(text_items[]), "Frost Nade"); menu_additem(menu, text_items[2], "3", 0, menu_callback); formatex(text_items[3], charsmax(text_items[]), "Infect me -\r %d $", SHOP_HUMANS[COST_INFECTME]); menu_additem(menu, text_items[3], "4", 0, menu_callback); menu_setprop(menu, MPROP_EXIT, MEXIT_ALL); menu_display(id, menu, 0); return PLUGIN_CONTINUE; } public CallBackMenuH(id, menu, item) { if(item == MENU_EXIT) { menu_destroy(menu); return PLUGIN_HANDLED; } money = cs_get_user_money(id); menu_item_getinfo(menu, item, access, data, charsmax(data), name, charsmax(name), CallBack); new key = str_to_num(data); switch(key) { case 1: { if(SHOP_HUMANS[COST_GOLDEN_AK47] > money && !ignorecost || g_Ak47Gold[id] == 1) return ITEM_DISABLED; } case 2: { if(SHOP_HUMANS[COST_REGENERATOR_HUMAN] > money && !ignorecost || g_HealthRegen[id] == 1) return ITEM_DISABLED; } case 3: { if(SHOP_HUMANS[COST_FROSTNADE] > money && !ignorecost || user_has_weapon(id, CSW_SMOKEGRENADE)) return ITEM_DISABLED; } case 4: { if(SHOP_HUMANS[COST_INFECTME] > money || !allow_infection()) return ITEM_DISABLED; } } return ITEM_ENABLED; } public HumansHandler(id, menu, item) { if(item == MENU_EXIT) { menu_destroy(menu); return PLUGIN_HANDLED; } money = cs_get_user_money(id); menu_item_getinfo(menu, item, access, data, charsmax(data), name, charsmax(name), CallBack); new key = str_to_num(data); switch(key) { case 1: { new szWeapons[32], iNum; get_user_weapons(id, szWeapons, iNum); for(new i = 0; i < iNum; i++) { if(PRIMARY_WEAPONS_BIT_SUM & (1<<szWeapons[i])) { new weaponname[32]; get_weaponname(szWeapons[i], weaponname, charsmax(weaponname)); bacon_strip_weapon(id, weaponname); } } g_Ak47Gold[id] = 1; give_item(id, "weapon_ak47"); if(!ignorecost) { new cost_ak47 = SHOP_HUMANS[COST_GOLDEN_AK47]; cs_set_user_money(id, money - cost_ak47); ColorChat(id, "!4%s!1 You bought!3 Golden AK-47!1 with!3 %d!1 money.", TAG, cost_ak47); } } case 2: { g_HealthRegen[id] = 1; ColorChat(id, "!4%s!1 Your health will be regenerated with!3 1 HP!1/!3sec!1 (!3MAX 200 HP!1).", TAG); if(!ignorecost) { new cost_regen = SHOP_HUMANS[COST_REGENERATOR_HUMAN]; cs_set_user_money(id, money - cost_regen); ColorChat(id, "!4%s!1 You bought!3 health regenerator!1 with!3 %d!1 money.", TAG, cost_regen); } } case 3: { if(!ignorecost) { new cost_fn = SHOP_HUMANS[COST_FROSTNADE]; cs_set_user_money(id, money - cost_fn); ColorChat(id, "!4%s!1 You bought a!3 frostnade!1 with!3 %d!1 money.", TAG, cost_fn); } give_item(id, "weapon_smokegrenade"); } case 4: { infect_user(id, 0); new zm_name[32]; get_user_name(id, zm_name, charsmax(zm_name)); ColorChat(0, "!4%s!3 %s!1 become a zombie. He was infected by a strange plague.", TAG, zm_name); } } menu_destroy(menu); return PLUGIN_HANDLED; } public ZombieShop(id) { formatex(text_menu, charsmax(text_menu), "\wXP:\r %d^n\w* Infect more humans and gain experience points.^n*\r ONLY\w first zombie can receive XP.^n*\y 1 infection = 1 XP^n\w* Only item during one round.", g_user_xp[id]); menu = menu_create(text_menu, "ZombiesHandler"); menu_callback = menu_makecallback("CallBackMenuZ"); formatex(text_items[0], charsmax(text_items[]), "NO FLASH -\d Immune to flashbangs\w [\y%d XP\w]", SHOP_ZOMBIES[COST_NOFLASH]); menu_additem(menu, text_items[0], "1", 0, menu_callback); formatex(text_items[1], charsmax(text_items[]), "SPEED BOOST -\d Increase your speed by 20%%\w [\y%d XP\w]", SHOP_ZOMBIES[COST_SPEED]); menu_additem(menu, text_items[1], "2", 0, menu_callback); formatex(text_items[2], charsmax(text_items[]), "EXTRA HEALTH -\d Increase your health by 30%%\w [\y%d XP\w]", SHOP_ZOMBIES[COST_HEALTH]); menu_additem(menu, text_items[2], "3", 0, menu_callback); formatex(text_items[3], charsmax(text_items[]), "LOW GRAVITY -\d Increase your gravity with 50%%\w [\y%d XP\w]", SHOP_ZOMBIES[COST_GRAVITY]); menu_additem(menu, text_items[3], "4", 0, menu_callback); formatex(text_items[4], charsmax(text_items[]), "STRIP HUMANS WEAPONS [\y%d XP\w]", SHOP_ZOMBIES[COST_STRIPW]); menu_additem(menu, text_items[4], "5", 0, menu_callback); menu_setprop(menu, MPROP_EXIT, MEXIT_ALL); menu_display(id, menu, 0); return PLUGIN_CONTINUE; } public CallBackMenuZ(id, menu, item) { if(item == MENU_EXIT) { menu_destroy(menu); return PLUGIN_HANDLED; } new data[6], name[64], access, CallBack; menu_item_getinfo(menu, item, access, data, charsmax(data), name, charsmax(name), CallBack); switch(data[0]) { case '1': { if(g_user_xp[id] < 0 || SHOP_ZOMBIES[COST_NOFLASH] > g_user_xp[id] || g_item[0][id] == 1) return ITEM_DISABLED; } case '2': { if(g_user_xp[id] < 0 || SHOP_ZOMBIES[COST_SPEED] > g_user_xp[id] || g_item[1][id] == 1) return ITEM_DISABLED; } case '3': { if(g_user_xp[id] < 0 || SHOP_ZOMBIES[COST_HEALTH] > g_user_xp[id] || get_user_health(id) >= 500) return ITEM_DISABLED; } case '4': { if(g_user_xp[id] < 0 || SHOP_ZOMBIES[COST_GRAVITY] > g_user_xp[id] || g_item[2][id] == 1) return ITEM_DISABLED; } case '5': { if(g_user_xp[id] < 0 || SHOP_ZOMBIES[COST_STRIPW] > g_user_xp[id] || g_item[3][id] == 1) return ITEM_DISABLED; } } return ITEM_ENABLED; } public ZombiesHandler(id, menu, item) { if(item == MENU_EXIT) { menu_destroy(menu); return PLUGIN_HANDLED; } new data[6], name[64], access, CallBack; menu_item_getinfo(menu, item, access, data, charsmax(data), name, charsmax(name), CallBack); new iKey = str_to_num(data); switch(iKey) { case 1: { new cost_nf = SHOP_ZOMBIES[COST_NOFLASH]; g_item[0][id] = 1; g_user_xp[id] -= cost_nf; ColorChat(id, "!4%s!1 You bought!3 no flash!1 with!3 %d!1 XP.", TAG, cost_nf); } case 2: { new Float:speed = 0.2 * get_user_maxspeed(id); new cost_speed = SHOP_ZOMBIES[COST_SPEED]; set_user_maxspeed(id, get_user_maxspeed(id) + speed); g_item[1][id] = 1; g_user_xp[id] -= cost_speed; ColorChat(id, "!4%s!1 You bought!3 %0.1f!1 speed with!3 %d!1 XP.", TAG, speed, cost_speed); } case 3: { new Float:health; pev(id, pev_health, health); new Float:hp = 0.3 * health; new cost_hp = SHOP_ZOMBIES[COST_HEALTH]; new Float:max_hp = 500.0; message_begin(MSG_ONE, g_msg_ItemPickUp, _, id); write_string("cross"); write_byte(255); write_byte(0); write_byte(0); message_end(); emit_sound(id, CHAN_VOICE, "items/tr_kevlar.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM); set_pev(id, pev_health, floatclamp(health + hp, 0.0, max_hp)); g_user_xp[id] -= cost_hp; ColorChat(id, "!4%s!1 You bought!3 %0.1f!1 health with!3 %d!1 XP.", TAG, (get_user_health(id) >= max_hp) ? max_hp : hp, cost_hp); } case 4: { new Float:gravity = 0.5 * get_user_gravity(id); new cost_gv = SHOP_ZOMBIES[COST_GRAVITY]; set_user_gravity(id, get_user_gravity(id) - gravity); g_item[2][id] = 1; g_user_xp[id] -= cost_gv; ColorChat(id, "!4%s!1 You bought gravity with!3 %d!1 XP. Your gravity:!3 %0.1f!1.", TAG, cost_gv, get_user_gravity(id) * 800.0); } case 5: { new cost_shw = SHOP_ZOMBIES[COST_STRIPW]; g_item[3][id] = 1; PowerGlobalDelay(); g_user_xp[id] -= cost_shw; ColorChat(id, "!4%s!1 Now, you can strip humans weapons. Find a human, aim it, and!3 PRESS G!1.", TAG); ColorChat(id, "!4%s!1 Cooldown:!3 15 sec.", TAG); } } menu_destroy(menu); return PLUGIN_HANDLED; } public event_NewRound() { new Players[32], Num, id, i; get_players(Players, Num); for(i = 0; i < Num; i++) { id = Players[i]; if(!is_user_connected(id)) continue; reset_vars(id); } if(ignorecost) { ColorChat(0, "!1%s!4 TOATE ITEMELE DIN SHOP-UL OAMENILOR SUNT GRATIS.", TAG); } } public event_infect(victim, infector) { if(!is_user_alive(victim) || !is_user_alive(infector)) return PLUGIN_HANDLED; reset_vars(victim); if(victim == infector || !is_user_infected(infector)) return PLUGIN_HANDLED; g_user_xp[infector]++; return PLUGIN_CONTINUE; } public event_CurWeapon(id) { if(!is_user_alive(id) || g_Ak47Gold[id] == 0) return PLUGIN_HANDLED; if(get_user_weapon(id) == CSW_AK47) { set_pev(id, pev_viewmodel2, GoldenAK[0]); set_pev(id, pev_weaponmodel2, GoldenAK[1]); // unlimited clip set_pdata_int(get_pdata_cbase(id, 373), 51, 30, 4); } return PLUGIN_CONTINUE; } public event_Damage(victim) { if(!is_user_alive(victim) || g_HealthRegen[victim] == 0 || is_user_zombie(victim)) return PLUGIN_CONTINUE static Float:gametime; gametime = get_gametime(); g_RegenDelay[victim] = gametime + 1.0; return PLUGIN_CONTINUE; } public event_DeathMsg() { new id = read_data(2); if(is_user_connected(id)) reset_vars(id); } public fw_TakeDamagePre(iVictim, iInflictor, iAttacker, Float:fDamage, iDmgType) { if(iVictim == iAttacker || !is_user_player(iAttacker) || !is_user_alive(iAttacker) || g_Ak47Gold[iAttacker] == 0) return HAM_HANDLED; if(is_user_player(iAttacker) && get_user_weapon(iAttacker) == CSW_AK47 && is_user_zombie(iVictim)) { // bug fix if(iDmgType & DMG_HEGRENADE) return HAM_IGNORED; new Float:Damage = 2.0; fDamage *= Damage; SetHamParamFloat(4, fDamage); return HAM_HANDLED; } return HAM_IGNORED; } public fw_TraceAttack(ent, attacker, Float:damage, Float:dir[3], ptr, iDamageType) { if(is_user_player(attacker) && g_Ak47Gold[attacker] == 1 && is_user_alive(attacker) && get_user_weapon(attacker) == CSW_AK47) { new Float:flEnd[3]; get_tr2(ptr, TR_vecEndPos, flEnd); message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(TE_BEAMENTPOINT); write_short(attacker | 0x1000); engfunc(EngFunc_WriteCoord, flEnd[0]); engfunc(EngFunc_WriteCoord, flEnd[1]); engfunc(EngFunc_WriteCoord, flEnd[2]); write_short(SpriteTexture); write_byte(0); // framerate write_byte(0); // framerate write_byte(1); // life write_byte(5); // width write_byte(0); // noise write_byte(255); // r, g, b write_byte(215); // r, g, b write_byte(0); // r, g, b write_byte(200); // brightness write_byte(10); // speed message_end(); } return HAM_IGNORED; } public fw_AddToPlayer(ent, id) { if(is_valid_ent(ent) && is_user_connected(id) && entity_get_int(ent, EV_INT_WEAPONKEY) == GAK_WEAPONKEY) { g_Ak47Gold[id] = 1; entity_set_int(ent, EV_INT_WEAPONKEY, 0); return HAM_HANDLED; } return HAM_IGNORED; } public fw_SetModel(entity, model[]) { if(!is_valid_ent(entity)) return FMRES_IGNORED; if(!equal(model, "models/w_ak47.mdl")) return FMRES_IGNORED; static szClassName[33]; entity_get_string(entity, EV_SZ_classname, szClassName, charsmax(szClassName)); if(!equal(szClassName, "weaponbox")) return FMRES_IGNORED static iOwner, iStoredAkID iOwner = entity_get_edict(entity, EV_ENT_owner); iStoredAkID = fm_find_ent_by_owner(ENG_NULLENT, "weapon_ak47", entity); if(g_Ak47Gold[iOwner] == 1 && is_valid_ent(iStoredAkID)) { entity_set_int(iStoredAkID, EV_INT_WEAPONKEY, GAK_WEAPONKEY); g_Ak47Gold[iOwner] = 0; entity_set_model(entity, GoldenAK[2]); return FMRES_SUPERCEDE; } return FMRES_IGNORED; } public fw_CmdStart(id, uc_handle, seed) { if(!is_user_alive(id)) return PLUGIN_HANDLED if((get_uc(uc_handle, UC_Buttons) & IN_ATTACK2) && !(pev(id, pev_oldbuttons) & IN_ATTACK2)) { if(get_user_weapon(id) == CSW_AK47 && g_Ak47Gold[id] == 1) { switch(g_Ak47GoldenZoom[id]) { case 1: { g_Ak47GoldenZoom[id] = 0; cs_set_user_zoom(id, CS_RESET_ZOOM, 0); } case 0: { g_Ak47GoldenZoom[id] = 1 cs_set_user_zoom(id, CS_SET_AUGSG552_ZOOM, 0); emit_sound(id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100); } } } return PLUGIN_CONTINUE; } return PLUGIN_HANDLED; } public fw_PlayerPreThink(id) { if(!is_user_alive(id) || g_HealthRegen[id] == 0 || is_user_zombie(id)) return FMRES_IGNORED; static Float:gametime gametime = get_gametime(); if(get_user_health(id) < 200 && g_RegenDelay[id] < gametime) { set_user_health(id, get_user_health(id) + 1); g_RegenDelay[id] = gametime + 1; } return FMRES_IGNORED; } public msg_ScreenFade(msgid, dest, id) { if(g_item[0][id] == 1 && is_user_zombie(id) && is_user_connected(id)) { static data[4]; data[0] = get_msg_arg_int(4); data[1] = get_msg_arg_int(5); data[2] = get_msg_arg_int(6); data[3] = get_msg_arg_int(7); if(data[0] == 255 && data[1] == 255 && data[2] == 255 && data[3] > 199) return PLUGIN_HANDLED; } return PLUGIN_CONTINUE; } public cmd_use_power(id) { if(is_user_alive(id) && is_user_zombie(id) && g_item[3][id] == 1) { set_dhudmessage(20, 255, 0, -1.0, 0.78, 0, _, 1.0); if(g_PowerGlobalDelay > 0) { show_dhudmessage(id, "Strip ability not ready.^n(%d second%s remaining)", g_PowerGlobalDelay, g_PowerGlobalDelay == 1 ? "" : "s"); } else if(g_PowerDelay[id] > 0) { show_dhudmessage(id, "Strip ability not ready.^n(%d second%s remaining)", g_PowerDelay[id], g_PowerDelay[id] == 1 ? "" : "s"); } else { g_PowerDelay[id] = 15; PowerDelay(id); new target, body; static Float:StartPos[3], Float:EndPos[3]; pev(id, pev_origin, StartPos); fm_get_aim_origin(id, EndPos); StartPos[2] += 16.0; EndPos[2] += 16.0; get_user_aiming(id, target, body, 90000); if(is_user_alive(target) && get_user_team(id) != get_user_team(target)) { message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(TE_EXPLOSION); engfunc(EngFunc_WriteCoord, EndPos[0]); engfunc(EngFunc_WriteCoord, EndPos[1]); engfunc(EngFunc_WriteCoord, EndPos[2]); write_short(PowerSprite); write_byte(10); write_byte(30); write_byte(4); message_end(); emit_sound(id, CHAN_WEAPON, PowerSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM); emit_sound(target, CHAN_AUTO, TargetAimingSound[random_num(0, charsmax(TargetAimingSound))], VOL_NORM, ATTN_NORM, 0, PITCH_NORM); ShakeScreen(target, 3.0); CreateTeBeamCylinder(target); CreateThunder(target); new szWeapons[32], iNum; get_user_weapons(target, szWeapons, iNum); for(new i = 0; i < iNum; i++) { if(PRIMARY_WEAPONS_BIT_SUM|SECONDARY_WEAPONS_BIT_SUM & (1<<szWeapons[i])) { static szWeaponName[32]; get_weaponname(szWeapons[i], szWeaponName, charsmax(szWeaponName)); bacon_strip_weapon(target, szWeaponName); } } ColorChat(target, "!4%s!1 YOU LOST YOUR WEAPONS", TAG); if(!is_user_connected(target)) { ColorChat(id, "!4%s!1 You didn't aim corectly.", TAG); } else { new name[32]; get_user_name(target, name, charsmax(name)); ColorChat(id, "!4%s!1 TARGET:!3 %s!1. He loses his weapons.", TAG, name); } ShakeScreen(id, 2.0); } message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(TE_BEAMENTS); write_short(id); write_short(target); write_short(Lightning); write_byte(0); write_byte(15); write_byte(20); write_byte(80); write_byte(10); write_byte(47); write_byte(217); write_byte(90); write_byte(255); write_byte(0); message_end(); } } return PLUGIN_CONTINUE; } public CreateTeBeamCylinder(id) { new fOrigin[3]; get_user_origin(id, fOrigin, 0); message_begin(MSG_ALL, SVC_TEMPENTITY); write_byte(21); write_coord(fOrigin[0]); write_coord(fOrigin[1]); write_coord(fOrigin[2] + 10); write_coord(fOrigin[0]); write_coord(fOrigin[1]); write_coord(fOrigin[2] + 80); write_short(ShockWave); write_byte(0); write_byte(0); write_byte(4); write_byte(60); write_byte(0); write_byte(100); write_byte(200); write_byte(50); write_byte(255); write_byte(0); message_end(); } public CreateThunder(id) { new fOrigin[3], iStartPos[3]; get_user_origin(id, fOrigin); fOrigin[2] -= 26; iStartPos[0] = fOrigin[0] + 150; iStartPos[1] = fOrigin[1] + 150; iStartPos[2] = fOrigin[2] + 800; message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(TE_BEAMPOINTS); write_coord(iStartPos[0]); write_coord(iStartPos[1]); write_coord(iStartPos[2]); write_coord(fOrigin[0]); write_coord(fOrigin[1]); write_coord(fOrigin[2]); write_short(Lightning); write_byte(1); write_byte(5); write_byte(7); write_byte(20); write_byte(30); write_byte(255); write_byte(251); write_byte(176); write_byte(200); write_byte(200); message_end(); message_begin(MSG_PVS, SVC_TEMPENTITY, fOrigin); write_byte(TE_SPARKS); write_coord(fOrigin[0]); write_coord(fOrigin[1]); write_coord(fOrigin[2]); message_end(); } public ShakeScreen(id, const Float:iSeconds) { static g_msg_SS = 0; if(!g_msg_SS) g_msg_SS = get_user_msgid("ScreenShake"); message_begin(MSG_ONE, g_msg_SS, _, id); write_short(floatround(4096.0 * iSeconds, floatround_round)); write_short(floatround(4096.0 * iSeconds, floatround_round)); write_short(1<<13); message_end(); } stock fm_get_aim_origin(id, Float:fOrigin[3]) { new Float:start[3], Float:view_ofs[3]; pev(id, pev_origin, start); pev(id, pev_view_ofs, view_ofs); xs_vec_add(start, view_ofs, start); new Float:dest[3]; pev(id, pev_v_angle, dest); engfunc(EngFunc_MakeVectors, dest); global_get(glb_v_forward, dest); xs_vec_mul_scalar(dest, 9999.0, dest); xs_vec_add(start, dest, dest); engfunc(EngFunc_TraceLine, start, dest, 0, id, 0); get_tr2(0, TR_vecEndPos, fOrigin); return PLUGIN_HANDLED; } public reset_vars(id) { if(g_item[3][id] == 1) if(task_exists(TASK_DELAY + id)) remove_task(TASK_DELAY + id); new i; for(i = 0; i < 4; i++) g_item[i][id] = 0; if(g_Ak47Gold[id]) { g_Ak47Gold[id] = 0; g_Ak47GoldenZoom[id] = 0; cs_set_user_zoom(id, CS_RESET_ZOOM, 0); } g_HealthRegen[id] = 0; g_RegenDelay[id] = 0.0; } public PowerGlobalDelay() { new Players[32], Num, id; get_players(Players, Num); for(new i = 0; i < Num; i++) { id = Players[i]; if(is_user_zombie(id)) { if(g_PowerGlobalDelay > 1) { g_PowerGlobalDelay--; set_task(1.0, "PowerGlobalDelay") } else if(g_PowerGlobalDelay <= 1) { g_PowerGlobalDelay = 0; if(is_user_alive(id)) { set_dhudmessage(20, 255, 0, -1.0, 0.78, 0, _, 2.0); show_dhudmessage(id, "STRIP ABILITY is ready.^nNow, find a HUMAN and strip his weapons."); } } } } } public PowerDelay(id) { if(id >= TASK_DELAY) id -= TASK_DELAY; if(is_user_alive(id) && is_user_zombie(id)) { if(g_PowerDelay[id] > 1) { g_PowerDelay[id]--; set_task(1.0, "PowerDelay", id+TASK_DELAY); } else if(g_PowerDelay[id] <= 1) { g_PowerDelay[id] = 0; set_dhudmessage(20, 255, 0, -1.0, 0.78, 0, _, 2.0); show_dhudmessage(id, "STRIP ABILITY is ready.^nNow, find a HUMAN and strip his weapons."); } } } stock ColorChat(id, String[], any:...) { static szMesage[192]; vformat(szMesage, charsmax(szMesage), String, 3); replace_all(szMesage, charsmax(szMesage), "!1", "^1"); replace_all(szMesage, charsmax(szMesage), "!3", "^3"); replace_all(szMesage, charsmax(szMesage), "!4", "^4"); static g_msg_SayText = 0; if(!g_msg_SayText) g_msg_SayText = get_user_msgid("SayText"); new Players[32], iNum = 1, i; if(id) Players[0] = id; else get_players(Players, iNum, "ch"); for(--iNum; iNum >= 0; iNum--) { i = Players[iNum]; message_begin(MSG_ONE_UNRELIABLE, g_msg_SayText, _, i); write_byte(i); write_string(szMesage); message_end(); } } stock fm_find_ent_by_owner(id, const szClassName[], iOwner, jghgtype = 0) { new str_type[11] = "classname", iEnt = id; switch(jghgtype) { case 1: str_type = "target"; case 2: str_type = "targetname"; } while((iEnt = engfunc(EngFunc_FindEntityByString, iEnt, str_type, szClassName)) && pev(iEnt, pev_owner) != iOwner) { } return iEnt; } stock bacon_strip_weapon(index, weapon[]) { if(!equal(weapon, "weapon_", 7)) return PLUGIN_CONTINUE; static weaponid; weaponid = get_weaponid(weapon) if(!weaponid) return PLUGIN_CONTINUE; static weaponent; weaponent = fm_find_ent_by_owner(-1, weapon, index); if(!weaponent) return PLUGIN_CONTINUE; if(get_user_weapon(index) == weaponid) ExecuteHamB(Ham_Weapon_RetireWeapon, weaponent); if(!ExecuteHamB(Ham_RemovePlayerItem, index, weaponent)) return PLUGIN_CONTINUE; ExecuteHamB(Ham_Item_Kill, weaponent); set_pev(index, pev_weapons, pev(index, pev_weapons) & ~(1<<weaponid)); return PLUGIN_HANDLED; } // from biohazard by cheap_suit stock bool:allow_infection() { static count[2]; count[0] = 0; count[1] = 0; static index; for(index = 1; index <= max_players; index++) { if(is_user_connected(index) && is_user_zombie(index)) count[0]++; else if(is_user_alive(index)) count[1]++; } return (count[0] < 31 && count[1] > 1) ? true : false; } Attachment 200272 Attached Files Get Plugin or Get Source (item_invisibilidad.sma - 1.6 KB) Przeczytaj cały wpis Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi