Raised This Month: $ Target: $400
 0% 

Solved How to use hook_weapon ?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 01-25-2017 , 08:25   How to use hook_weapon ?
Reply With Quote #1

hi i wanna your help guys i don't know how to use hook_weapon.
please teach me or give me how i can use it on this gun code :
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <fun>
#include <engine>
#include <cstrike>

#define EWEAPON_W_MODEL "models/w_watergun.mdl"
#define EWEAPON_V_MODEL "models/v_watergun.mdl"
#define EWEAPON_P_MODEL "models/p_watergun.mdl"
#define EWEAPON_SOUND_FIRE "weapons/water-1.wav"
#define EWEAPON_SOUND_EMPTY "weapons/waemp.wav"
new const Sound_Zoom[] = { "weapons/zoom.wav" }

#define EWEAPON_LOGNAME "[Automat] \rWatergun"

#define EWEAPON_WEAPONKEY 1200788
#define EWEAPON_BASE_WEAPON "weapon_ump45"

#define EWEAPON_CLIPSIZE 70
#define EWEAPON_START_AMMO 300

#define EWEAPON_SHOOT_NEXTATTACKTIME 0.1
#define EWEAPON_SHOOT_NEXTIDLETIME 0.1
#define EWEAPON_SHOOTEMPTY_NEXTATTACKTIME 0.2
#define EWEAPON_SHOOTEMPTY_NEXTIDLETIME 0.2
#define EWEAPON_RELOAD_TIME 3.5
#define EWEAPON_BASE_DAMAGE 70.0

#define EWEAPON_HORIZONTAL_RECOIL 150
#define EWEAPON_VERTICAL_RECOIL 1

#define ANIM_IDLE 0
#define ANIM_IDLE_EMPTY 3
#define ANIM_RELOAD 1
#define ANIM_DRAW 2
#define ANIM_DRAW_EMPTY 4
#define ANIM_FIRE1 5
#define ANIM_FIRE2 5
#define ANIM_FIRE3 5

#define ANIM_PLAYER_POSTFIX "rifle"

#define FIRE_WATERSPRAY
/* ------------------------------------------------- */

new g_EWeaponId 0;
new 
g_OriginalWModel[128];
#define EV_INT_WEAPONKEY    EV_INT_impulse
#define MAX_PLAYERS 32

new DecalsShot[5] = {4142434445};
new 
g_BloodDecals[6];
new 
g_BloodSprite[2];

enum _:e_EWepState 
{
    
bool:wep_have,
    
bool:wep_active,
    
wep_ent,
    
wep_TmpClip,
};

new 
g_EWepPlayerData[MAX_PLAYERS+1][e_EWepState];

//CBaseWeapon fields
#define m_fKnown                44
#define m_flNextPrimaryAttack             46
#define m_flTimeWeaponIdle            48
#define m_iClip                    51
#define m_fInReload                54
#define m_flNextAttack                83
#define CBASEWEAPON_LINUX_XTRA_OFF            4

new g_hasZoom[33]

#if defined FIRE_WATERSPRAY
new tracer_sprite;
new 
tracer_sprite2;
#endif //FIRE_WATERSPRAY

public plugin_init() {
    
register_plugin("[CS 1.6] Guitar!""1.0.1""yas17sin");

    
InitDecals();

    
RegisterHam(Ham_Weapon_PrimaryAttackEWEAPON_BASE_WEAPON"CWeapon__PrimaryAttack");
    
RegisterHam(Ham_Item_DeployEWEAPON_BASE_WEAPON"CWeapon__Deploy"1);
    
RegisterHam(Ham_Item_AddToPlayerEWEAPON_BASE_WEAPON"CWeapon__AddToPlayer");
    
RegisterHam(Ham_Item_AttachToPlayerEWEAPON_BASE_WEAPON"CWeapon__AttachToPlayer");
    
RegisterHam(Ham_Item_PostFrameEWEAPON_BASE_WEAPON"CWeapon__ItemPostFrame");
    
RegisterHam(Ham_Weapon_ReloadEWEAPON_BASE_WEAPON"CWeapon__Reload");
    
RegisterHam(Ham_Weapon_ReloadEWEAPON_BASE_WEAPON"CWeapon__Reload_Post"1);

    
register_forward(FM_SetModel"CWeapon__SetModel");
    
register_forward(FM_UpdateClientData"fw_UpdateClientData_Post"1);
    
register_event("CurWeapon""event_curweapon""be""1=1");
    
register_message(get_user_msgid("DeathMsg"), "message_DeathMsg");
    
register_forward(FM_CmdStart"fw_CmdStart")
    
    
register_clcmd("get_wtgun""give_watergun")

    
g_EWeaponId get_weaponid(EWEAPON_BASE_WEAPON);
}

