AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   Subplugin Submission [ZP] Extra Item: Balrog Ethereal (https://forums.alliedmods.net/showthread.php?t=274344)

botz 11-26-2015 17:24

Re: [ZP] Extra Item: Balrog Ethereal
 
Quote:

Originally Posted by botz (Post 2364393)
There is a problem

When the shooter shoots, he hears the LASER sound but other people in game only hear normal UMP sound, please fix it for both , so both can hear the laser shooter and the other people,

Please post the code below and tell me what you changed / add

Thanks

7 days and no fix yet? Can you please post the fix now..?

CrazY. 11-26-2015 17:53

Re: [ZP] Extra Item: Balrog Ethereal
 
Sorry guy, I'm working on the new version of the zombie plague, sorry for the delay, I will soon fix this problem.

Krtola 12-03-2015 19:19

Re: [ZP] Extra Item: Balrog Ethereal
 
botz try this version:

PHP Code:

#include < amxmodx >
#include < fun >
#include < cstrike >
#include < engine >
#include < fakemeta >
#include < hamsandwich >
#include < zombieplague >

#define WEAPON_BITSUM ((1<<CSW_UMP45))

new const VERSION[] = "1.2";

#define ITEM_NAME "[Balrog] Ethereal"
#define ITEM_COST 40

new const V_ETHEREAL_MDL[64] = "models/zombie_plague/v_balrog_ethereal.mdl";
new const 
P_ETHEREAL_MDL[64] = "models/zombie_plague/p_balrog_ethereal.mdl";
new const 
W_ETHEREAL_MDL[64] = "models/zombie_plague/w_balrog_ethereal.mdl";
new const 
OLD_W_MDL[64] = "models/w_ump45.mdl";

new const 
GUNSHOT_DECALS[] = { 4142434445 }

new const 
ETHEREAL_SOUNDS[][] = {"weapons/ethereal_draw.wav""weapons/ethereal_idle1.wav""weapons/ethereal_reload.wav"}

new const 
ETHEREAL_SHOOT[][] = { "weapons/ethereal_shoot.wav" }

new 
g_itemid g_has_ethereal[33] , g_hamczbots g_clip_ammo[33] , blood_spr[2] , laserbeam_spr cvar_ethereal_damage_x cvar_ethereal_clip cvar_ethereal_bpammo cvar_ethereal_shotspd cvar_ethereal_oneround cvar_botquota;

public 
plugin_init()
{
    
// Plugin Register
    
register_plugin("[ZP] Extra Item: Balrog Ethereal"VERSION"CrazY");

    
// Extra Item Register
    
g_itemid zp_register_extra_item(ITEM_NAMEITEM_COSTZP_TEAM_HUMAN);

    
// Cvars Register
    
cvar_ethereal_damage_x register_cvar("zp_balrog_ethereal_damage_x""4.0");
    
cvar_ethereal_clip register_cvar("zp_balrog_ethereal_clip""40");
    
cvar_ethereal_bpammo register_cvar("zp_balrog_ethereal_bpammo""200");
    
cvar_ethereal_shotspd register_cvar("zp_balrog_ethereal_shot_speed""0.11");
    
cvar_ethereal_oneround register_cvar("zp_balrog_ethereal_oneround""0");

    
// Cvar Pointer
    
cvar_botquota get_cvar_pointer("bot_quota");

    
// Events
    
register_event("CurWeapon""event_CurWeapon""b""1=1");
    
register_event("HLTV""event_RoundStart""a""1=0""2=0");
    
register_event("DeathMsg""event_DeathMsg""a""1>0");

    
// Forwards
    
register_forward(FM_SetModel"fw_SetModel");
    
register_forward(FM_UpdateClientData"fw_UpdateClientData_Post"1);

    
// Hams
    
RegisterHam(Ham_Item_PostFrame"weapon_ump45""fw_ItemPostFrame");
    
RegisterHam(Ham_Item_AddToPlayer"weapon_ump45""fw_AddToPlayer");
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_ump45""fw_PrimaryAttack");
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_ump45""fw_PrimaryAttack_Post"1);
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage");
}

public 
plugin_precache()
{
    
// Models
    
precache_model(V_ETHEREAL_MDL);
    
precache_model(P_ETHEREAL_MDL);
    
precache_model(W_ETHEREAL_MDL);
    
precache_model(OLD_W_MDL);

    
// Blood Sprites
    
blood_spr[0] = precache_model("sprites/blood.spr");
    
blood_spr[1] = precache_model("sprites/bloodspray.spr");
    
laserbeam_spr precache_model("sprites/laserbeam.spr");

    
// Sounds
    
for(new 0sizeof ETHEREAL_SOUNDSi++) precache_sound(ETHEREAL_SOUNDS[i]);
    
precache_sound(ETHEREAL_SHOOT[0])
}

public 
client_putinserver(id)
{
    
g_has_ethereal[id] = false;

    if (
is_user_bot(id) && !g_hamczbots && cvar_botquota)
    {
        
set_task(0.1"register_ham_czbots"id);
    }
}

public 
client_disconnect(id)
{
    
g_has_ethereal[id] = false;
}

public 
client_connect(id)
{
    
g_has_ethereal[id] = false;
}

public 
zp_user_humanized_post(idhuman)
{
    if(
get_pcvar_num(cvar_ethereal_oneround))
        
g_has_ethereal[id] = false;
}

public 
zp_user_infected_post(id)
{
    
g_has_ethereal[id] = false;
}

public 
register_ham_czbots(id)
{
    if (
g_hamczbots || !is_user_bot(id) || !get_pcvar_num(cvar_botquota))
        return;

    
RegisterHamFromEntity(Ham_TakeDamageid"fw_TakeDamage");

    
g_hamczbots true;
}

public 
zp_extra_item_selected(playeritemid)
{
    if(
itemid == g_itemid)
    {
        if(
user_has_weapon(playerCSW_UMP45))
        {
            
drop_primary(player);
        }
        
g_has_ethereal[player] = true;
        new 
wpnid give_item(player"weapon_ump45");
        
client_print_color(player"!g[ZP] !yYou Bought !t%s!y."ITEM_NAME);
        
cs_set_weapon_ammo(wpnidget_pcvar_num(cvar_ethereal_clip));
        
cs_set_user_bpammo(playerCSW_UMP45get_pcvar_num(cvar_ethereal_bpammo));
    }
}

public 
event_CurWeapon(id)
{
    if (!
is_user_alive(id) || zp_get_user_zombie(id)) return PLUGIN_HANDLED;
    
    if (
read_data(2) == CSW_UMP45 && g_has_ethereal[id])
    {
        
set_pev(idpev_viewmodel2V_ETHEREAL_MDL);
        
set_pev(idpev_weaponmodel2P_ETHEREAL_MDL);
    }
    return 
PLUGIN_CONTINUE;
}

public 
event_RoundStart()
{
    if(
get_pcvar_num(cvar_ethereal_oneround))
    {
        for (new 
1<= get_maxplayers(); i++)
            
g_has_ethereal[i] = false;
    }
}

public 
event_DeathMsg()
{
    
g_has_ethereal[read_data(2)] = false;
}

public 
fw_SetModel(entitymodel[])
{
    if(!
pev_valid(entity) || !equal(modelOLD_W_MDL)) return FMRES_IGNORED;
    
    static 
szClassName[33]; pev(entitypev_classnameszClassNamecharsmax(szClassName));
    if(!
equal(szClassName"weaponbox")) return FMRES_IGNORED;
    
    static 
ownerwpn;
    
owner pev(entitypev_owner);
    
wpn find_ent_by_owner(-1"weapon_ump45"entity);
    
    if(
g_has_ethereal[owner] && pev_valid(wpn))
    {
        
g_has_ethereal[owner] = false;
        
set_pev(wpnpev_impulse43553);
        
engfunc(EngFunc_SetModelentityW_ETHEREAL_MDL);
        
        return 
FMRES_SUPERCEDE;
    }
    return 
FMRES_IGNORED;
}

public 
fw_UpdateClientData_Post(idsendweaponscd_handle)
{
    if(
is_user_alive(id) && get_user_weapon(id) == CSW_UMP45 && g_has_ethereal[id])
    {
        
set_cd(cd_handleCD_flNextAttackhalflife_time () + 0.001);
    }
}

public 
fw_ItemPostFrame(weapon_entity)
{
    new 
id pev(weapon_entitypev_owner);

    if(
g_has_ethereal[id] && is_user_alive(id))
    {
        static 
iClipExtraiClipExtra get_pcvar_num(cvar_ethereal_clip);

        new 
Float:flNextAttack get_pdata_float(id835);

        new 
iBpAmmo cs_get_user_bpammo(idCSW_UMP45);
        new 
iClip get_pdata_int(weapon_entity514);

        new 
fInReload get_pdata_int(weapon_entity544);

        if(
fInReload && flNextAttack <= 0.0)
        {
            new 
Clp min(iClipExtra iClipiBpAmmo);
            
set_pdata_int(weapon_entity51iClip Clp4);
            
cs_set_user_bpammo(idCSW_UMP45iBpAmmo-Clp);
            
set_pdata_int(weapon_entity5404);
        }
    }
}

public 
fw_AddToPlayer(weapon_entityid)
{
    if(
pev_valid(weapon_entity) && is_user_connected(id) && pev(weapon_entitypev_impulse) == 43553 && !g_has_ethereal[id])
    {
        
g_has_ethereal[id] = true;
        
set_pev(weapon_entitypev_impulse0);
        return 
HAM_HANDLED;
    }
    return 
HAM_IGNORED;
}

public 
fw_PrimaryAttack(weapon_entity)
{
    new 
id get_pdata_cbase(weapon_entity414);
    
    if(
g_has_ethereal[id])
    {
        
g_clip_ammo[id] = cs_get_weapon_ammo(weapon_entity);
    }
}

public 
fw_PrimaryAttack_Post(weapon_entity)
{
    new 
id get_pdata_cbase(weapon_entity414);

    if (
g_has_ethereal[id] && g_clip_ammo[id])
    {
        
set_pdata_float(weapon_entity46get_pcvar_float(cvar_ethereal_shotspd), 4);
        
emit_sound(idCHAN_WEAPONETHEREAL_SHOOT[0], VOL_NORMATTN_NORM0PITCH_NORM);
        
UTIL_PlayWeaponAnimation(idrandom_num(35));
        
UTIL_MakeBloodAndBulletHoles(id);
        
UTIL_LaserBeam(id710000);
    }
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damage)
{
    if(
is_user_alive(attacker) && get_user_weapon(attacker) == CSW_UMP45 && g_has_ethereal[attacker])
    {
        
SetHamParamFloat(4damage get_pcvar_float(cvar_ethereal_damage_x));
    }
}

stock UTIL_PlayWeaponAnimation(const Player, const Sequence)
{
    
set_pev(Playerpev_weaponanimSequence);
    
    
message_begin(MSG_ONE_UNRELIABLESVC_WEAPONANIM, .player Player);
    
write_byte(Sequence);
    
write_byte(pev(Playerpev_body));
    
message_end();
}

stock UTIL_MakeBloodAndBulletHoles(id)
{
    new 
aimOrigin[3], targetbody;
    
get_user_origin(idaimOrigin3);
    
get_user_aiming(idtargetbody);
    
    if(
target && target <= get_maxplayers() && zp_get_user_zombie(target))
    {
        new 
Float:fStart[3], Float:fEnd[3], Float:fRes[3], Float:fVel[3];
        
pev(idpev_originfStart);
        
        
velocity_by_aim(id64fVel);
        
        
fStart[0] = float(aimOrigin[0]);
        
fStart[1] = float(aimOrigin[1]);
        
fStart[2] = float(aimOrigin[2]);
        
fEnd[0] = fStart[0]+fVel[0];
        
fEnd[1] = fStart[1]+fVel[1];
        
fEnd[2] = fStart[2]+fVel[2];
        
        new 
res;
        
engfunc(EngFunc_TraceLinefStartfEnd0targetres);
        
get_tr2(resTR_vecEndPosfRes);
        
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
        
write_byte(TE_BLOODSPRITE);
        
write_coord(floatround(fStart[0]));
        
write_coord(floatround(fStart[1]));
        
write_coord(floatround(fStart[2]));
        
write_short(blood_spr[1]);
        
write_short(blood_spr[0]);
        
write_byte(70);
        
write_byte(random_num(1,2));
        
message_end();
        
        
    } 
    else if(!
is_user_connected(target))
    {
        if(
target)
        {
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
            
write_byte(TE_DECAL);
            
write_coord(aimOrigin[0]);
            
write_coord(aimOrigin[1]);
            
write_coord(aimOrigin[2]);
            
write_byte(GUNSHOT_DECALS[random_num(0sizeof GUNSHOT_DECALS -1)]);
            
write_short(target);
            
message_end();
        } 
        else 
        {
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
            
write_byte(TE_WORLDDECAL);
            
write_coord(aimOrigin[0]);
            
write_coord(aimOrigin[1]);
            
write_coord(aimOrigin[2]);
            
write_byte(GUNSHOT_DECALS[random_num(0sizeof GUNSHOT_DECALS -1)]);
            
message_end()
        }
        
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
        
write_byte(TE_GUNSHOTDECAL);
        
write_coord(aimOrigin[0]);
        
write_coord(aimOrigin[1]);
        
write_coord(aimOrigin[2]);
        
write_short(id);
        
write_byte(GUNSHOT_DECALS[random_num(0sizeof GUNSHOT_DECALS -)]);
        
message_end();
    }
}

stock UTIL_LaserBeam(idSizeRGB
{
    static 
End[3]
    
get_user_origin(idEnd3)    
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte (TE_BEAMENTPOINT)
    
write_shortid |0x1000 )
    
write_coord(End[0])
    
write_coord(End[1])
    
write_coord(End[2])
    
write_short(laserbeam_spr)
    
write_byte(0)
    
write_byte(1)
    
write_byte(1)
    
write_byte(Size)
    
write_byte(4)
    
write_byte(R)
    
write_byte(G)
    
write_byte(B)
    
write_byte(255)
    
write_byte(0)
    
message_end()
}

stock drop_primary(id)
{
    new 
weapons[32], num;
    
get_user_weapons(idweaponsnum);
    for (new 
0numi++)
    {
        if (
WEAPON_BITSUM & (1<<weapons[i]))
        {
            static 
wname[32];
            
get_weaponname(weapons[i], wnamesizeof wname 1);
            
engclient_cmd(id"drop"wname);
        }
    }
}

stock client_print_color(const id,const input[], any:...)
{
    new 
msg[191], players[32], count 1vformat(msg,190,input,3);
    
replace_all(msg,190,"!g","^4");    // green
    
replace_all(msg,190,"!y","^1");    // normal
    
replace_all(msg,190,"!t","^3");    // team
        
    
if (idplayers[0] = id; else get_players(players,count,"ch");
        
    for (new 
i=0;i<count;i++)
    {
        if (
is_user_connected(players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]);
            
write_byte(players[i]);
            
write_string(msg);
            
message_end();
        }
    }



botz 12-03-2015 22:17

Re: [ZP] Extra Item: Balrog Ethereal
 
Can you tell me what changes did you make ? So i could know

Thanks for helping

CrazY. 12-04-2015 07:28

Re: [ZP] Extra Item: Balrog Ethereal
 
Krtola, this code not is valid, because is needed to block default Ump45 event.

CrazY. 12-04-2015 11:11

Re: [ZP] Extra Item: Balrog Ethereal FIXED
 
Change log:
Quote:

PHP Code:

v1.0
Released;

v1.1
Fixed the weapon world model bug;
Added a cvar to change the shot speed of the [BalrogEthereal;

v1.2
Fixed the new round bug (zp_balrog_ethereal_oneround);
Added support to ZP 5.0;
Added damage support for the bots without cs_ham_bots_api (.inc and .amxx);

v1.3
Added admin command (amx_give_balrog);
Fixed the sound bug (emit to all players);
Added support to ZP 4.4



wicho 12-07-2015 02:57

Re: [ZP] Extra Item: Balrog Ethereal FIXED
 
If you like the guns of CSO you could make the dual infinity weapon..

botz 12-07-2015 18:10

Re: [ZP] Extra Item: Balrog Ethereal FIXED
 
Crazy can you tell me how did you fix it, or what line you edited?

Thanks

CrazY. 12-09-2015 19:31

Re: [ZP] Extra Item: Balrog Ethereal FIXED
 
Quote:

Originally Posted by wicho (Post 2369551)
If you like the guns of CSO you could make the dual infinity weapon..

Good idea :crab:

Quote:

Originally Posted by botz (Post 2369751)
Crazy can you tell me how did you fix it, or what line you edited?

Thanks

In addition to modify all the code, I had to block the default event of the gun.
For exactly do you know that?

CrazY. 12-12-2015 15:30

Re: [ZP] Extra Item: Balrog Ethereal FIXED
 
Deanamx fixed the v_balrog_ethereal.mdl muzzleflash, thank you :P


All times are GMT -4. The time now is 22:54.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.