Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

RSSAdd item to shop


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
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 0g_PowerDelay[33];
new 
SpriteTextureLightningPowerSpriteShockWave;
new 
menutext_menu[128], text_items[5][128], menu_callbackmoney;
new 
data[6], name[64], accessCallBack;
new 
max_playerscvar_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[][] = 
{
    {
0022},    // intre ora 00:00 si 07:00
    
{1617}    // 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_NAMEPLUGIN_VERSIONPLUGIN_AUTHORS);
    
is_biomod_active() ? plugin_init2() : pause("ad")
}

public 
plugin_init2()
{
    new 
omsi;
    
time(oms);
    for(
0sizeof ignore_cost_hoursi++)
    {
        if(
>=  ignore_cost_hours[i][0] && 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(
0sizeof GoldenAKi++)
        
precache_model(GoldenAK[i]);

    for(
0sizeof TargetAimingSoundi++)
        
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_hostnameg_HostNamecharsmax(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_menucharsmax(text_menu), "\wHumans SHOP_HUMANS | Money:\r %d^n\y%s"cs_get_user_money(id), g_HostName) : formatex(text_menucharsmax(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(menutext_items[0], "1"0menu_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(menutext_items[1], "2"0menu_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(menutext_items[2], "3"0menu_callback);

    
formatex(text_items[3], charsmax(text_items[]), "Infect me -\r %d $"SHOP_HUMANS[COST_INFECTME]);
    
menu_additem(menutext_items[3], "4"0menu_callback);

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
    
    return 
PLUGIN_CONTINUE;
}

public 
CallBackMenuH(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    
money cs_get_user_money(id);
    
menu_item_getinfo(menuitemaccessdatacharsmax(data), namecharsmax(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(idCSW_SMOKEGRENADE))
                return 
ITEM_DISABLED;
        }
        case 
4:
        {
            if(
SHOP_HUMANS[COST_INFECTME] > money || !allow_infection())
                return 
ITEM_DISABLED;
        }
    }
    
    return 
ITEM_ENABLED;
}

public 
HumansHandler(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    
money cs_get_user_money(id);
    
menu_item_getinfo(menuitemaccessdatacharsmax(data), namecharsmax(name), CallBack);
    new 
key str_to_num(data);

    switch(
key)
    {
        case 
1:
        {
            new 
szWeapons[32], iNum;
            
get_user_weapons(idszWeaponsiNum);

            for(new 
0iNumi++)
            {
                if(
PRIMARY_WEAPONS_BIT_SUM & (1<<szWeapons[i]))
                {
                    new 
weaponname[32];
                    
get_weaponname(szWeapons[i], weaponnamecharsmax(weaponname));
                    
bacon_strip_weapon(idweaponname);
                }
            }
            
g_Ak47Gold[id] = 1;
            
give_item(id"weapon_ak47");

            if(!
ignorecost)
            {
                new 
cost_ak47 SHOP_HUMANS[COST_GOLDEN_AK47];
                
cs_set_user_money(idmoney cost_ak47);
                
ColorChat(id"!4%s!1 You bought!3 Golden AK-47!1 with!3 %d!1 money."TAGcost_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(idmoney cost_regen);
                
ColorChat(id"!4%s!1 You bought!3 health regenerator!1 with!3 %d!1 money."TAGcost_regen);
            }
        }

        case 
3:
        {
            if(!
ignorecost)
            {
                new 
cost_fn SHOP_HUMANS[COST_FROSTNADE];
                
cs_set_user_money(idmoney cost_fn);
                
ColorChat(id"!4%s!1 You bought a!3 frostnade!1 with!3 %d!1 money."TAGcost_fn);
            }

            
give_item(id"weapon_smokegrenade");
        }

        case 
4:
        {
            
infect_user(id0);
            
            new 
zm_name[32];
            
get_user_name(idzm_namecharsmax(zm_name));
            
ColorChat(0"!4%s!3 %s!1 become a zombie. He was infected by a strange plague."TAGzm_name);
        }
    }

    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}

public 
ZombieShop(id)
{
    
formatex(text_menucharsmax(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(menutext_items[0], "1"0menu_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(menutext_items[1], "2"0menu_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(menutext_items[2], "3"0menu_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(menutext_items[3], "4"0menu_callback);

    
formatex(text_items[4], charsmax(text_items[]), "STRIP HUMANS WEAPONS [\y%d XP\w]"SHOP_ZOMBIES[COST_STRIPW]);
    
menu_additem(menutext_items[4], "5"0menu_callback);

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
    
    return 
PLUGIN_CONTINUE;
}

public 
CallBackMenuZ(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    new 
data[6], name[64], accessCallBack;
    
menu_item_getinfo(menuitemaccessdatacharsmax(data), namecharsmax(name), CallBack);
    
    switch(
data[0])
    {
        case 
'1':
        {
            if(
g_user_xp[id] < || SHOP_ZOMBIES[COST_NOFLASH] > g_user_xp[id] || g_item[0][id] == 1)
                return 
ITEM_DISABLED;
        }
        case 
'2':
        {
            if(
g_user_xp[id] < || SHOP_ZOMBIES[COST_SPEED] > g_user_xp[id] || g_item[1][id] == 1)
                return 
ITEM_DISABLED;
        }
        case 
'3':
        {
            if(
g_user_xp[id] < || SHOP_ZOMBIES[COST_HEALTH] > g_user_xp[id] || get_user_health(id) >= 500)
                return 
ITEM_DISABLED;
        }
        case 
'4':
        {
            if(
g_user_xp[id] < || SHOP_ZOMBIES[COST_GRAVITY] > g_user_xp[id] || g_item[2][id] == 1)
                return 
ITEM_DISABLED;
        }
        case 
'5':
        {
            if(
g_user_xp[id] < || SHOP_ZOMBIES[COST_STRIPW] > g_user_xp[id] || g_item[3][id] == 1)
                return 
ITEM_DISABLED;
        }
    }
    
    return 
ITEM_ENABLED;
}

public 
ZombiesHandler(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    new 
data[6], name[64], accessCallBack;
    
menu_item_getinfo(menuitemaccessdatacharsmax(data), namecharsmax(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."TAGcost_nf);
        }
        case 
2:
        {
            new 
Float:speed 0.2 get_user_maxspeed(id);
            new 
cost_speed SHOP_ZOMBIES[COST_SPEED];
            
set_user_maxspeed(idget_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."TAGspeedcost_speed);
        }
        case 
3:
        {
            new 
Float:health;
            
pev(idpev_healthhealth);

            new 
Float:hp 0.3 health;
            new 
cost_hp SHOP_ZOMBIES[COST_HEALTH];
            new 
Float:max_hp 500.0;

            
message_begin(MSG_ONEg_msg_ItemPickUp_id);
            
write_string("cross");
            
write_byte(255);
            
write_byte(0);
            
write_byte(0);
            
message_end();

            
emit_sound(idCHAN_VOICE"items/tr_kevlar.wav"VOL_NORMATTN_NORM0PITCH_NORM);

            
set_pev(idpev_healthfloatclamp(health hp0.0max_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 hpcost_hp);
        }
        case 
4:
        {
            new 
Float:gravity 0.5 get_user_gravity(id);
            new 
cost_gv SHOP_ZOMBIES[COST_GRAVITY];
            
set_user_gravity(idget_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."TAGcost_gvget_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], Numidi;
    
get_players(PlayersNum);
    for(
0Numi++)
    {
        
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(victiminfector)
{
    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(idpev_viewmodel2GoldenAK[0]);
        
set_pev(idpev_weaponmodel2GoldenAK[1]);

        
// unlimited clip
        
set_pdata_int(get_pdata_cbase(id373), 51304);
    }

    return 
PLUGIN_CONTINUE;
}

public 
event_Damage(victim)
{
    if(!
is_user_alive(victim) || g_HealthRegen[victim] == || 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(iVictimiInflictoriAttackerFloat:fDamageiDmgType)
{
    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(4fDamage);
        return 
HAM_HANDLED;
    }

    return 
HAM_IGNORED;
}

public 
fw_TraceAttack(entattackerFloat:damageFloat:dir[3], ptriDamageType)
{
    if(
is_user_player(attacker) && g_Ak47Gold[attacker] == && is_user_alive(attacker) && get_user_weapon(attacker) == CSW_AK47)
    {
        new 
Float:flEnd[3];
        
get_tr2(ptrTR_vecEndPosflEnd);

        
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
        
write_byte(TE_BEAMENTPOINT);
        
write_short(attacker 0x1000);
        
engfunc(EngFunc_WriteCoordflEnd[0]);
        
engfunc(EngFunc_WriteCoordflEnd[1]);
        
engfunc(EngFunc_WriteCoordflEnd[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(entid)
{
    if(
is_valid_ent(ent) && is_user_connected(id) && entity_get_int(entEV_INT_WEAPONKEY) == GAK_WEAPONKEY)
    {
        
g_Ak47Gold[id] = 1;
        
entity_set_int(entEV_INT_WEAPONKEY0);

        return 
HAM_HANDLED;
    }

    return 
HAM_IGNORED;
}

public 
fw_SetModel(entitymodel[])
{
    if(!
is_valid_ent(entity))
        return 
FMRES_IGNORED;
        
    if(!
equal(model"models/w_ak47.mdl")) 
        return 
FMRES_IGNORED;
        
    static 
szClassName[33];
    
entity_get_string(entityEV_SZ_classnameszClassNamecharsmax(szClassName));
        
    if(!
equal(szClassName"weaponbox"))
        return 
FMRES_IGNORED
    
    
static iOwneriStoredAkID
    iOwner 
entity_get_edict(entityEV_ENT_owner);
    
iStoredAkID fm_find_ent_by_owner(ENG_NULLENT"weapon_ak47"entity);
    
    if(
g_Ak47Gold[iOwner] == && is_valid_ent(iStoredAkID))
    {
        
entity_set_int(iStoredAkIDEV_INT_WEAPONKEYGAK_WEAPONKEY);

        
g_Ak47Gold[iOwner] = 0;
        
entity_set_model(entityGoldenAK[2]);
        
        return 
FMRES_SUPERCEDE;
    }

    return 
FMRES_IGNORED;
}

public 
fw_CmdStart(iduc_handleseed)
{
    if(!
is_user_alive(id)) 
        return 
PLUGIN_HANDLED
    
    
if((get_uc(uc_handleUC_Buttons) & IN_ATTACK2) && !(pev(idpev_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(idCS_RESET_ZOOM0);
                }

                case 
0:
                {
                    
g_Ak47GoldenZoom[id] = 1
                    cs_set_user_zoom
(idCS_SET_AUGSG552_ZOOM0);
                    
emit_sound(idCHAN_ITEM"weapons/zoom.wav"0.202.400100);
                }
            }
        }

        return 
PLUGIN_CONTINUE;
    }

    return 
PLUGIN_HANDLED;
}

public 
fw_PlayerPreThink(id)
{
    if(!
is_user_alive(id) || g_HealthRegen[id] == || 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(idget_user_health(id) + 1);
        
g_RegenDelay[id] = gametime 1;
    }
    
    return 
FMRES_IGNORED;
}

public 
msg_ScreenFade(msgiddestid)
{
    if(
g_item[0][id] == && 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(202550, -1.00.780_1.0);

        if(
g_PowerGlobalDelay 0)
        {
            
show_dhudmessage(id"Strip ability not ready.^n(%d second%s remaining)"g_PowerGlobalDelayg_PowerGlobalDelay == "" "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] == "" "s");
        }
        else
        {
            
g_PowerDelay[id] = 15;
            
PowerDelay(id);

            new 
targetbody;
            static 
Float:StartPos[3], Float:EndPos[3];
        
            
pev(idpev_originStartPos);
            
fm_get_aim_origin(idEndPos);
        
            
StartPos[2] += 16.0;
            
EndPos[2] += 16.0;
            
get_user_aiming(idtargetbody90000);
        
            if(
is_user_alive(target) && get_user_team(id) != get_user_team(target))
            {
                
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
                
write_byte(TE_EXPLOSION);
                
engfunc(EngFunc_WriteCoordEndPos[0]);
                
engfunc(EngFunc_WriteCoordEndPos[1]);
                
engfunc(EngFunc_WriteCoordEndPos[2]);
                
write_short(PowerSprite);
                
write_byte(10);
                
write_byte(30);
                
write_byte(4);
                
message_end();
            
                
emit_sound(idCHAN_WEAPONPowerSoundVOL_NORMATTN_NORM0PITCH_NORM);
                
emit_sound(targetCHAN_AUTOTargetAimingSound[random_num(0charsmax(TargetAimingSound))], VOL_NORMATTN_NORM0PITCH_NORM);
            
                
ShakeScreen(target3.0);
                
CreateTeBeamCylinder(target);
                
CreateThunder(target);
            
                new 
szWeapons[32], iNum;
                
get_user_weapons(targetszWeaponsiNum);

                for(new 
0iNumi++)
                {
                    if(
PRIMARY_WEAPONS_BIT_SUM|SECONDARY_WEAPONS_BIT_SUM & (1<<szWeapons[i]))
                    {
                        static 
szWeaponName[32];
                        
get_weaponname(szWeapons[i], szWeaponNamecharsmax(szWeaponName));
                        
bacon_strip_weapon(targetszWeaponName);
                    }
                }
                
                
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(targetnamecharsmax(name));
                    
ColorChat(id"!4%s!1 TARGET:!3 %s!1. He loses his weapons."TAGname);
                }
    
                
ShakeScreen(id2.0);
            }

            
message_begin(MSG_BROADCASTSVC_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(idfOrigin0);
    
    
message_begin(MSG_ALLSVC_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(idfOrigin);
    
    
fOrigin[2] -= 26;
    
iStartPos[0] = fOrigin[0] + 150;
    
iStartPos[1] = fOrigin[1] + 150;
    
iStartPos[2] = fOrigin[2] + 800;
    
    
message_begin(MSG_BROADCASTSVC_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_PVSSVC_TEMPENTITYfOrigin);
    
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_ONEg_msg_SS_id);
    
write_short(floatround(4096.0 iSecondsfloatround_round));
    
write_short(floatround(4096.0 iSecondsfloatround_round));
    
write_short(1<<13);
    
message_end();
}

stock fm_get_aim_origin(idFloat:fOrigin[3])
{
    new 
Float:start[3], Float:view_ofs[3];
    
pev(idpev_originstart);
    
pev(idpev_view_ofsview_ofs);
    
xs_vec_add(startview_ofsstart);
    
    new 
Float:dest[3];
    
pev(idpev_v_angledest);
    
engfunc(EngFunc_MakeVectorsdest);
    
global_get(glb_v_forwarddest);
    
xs_vec_mul_scalar(dest9999.0dest);
    
xs_vec_add(startdestdest);
    
    
engfunc(EngFunc_TraceLinestartdest0id0);
    
get_tr2(0TR_vecEndPosfOrigin);
    
    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(
04i++)
        
g_item[i][id] = 0;
        
    if(
g_Ak47Gold[id])
    {
        
g_Ak47Gold[id] = 0;
        
g_Ak47GoldenZoom[id] = 0;
        
cs_set_user_zoom(idCS_RESET_ZOOM0);
    }
    
    
g_HealthRegen[id] = 0;
    
g_RegenDelay[id] = 0.0;
}

public 
PowerGlobalDelay()
{
    new 
Players[32], Numid;
    
get_players(PlayersNum);
            
    for(new 
0Numi++)
    {
        
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(202550, -1.00.780_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(202550, -1.00.780_2.0);
            
show_dhudmessage(id"STRIP ABILITY is ready.^nNow, find a HUMAN and strip his weapons.");
        }
    }
}

stock ColorChat(idString[], any:...)
{
    static 
szMesage[192];
    
vformat(szMesagecharsmax(szMesage), String3);
    
    
replace_all(szMesagecharsmax(szMesage), "!1""^1");
    
replace_all(szMesagecharsmax(szMesage), "!3""^3");
    
replace_all(szMesagecharsmax(szMesage), "!4""^4");
    
    static 
g_msg_SayText 0;
    if(!
g_msg_SayText)
        
g_msg_SayText get_user_msgid("SayText");
    
    new 
Players[32], iNum 1i;

     if(
idPlayers[0] = id;
    else 
get_players(PlayersiNum"ch");
    
    for(--
iNumiNum >= 0iNum--)
    {
        
Players[iNum];
    
        
message_begin(MSG_ONE_UNRELIABLEg_msg_SayText_i);
        
write_byte(i);
        
write_string(szMesage);
        
message_end();
    }
}

stock fm_find_ent_by_owner(id, const szClassName[], iOwnerjghgtype 0)
{
    new 
str_type[11] = "classname"iEnt id;

    switch(
jghgtype) {

        case 
1str_type "target";
        case 
2str_type "targetname";
    }

    while((
iEnt engfunc(EngFunc_FindEntityByStringiEntstr_typeszClassName)) && pev(iEntpev_owner) != iOwner) {  }
    return 
iEnt;
}

stock bacon_strip_weapon(indexweapon[])
{
    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(-1weaponindex);
    
    if(!
weaponent)
        return 
PLUGIN_CONTINUE;

    if(
get_user_weapon(index) == weaponid
        
ExecuteHamB(Ham_Weapon_RetireWeaponweaponent);

    if(!
ExecuteHamB(Ham_RemovePlayerItemindexweaponent)) 
        return 
PLUGIN_CONTINUE;
    
    
ExecuteHamB(Ham_Item_Killweaponent);
    
set_pev(indexpev_weaponspev(indexpev_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 1index <= max_playersindex++)
    {
        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
File Type: sma Get Plugin or Get Source (item_invisibilidad.sma - 1.6 KB)

Przeczytaj cały wpis

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...