stock InitDecals() 
{
    
g_BloodDecals[0] = get_decal_index("{blood1");
    
g_BloodDecals[1] = get_decal_index("{blood2");
    
g_BloodDecals[2] = get_decal_index("{blood3");
    
g_BloodDecals[3] = get_decal_index("{blood4");
    
g_BloodDecals[4] = get_decal_index("{blood5");
    
g_BloodDecals[5] = get_decal_index("{blood6");
}

public 
plugin_precache() {
    
precache_model(EWEAPON_W_MODEL);
    
precache_model(EWEAPON_V_MODEL);
    
precache_model(EWEAPON_P_MODEL);

    
precache_sound(EWEAPON_SOUND_FIRE);
    
precache_sound(EWEAPON_SOUND_EMPTY);

    
g_BloodSprite[0] = precache_model("sprites/blood.spr")
    
g_BloodSprite[1] = precache_model("sprites/bloodspray.spr")

#if defined FIRE_WATERSPRAY
    
tracer_sprite precache_model("sprites/blue.spr");
    
tracer_sprite2 precache_model("sprites/blue2.spr");
#endif
}

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))
    {
        new 
szClipszAmmo
        
new szWeapID get_user_weapon(idszClipszAmmo)
        
        if(
szWeapID == CSW_UMP45 && !g_hasZoom[id] == true)
        {
            
g_hasZoom[id] = true
            cs_set_user_zoom
(idCS_SET_AUGSG552_ZOOM1)
            
emit_sound(idCHAN_ITEMSound_Zoom0.202.400100)
        }
        
        else if(
szWeapID == CSW_UMP45 && g_hasZoom[id])
        {
            
g_hasZoom[id] = false
            cs_set_user_zoom
(idCS_RESET_ZOOM0)
            
        }
        
    }

    if (
g_hasZoomid ] && (pev(idpev_button) & IN_RELOAD))
    {
        
g_hasZoomid ] = false
        cs_set_user_zoom
idCS_RESET_ZOOM)
    }
    return 
PLUGIN_HANDLED
}

public 
CWeapon__PrimaryAttack(weapon_entity) {
    if(!
is_valid_ent(weapon_entity))
        return 
HAM_IGNORED;

    new 
id pev(weapon_entitypev_owner)
    if (!
is_user_connected(id))
        return 
HAM_IGNORED;

    if (!
g_EWepPlayerData[id][wep_have])
        return 
HAM_IGNORED;

    static 
szClassName[33]
    
entity_get_string(weapon_entityEV_SZ_classnameszClassNamecharsmax(szClassName))

    new 
iClip get_pdata_int(weapon_entitym_iClipCBASEWEAPON_LINUX_XTRA_OFF)
    if (
iClip <= 0) {
        
send_weapon_animation(idANIM_IDLE_EMPTY)
        
engfunc(EngFunc_EmitSoundidCHAN_WEAPONEWEAPON_SOUND_EMPTYVOL_NORMATTN_NORM0PITCH_NORM)

        
set_pdata_float(weapon_entitym_flNextPrimaryAttackEWEAPON_SHOOTEMPTY_NEXTATTACKTIMECBASEWEAPON_LINUX_XTRA_OFF)
        
set_pdata_float(weapon_entitym_flTimeWeaponIdleEWEAPON_SHOOTEMPTY_NEXTIDLETIMECBASEWEAPON_LINUX_XTRA_OFF)

        return 
HAM_SUPERCEDE;
    }
    
iClip--;
    
set_pdata_int(weapon_entitym_iClipiClipCBASEWEAPON_LINUX_XTRA_OFF);

    new 
anim;
    switch (
random_num(0,2)) {
        case 
0anim ANIM_FIRE1;
        case 
1anim ANIM_FIRE2;
        default: 
anim ANIM_FIRE3;
    }
    
send_weapon_animation(idanim);


    
/* player model animation */

    
engfunc(EngFunc_EmitSoundidCHAN_WEAPONEWEAPON_SOUND_FIREVOL_NORMATTN_NORM0PITCH_NORM);


    static 
Float:plrViewAngles[3], Float:VecEnd[3], Float:VecDir[3], Float:PlrOrigin[3];
    
pev(idpev_v_angleplrViewAngles);

    static 
Float:VecSrc[3], Float:VecDst[3];
    
    
//VecSrc = pev->origin + pev->view_ofs;
    
pev(idpev_originPlrOrigin)
    
pev(idpev_view_ofsVecSrc)
    
xs_vec_add(VecSrcPlrOriginVecSrc)

    
//VecDst = VecDir * 8192.0;
    
angle_vector(plrViewAnglesANGLEVECTOR_FORWARDVecDir);
    
xs_vec_mul_scalar(VecDir8192.0VecDst);
    
xs_vec_add(VecDstVecSrcVecDst);
    
    new 
hTrace create_tr2()
    
engfunc(EngFunc_TraceLineVecSrcVecDst0idhTrace)
    new 
hitEnt get_tr2(hTraceTR_pHit);
    
get_tr2(hTraceTR_vecEndPosVecEnd);

    
#if defined FIRE_WATERSPRAY
        
create_tracer_water(idVecSrcVecEnd)
    
#endif //FIRE_WATERSPRAY

    
new bool:bNeedDrawShot true;

    if (
pev_valid(hitEnt)) {
        new 
Float:takeDamage;
        
pev(hitEntpev_takedamagetakeDamage);

        if (
takeDamage != 0.0) {
            
bNeedDrawShot false;

            new 
Float:dmg EWEAPON_BASE_DAMAGE;

            new 
hitGroup get_tr2(hTraceTR_iHitgroup);

            switch (
hitGroup) {
                case 
HIT_HEAD: { dmg *= 3.0; }
                case 
HIT_LEFTARM: { dmg *= 0.9; }
                case 
HIT_RIGHTARM: { dmg *= 0.9; }
                case 
HIT_LEFTLEG: { dmg *= 0.9; }
                case 
HIT_RIGHTLEG: { dmg *= 0.9; }
            }

            if (
is_user_connected(hitEnt) && is_user_alive(hitEnt)) {
                
ExecuteHamB(Ham_TakeDamagehitEntididdmgDMG_BULLET DMG_NEVERGIB);
                
ExecuteHamB(Ham_TraceBleedhitEntdmgVecDirhTraceDMG_BULLET DMG_NEVERGIB);
                
make_blood(VecEnddmghitEnt);
            }
        
        }

        new 
solid pev(hitEntpev_solid);
        if (
solid != SOLID_BSP)
            
bNeedDrawShot false;

    }

    static 
Float:punchAngle[3];
    
punchAngle[0] = float(random_num(-EWEAPON_VERTICAL_RECOILEWEAPON_VERTICAL_RECOIL)) / 100.0;

    
punchAngle[1] = float(random_num(-EWEAPON_HORIZONTAL_RECOILEWEAPON_HORIZONTAL_RECOIL)) / 100.0;
    
punchAngle[2] = 0.0;
    
set_pev(idpev_punchanglepunchAngle);


    
/* draw decal if needed */

    
if (bNeedDrawShot == true) {
        
#if defined FIRE_WATERSPRAY
        #else
            
create_shot(VecEndhitEnt);
        
#endif //FIRE_WATERSPRAY
    
} else {
        if (
pev_valid(hitEnt)) {
            
// engfunc(EngFunc_EmitAmbientSound, 0, VecEnd, "hit_body.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
        
}
    }

    
set_pdata_float(weapon_entitym_flNextPrimaryAttackEWEAPON_SHOOT_NEXTATTACKTIMECBASEWEAPON_LINUX_XTRA_OFF)
    
set_pdata_float(weapon_entitym_flTimeWeaponIdleEWEAPON_SHOOT_NEXTIDLETIMECBASEWEAPON_LINUX_XTRA_OFF)

    
free_tr2(hTrace);
    
    return 
HAM_SUPERCEDE;
}

public 
CWeapon__SetModel(entitymodel[]) {
    if(!
is_valid_ent(entity))
        return 
FMRES_IGNORED;
        
    static 
szClassName[33]
    
entity_get_string(entityEV_SZ_classnameszClassNamecharsmax(szClassName))

    
// save original W_ model
    
if (equal(szClassNameEWEAPON_BASE_WEAPON)) {
        
copy(g_OriginalWModel127model)
    }


    if (!
equal(szClassName"weaponbox")) {
        return 
FMRES_IGNORED;
    }

    if (!
g_OriginalWModel[0] || !equal(g_OriginalWModelmodel)) {
        return 
FMRES_IGNORED;
    }

    new 
entOwner entity_get_edict(entityEV_ENT_owner)
    new 
entStoredEWep find_ent_by_owner(FM_NULLENTEWEAPON_BASE_WEAPONentity)

    if(
is_user_connected(entOwner) && \
        
g_EWepPlayerData[entOwner][wep_have] == true && 
        
is_valid_ent(entStoredEWep)) \
    {
        
entity_set_int(entStoredEWepEV_INT_WEAPONKEYEWEAPON_WEAPONKEY)

        
// save ammo
        
new bpammos cs_get_user_bpammo(entOwnerg_EWeaponId);
        
entity_set_int(entStoredEWepEV_INT_weaponsbpammos);
        
cs_set_user_bpammo(entOwnerg_EWeaponId0);
        
        
CWeapon__RemoveFromPlayer(entOwner)
        
        
entity_set_model(entityEWEAPON_W_MODEL);
        
        return 
FMRES_SUPERCEDE;
    }

    return 
FMRES_IGNORED;
}

stock CWeapon__RemoveFromPlayer(id) {
    
g_EWepPlayerData[id][wep_have] = false;
    
g_EWepPlayerData[id][wep_active] = false;
    
g_EWepPlayerData[id][wep_ent] = 0;
}

public 
CWeapon__Deploy(weapon_entity) {
    if (!
is_valid_ent(weapon_entity))
        return 
HAM_IGNORED;

    static 
szClassName[33]
    
entity_get_string(weapon_entityEV_SZ_classnameszClassNamecharsmax(szClassName))

    new 
iid 0;
    for (
1< (MAX_PLAYERS+1); i++) {
        if (
g_EWepPlayerData[i][wep_have] && g_EWepPlayerData[i][wep_ent] == weapon_entity)
            
id i;
    }
    

    if (!
is_user_connected(id))
        return 
HAM_IGNORED;

    if (!
g_EWepPlayerData[id][wep_have])
        return 
HAM_IGNORED;

    if (!
equal(szClassNameEWEAPON_BASE_WEAPON)) {
        
g_EWepPlayerData[id][wep_active] = false;
        return 
HAM_IGNORED;
    }

    new 
iClip get_pdata_int(weapon_entitym_iClipCBASEWEAPON_LINUX_XTRA_OFF)

    
set_pev(idpev_viewmodel2EWEAPON_V_MODEL);
    
set_pev(idpev_weaponmodel2EWEAPON_P_MODEL);

    
g_EWepPlayerData[id][wep_active] = true;

    if (
iClip 0)
        
send_weapon_animation(idANIM_DRAW)
    else
        
send_weapon_animation(idANIM_DRAW_EMPTY)
        
    return 
HAM_IGNORED;
}


public 
CWeapon__AttachToPlayer(weapon_entityid) {
    if (!
is_valid_ent(weapon_entity))
        return 
HAM_IGNORED;

    if (!
is_user_connected(id))
        return 
HAM_IGNORED;

    if (!
g_EWepPlayerData[id][wep_have])
        return 
HAM_IGNORED;

    if(
get_pdata_int(weapon_entitym_fKnownCBASEWEAPON_LINUX_XTRA_OFF)) {
        return 
HAM_IGNORED;
    }
    
    
set_pdata_int(weapon_entitym_iClipEWEAPON_CLIPSIZECBASEWEAPON_LINUX_XTRA_OFF)

    return 
HAM_IGNORED;
}

public 
CWeapon__AddToPlayer(weapon_entityid) {
    if (!
is_valid_ent(weapon_entity))
        return 
HAM_IGNORED;

    if (!
is_user_connected(id))
        return 
HAM_IGNORED;

    if(
entity_get_int(weapon_entityEV_INT_WEAPONKEY) == EWEAPON_WEAPONKEY && g_EWepPlayerData[id][wep_have] == false)    {

        
entity_set_int(weapon_entityEV_INT_WEAPONKEY0)

        
//restore ammo
        
new bpammos entity_get_int(weapon_entityEV_INT_weapons);
        
cs_set_user_bpammo(idg_EWeaponIdbpammos);

        
g_EWepPlayerData[id][wep_have] = true;
        
g_EWepPlayerData[id][wep_ent] = weapon_entity;
        return 
HAM_HANDLED;
    }

    if (
g_EWepPlayerData[id][wep_have] == true) {
        
g_EWepPlayerData[id][wep_ent] = weapon_entity;
    }

    return 
HAM_IGNORED;
}

public 
CWeapon__ItemPostFrame(weapon_entity) {
    new 
id pev(weapon_entitypev_owner)
    if (!
is_user_connected(id))
        return 
FMRES_IGNORED;

    if (!
g_EWepPlayerData[id][wep_have])
        return 
FMRES_IGNORED;

    new 
Float:flNextAttack get_pdata_float(idm_flNextAttack)

    new 
iBpAmmo cs_get_user_bpammo(idg_EWeaponId);
    new 
iClip get_pdata_int(weapon_entitym_iClip)

    new 
fInReload get_pdata_int(weapon_entitym_fInReloadCBASEWEAPON_LINUX_XTRA_OFF

    if (
fInReload && flNextAttack <= 0.0) {
        new 
min(EWEAPON_CLIPSIZE iClipiBpAmmo)
    
        
set_pdata_int(weapon_entitym_iClipiClip jCBASEWEAPON_LINUX_XTRA_OFF)
        
cs_set_user_bpammo(idg_EWeaponIdiBpAmmo-j);
        
        
set_pdata_int(weapon_entitym_fInReload0CBASEWEAPON_LINUX_XTRA_OFF)
        
fInReload 0
    
}

    return 
FMRES_IGNORED;
}

public 
CWeapon__Reload(weapon_entity) {
    new 
id pev(weapon_entitypev_owner)
    if (!
is_user_connected(id))
        return 
FMRES_IGNORED;

    if (!
g_EWepPlayerData[id][wep_have])
        return 
FMRES_IGNORED;

    
g_EWepPlayerData[id][wep_TmpClip] = -1;

    new 
iBpAmmo cs_get_user_bpammo(idg_EWeaponId);
    new 
iClip get_pdata_int(weapon_entitym_iClipCBASEWEAPON_LINUX_XTRA_OFF)

    if (
iBpAmmo <= 0)
        return 
FMRES_SUPERCEDE;

    if (
iClip >= EWEAPON_CLIPSIZE)
        return 
FMRES_SUPERCEDE;


    
g_EWepPlayerData[id][wep_TmpClip] = iClip;
    
    
set_pdata_int(weapon_entitym_iClip0CBASEWEAPON_LINUX_XTRA_OFF)

    return 
FMRES_IGNORED;
}

public 
CWeapon__Reload_Post(weapon_entity) {
    new 
id pev(weapon_entitypev_owner)
    if (!
is_user_connected(id))
        return 
FMRES_IGNORED;

    if (!
g_EWepPlayerData[id][wep_have])
        return 
FMRES_IGNORED;

    if (
g_EWepPlayerData[id][wep_TmpClip] == -1)
        return 
FMRES_IGNORED;

    
set_pdata_int(weapon_entitym_iClipg_EWepPlayerData[id][wep_TmpClip], CBASEWEAPON_LINUX_XTRA_OFF)

    
set_pdata_float(weapon_entitym_flTimeWeaponIdleEWEAPON_RELOAD_TIMECBASEWEAPON_LINUX_XTRA_OFF)

    
set_pdata_float(idm_flNextAttackEWEAPON_RELOAD_TIME)

    
set_pdata_int(weapon_entitym_fInReload1)

    
send_weapon_animationidANIM_RELOAD )

    
g_EWepPlayerData[id][wep_TmpClip] = -1;

    return 
FMRES_IGNORED;
}

public 
fw_UpdateClientData_Post(PlayerSendWeaponsCD_Handle) {
    if(!
is_user_alive(Player))
        return 
FMRES_IGNORED;

    if(!
g_EWepPlayerData[Player][wep_active])
            return 
FMRES_IGNORED;

    
set_cd(CD_HandleCD_flNextAttackhalflife_time () + 0.001)
    return 
FMRES_HANDLED
}

public 
event_curweapon(id) {
    if(!
is_user_alive(id)) 
        return 
PLUGIN_CONTINUE;

    if(
read_data(2) == g_EWeaponId && g_EWepPlayerData[id][wep_have] == true) {
    } else {
        
g_EWepPlayerData[id][wep_active] = false;
    }
    return 
PLUGIN_HANDLED;
}

public 
client_connect(id) {
    
g_EWepPlayerData[id][wep_active] = false;
    
g_EWepPlayerData[id][wep_have] = false;
}

public 
client_disconnect(id) {
    if (
g_EWepPlayerData[id][wep_have] == true) {
        
CWeapon__RemoveFromPlayer(id)
    }
}

public 
message_DeathMsg(msg_idmsg_destid) {
    static 
szTruncatedWeapon[33], iAttacker;
    
    
get_msg_arg_string(4szTruncatedWeaponcharsmax(szTruncatedWeapon));
    
    
iAttacker get_msg_arg_int(1);

    if(
is_user_connected(iAttacker) && g_EWepPlayerData[iAttacker][wep_have] == true && equal(szTruncatedWeaponEWEAPON_BASE_WEAPON)) {
        
set_msg_arg_string(4EWEAPON_LOGNAME);
    }

    return 
PLUGIN_CONTINUE;
}

#if defined FIRE_WATERSPRAY
stock create_tracer_water(idFloat:fVec1[3], Float:fVec2[3]) {
    static 
iVec1[3];
    
FVecIVec(fVec1iVec1);

    static 
Float:origin[3], Float:vSrc[3], Float:angles[3], Float:v_forward[3], Float:v_right[3], Float:v_up[3], Float:gun_position[3], Float:player_origin[3], Float:player_view_offset[3];
    
pev(idpev_v_angleangles);
    
engfunc(EngFunc_MakeVectorsangles);
    
global_get(glb_v_forwardv_forward);
    
global_get(glb_v_rightv_right);
    
global_get(glb_v_upv_up);

    
//m_pPlayer->GetGunPosition( ) = pev->origin + pev->view_ofs
    
pev(idpev_originplayer_origin);
    
pev(idpev_view_ofsplayer_view_offset);
    
xs_vec_add(player_originplayer_view_offsetgun_position);

    
xs_vec_mul_scalar(v_forward24.0v_forward);
    
xs_vec_mul_scalar(v_right3.0v_right);

    if ((
pev(idpev_flags) & FL_DUCKING) == FL_DUCKING)
        
xs_vec_mul_scalar(v_up6.0v_up);
    else
        
xs_vec_mul_scalar(v_up, -2.0v_up);

    
xs_vec_add(gun_positionv_forwardorigin);
    
xs_vec_add(originv_rightorigin);
    
xs_vec_add(originv_uporigin);

    
vSrc[0] = origin[0];
    
vSrc[1] = origin[1];
    
vSrc[2] = origin[2];


    new 
Float:dist get_distance_f(vSrcfVec2);
    new 
CountDrops floatround(dist 50.0);
    
    if (
CountDrops 20)
        
CountDrops 20;
    
    if (
CountDrops 2)
        
CountDrops 2;

    
message_begin(MSG_PASSVC_TEMPENTITYiVec1);
    
write_byte(TE_SPRITETRAIL);
    
engfunc(EngFunc_WriteCoordvSrc[0]);
    
engfunc(EngFunc_WriteCoordvSrc[1]);
    
engfunc(EngFunc_WriteCoordvSrc[2]);
    
engfunc(EngFunc_WriteCoordfVec2[0]);
    
engfunc(EngFunc_WriteCoordfVec2[1]);
    
engfunc(EngFunc_WriteCoordfVec2[2]);
    
write_short(tracer_sprite2); 
    
write_byte(CountDrops); //count
    
write_byte(0); //life  
    
write_byte(1); //scale
    
write_byte(60); //velocity
    
write_byte(10); //rand_velocity
    
message_end();


    
message_begin(MSG_PASSVC_TEMPENTITYiVec1);
    
write_byte(TE_BEAMPOINTS);
    
engfunc(EngFunc_WriteCoordfVec2[0]);
    
engfunc(EngFunc_WriteCoordfVec2[1]);
    
engfunc(EngFunc_WriteCoordfVec2[2]);
    
engfunc(EngFunc_WriteCoordvSrc[0]);
    
engfunc(EngFunc_WriteCoordvSrc[1]);
    
engfunc(EngFunc_WriteCoordvSrc[2]);
    
write_short(tracer_sprite); 
    
write_byte(6); //starting_frame
    
write_byte(200); //framerate
    
write_byte(1); //life
    
write_byte(100); //line width
    
write_byte(0); //noise ampl
    
write_byte(64); write_byte(64); write_byte(192);  //color
    
write_byte(192); //brightness
    
write_byte(250); //scroll speed
    
message_end();
}
#endif //FIRE_WATERSPRAY

stock send_weapon_animation(idiAnim) {
    
set_pev(idpev_weaponanimiAnim);
    
message_begin(MSG_ONE_UNRELIABLESVC_WEAPONANIM_id);
    
write_byte(iAnim);
    
write_byte(pev(id,pev_body));
    
message_end();
}

stock create_shot(Float:fOrigin[3], entity 0) {
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_GUNSHOTDECAL);
    
engfunc(EngFunc_WriteCoordfOrigin[0]);
    
engfunc(EngFunc_WriteCoordfOrigin[1]);
    
engfunc(EngFunc_WriteCoordfOrigin[2]);
    if(!
pev_valid(entity)) {
        
write_short(0);
    } else {
        
write_short(entity);
    }
    
write_byte(DecalsShot[random_num(0,4)]);
    
message_end();
}

stock make_blood(const Float:vTraceEnd[3], Float:DamagehitEnt) {
    new 
bloodColor ExecuteHam(Ham_BloodColorhitEnt);
    if (
bloodColor == -1)
        return;

    new 
amount floatround(Damage);

    
amount *= 2//according to HLSDK

    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_BLOODSPRITE);
    
write_coord(floatround(vTraceEnd[0]));
    
write_coord(floatround(vTraceEnd[1]));
    
write_coord(floatround(vTraceEnd[2]));
    
write_short(g_BloodSprite[1]);
    
write_short(g_BloodSprite[0]);
    
write_byte(bloodColor);
    
write_byte(min(max(3amount/10), 16));
    
message_end();
}

public 
give_watergun(id
{    
        if (
user_has_weapon(idg_EWeaponId))
            
engclient_cmd(id"drop"EWEAPON_BASE_WEAPON);

        
g_EWepPlayerData[id][wep_have] = true;
        
give_item(idEWEAPON_BASE_WEAPON);

        
cs_set_user_bpammo (idg_EWeaponIdEWEAPON_START_AMMO);

Thanks for advance.

Last edited by yas17sin; 01-25-2017 at 21:56. Reason: mistakes
yas17sin is offline
Send a message via ICQ to yas17sin
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:45.


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