Raised This Month: $ Target: $400
 0% 

Message for guns


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
C.Ronaldo
Senior Member
Join Date: Dec 2014
Old 12-26-2014 , 01:12   Message for guns
Reply With Quote #1

hello guys i need your help again how i can add on plugin if player buy this gun he will see like this [ZP] You bought GunName

some can do it on this code and tell/show me how he did it

i want on this code if player buy the gun he will see this message "[ZP] You bought Balrog M249"

PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <xs>
#include <cstrike>
#include <zombieplague>
#include <fakemeta_util>

#define weapon_balrog7_kobra "weapon_m249"
#define CSW_BALROG7 CSW_M249

#define ENG_NULLENT        -1
#define EV_INT_WEAPONKEY    EV_INT_impulse
#define balrog-7_WEAPONKEY    904
#define MAX_PLAYERS                32
#define IsValidUser(%1) (1 <= %1 <= g_MaxPlayers)
#define write_coord_f(%1)    engfunc(EngFunc_WriteCoord, %1)

const USE_STOPPED 0
const OFFSET_ACTIVE_ITEM 373
const OFFSET_WEAPONOWNER 41
const OFFSET_LINUX 5
const OFFSET_LINUX_WEAPONS 4

#define WEAP_LINUX_XTRA_OFF            4
#define m_fKnown                44
#define m_flNextPrimaryAttack             46
#define m_flTimeWeaponIdle            48
#define m_iClip                    51
#define m_fInReload                54
#define PLAYER_LINUX_XTRA_OFF            5
#define m_flNextAttack                83

#define RELOAD_TIME        4.0
#define BODY_SKIN_W_BALROG7        23
#define BALROG7_COST        60

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)

new const 
Fire_snd[] = { "weapons/balrog7-1.wav" }

new const 
GUNSHOT_DECALS[] = { 4142434445 }

new 
balrog7_V_MODEL[64] = "models/zp/v_balrog7.mdl"
new balrog7_P_MODEL[64] = "models/zp/p_balrog7.mdl"
new balrog7_W_MODEL[64] = "models/zp/w_balrog7.mdl"
new balrog7_SHELL_MODEL[64] = "models/rshell.mdl"

new cvar_dmg_balrog7g_itemid_balrog7cvar_clip_balrog7cvar_balrog7_ammocvar_shellshealth_balrog7shells_model
new g_has_balrog7[33]
new 
g_MaxPlayersg_orig_event_balrog7g_clip_ammo[33]
new 
Float:cl_pushangle[MAX_PLAYERS 1][3], m_iBlood[2], weapon_vars[10]
new 
g_balrog7_TmpClip[33]
new 
Float:g_lastexpl[33], sExploin_zoom[33]

public 
plugin_init()
{
    
register_plugin("Balrog M249""1.0""Crock / =)")
    
register_event("CurWeapon""CurrentWeapon""be""1=1")
    
RegisterHam(Ham_Item_AddToPlayer"weapon_m249""fw_balrog7_AddToPlayer")
    
RegisterHam(Ham_Use"func_tank""fw_UseStationary_Post"1)
    
RegisterHam(Ham_Use"func_tankmortar""fw_UseStationary_Post"1)
    
RegisterHam(Ham_Use"func_tankrocket""fw_UseStationary_Post"1)
    
RegisterHam(Ham_Use"func_tanklaser""fw_UseStationary_Post"1)
    
RegisterHam(Ham_Item_Deploy"weapon_m249""fw_Item_Deploy_Post"1)
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_m249""fw_balrog7_PrimaryAttack")
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_m249""fw_balrog7_PrimaryAttack_Post"1)
    
RegisterHam(Ham_Item_PostFrame"weapon_m249""balrog7__ItemPostFrame");
    
RegisterHam(Ham_Weapon_Reload"weapon_m249""balrog7__Reload");
    
RegisterHam(Ham_Weapon_Reload"weapon_m249""balrog7__Reload_Post"1);
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
register_forward(FM_CmdStart"fw_CmdStart")
    
register_forward(FM_SetModel"fw_SetModel")
    
register_forward(FM_UpdateClientData"fw_UpdateClientData_Post"1)
    
register_forward(FM_PlaybackEvent"fwPlaybackEvent")
    
    
cvar_dmg_balrog7 register_cvar("zp_balrog-7_dmg""1.15")
    
cvar_clip_balrog7 register_cvar("zp_balrog-7_clip""120")
    
cvar_balrog7_ammo register_cvar("zp_balrog-7_ammo""240")
    
cvar_shellshealth_balrog7 register_cvar("zp_balrog7_shellslife""2")
    
    
register_clcmd("weapon_balrog7""client_cmd_balrog7")
    
    
g_itemid_balrog7 zp_register_extra_item("Balrog M249"BALROG7_COSTZP_TEAM_HUMAN)
    
    
g_MaxPlayers get_maxplayers()
}

public 
plugin_precache()
{
    
precache_model(balrog7_V_MODEL)
    
precache_model(balrog7_P_MODEL)
    
precache_model(balrog7_W_MODEL)
    
shells_model precache_model(balrog7_SHELL_MODEL)
    
precache_sound(Fire_snd)
    
precache_sound("weapons/balrog7-2.wav")
    
precache_sound("weapons/balrog7_clipin1.wav")
    
precache_sound("weapons/balrog7_clipin2.wav")
    
precache_sound("weapons/balrog7_clipin3.wav")
    
precache_sound("weapons/balrog7_clipout1.wav")
    
precache_sound("weapons/balrog7_clipout2.wav")
    
sExplo precache_model("sprites/zerogxplode.spr")
    
m_iBlood[0] = precache_model("sprites/blood.spr")
    
m_iBlood[1] = precache_model("sprites/bloodspray.spr")
    
precache_generic("sprites/weapon_balrog7.txt")
       
precache_generic("sprites/640hud76.spr")
        
precache_generic("sprites/640hud2.spr")
    
    
register_forward(FM_PrecacheEvent"fwPrecacheEvent_Post"1)
    
register_message(78"msg_weaplist")
}

public 
client_cmd_balrog7(id)
{
    
engclient_cmd(id"weapon_m249")
}

public 
zp_user_humanized_post(id)
{
    
g_has_balrog7[id] = false
}

public 
plugin_natives ()
{
    
register_native("give_weapon_balrog7""native_give_weapon_add"1)
    
register_native("drop_weapon_balrog7""native_drop_weapon"1)
}

public 
native_give_weapon_add(id)
{
    
give_balrog7(id)
}

public 
native_drop_weapon(id)
{
    
ham_strip_weapon(id"weapon_m249")
}

public 
fwPrecacheEvent_Post(type, const name[])
{
    if(
equal("events/m249.sc"name))
    {
        
g_orig_event_balrog7 get_orig_retval()
        return 
FMRES_HANDLED
    
}
    return 
FMRES_IGNORED
}

public 
client_connect(id)
{
    
g_has_balrog7[id] = false
}

public 
client_disconnect(id)
{
    
g_has_balrog7[id] = false
}

public 
zp_user_infected_post(id)
{
    if(
zp_get_user_zombie(id))
    {
        
g_has_balrog7[id] = false
    
}
}

public 
fw_SetModel(entitymodel[])
{
    if(!
is_valid_ent(entity))
        return 
FMRES_IGNORED;
    static 
szClassName[33]
    
entity_get_string(entityEV_SZ_classnameszClassNamecharsmax(szClassName))
    if(!
equal(szClassName"weaponbox"))
        return 
FMRES_IGNORED;
    static 
iOwner
    iOwner 
entity_get_edict(entityEV_ENT_owner)
    if(
equal(model"models/w_m249.mdl"))
    {
        static 
iStoredSVDID
        iStoredSVDID 
find_ent_by_owner(ENG_NULLENT"weapon_m249"entity)
        if(!
is_valid_ent(iStoredSVDID))
            return 
FMRES_IGNORED;
        if(
g_has_balrog7[iOwner])
        {
            
entity_set_int(iStoredSVDIDEV_INT_WEAPONKEYbalrog-7_WEAPONKEY)
            
g_has_balrog7[iOwner] = false
            set_weaplist
(iOwner0)
            
entity_set_model(entitybalrog7_W_MODEL)
            
set_pev(entitypev_bodyBODY_SKIN_W_BALROG7)
            
            return 
FMRES_SUPERCEDE;
        }
    }
    return 
FMRES_IGNORED;
}

public 
give_balrog7(id)
{
    
drop_weapons(id1);
    new 
iWep2 give_item(id"weapon_m249")
    if(
iWep2 0)
    {
        
cs_set_weapon_ammo(iWep2get_pcvar_num(cvar_clip_balrog7))
        
cs_set_user_bpammo(idCSW_BALROG7get_pcvar_num(cvar_balrog7_ammo))
        
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("AmmoPickup"), _id)
        
write_byte(3)
        
write_byte(240)
        
message_end()
        
set_weaplist(id1)
    }
    
g_has_balrog7[id] = true;
}

public 
zp_extra_item_selected(iditemid)
{
    if(
itemid != g_itemid_balrog7)
        return
    
    
give_balrog7(id)
}

public 
fw_balrog7_AddToPlayer(balrog7id)
{
    if(!
is_valid_ent(balrog7) || !is_user_connected(id))
        return 
HAM_IGNORED;
    
    if(
entity_get_int(balrog7EV_INT_WEAPONKEY) == balrog-7_WEAPONKEY)
    {
        
g_has_balrog7[id] = true
        set_weaplist
(id1)
        
entity_set_int(balrog7EV_INT_WEAPONKEY0)
        
        return 
HAM_HANDLED;
    }
    return 
HAM_IGNORED;
}

public 
fw_UseStationary_Post(entitycalleractivatoruse_type)
{
    if(
use_type == USE_STOPPED && is_user_connected(caller))
        
replace_weapon_models(callerget_user_weapon(caller))
}

public 
fw_Item_Deploy_Post(weapon_ent)
{
    static 
owner
    owner 
fm_cs_get_weapon_ent_owner(weapon_ent)
    
    static 
weaponid
    weaponid 
cs_get_weapon_id(weapon_ent)
    
    
replace_weapon_models(ownerweaponid)
}

public 
CurrentWeapon(id)
{
    
replace_weapon_models(idread_data(2))
}

replace_weapon_models(idweaponid)
{
switch (
weaponid)
{
    case 
CSW_BALROG7:
    {
        if(
zp_get_user_zombie(id))
            return;
            
        if(
g_has_balrog7[id])
            {
                
set_pev(idpev_viewmodel2balrog7_V_MODEL)
                
set_pev(idpev_weaponmodel2balrog7_P_MODEL)
            }
        }
    }
}

public 
fw_UpdateClientData_Post(PlayerSendWeaponsCD_Handle)
{
    if(!
is_user_alive(Player) || (get_user_weapon(Player) != CSW_BALROG7) || !g_has_balrog7[Player])
        return 
FMRES_IGNORED
    
    set_cd
(CD_HandleCD_flNextAttackhalflife_time () + 0.001)
    return 
FMRES_HANDLED
}

public 
fw_balrog7_PrimaryAttack(Weapon)
{
    new 
Player get_pdata_cbase(Weapon414)
    if(!
g_has_balrog7[Player])
        return;
    
    
pev(Playerpev_punchanglecl_pushangle[Player])
    
g_clip_ammo[Player] = cs_get_weapon_ammo(Weapon)
}

public 
fwPlaybackEvent(flagsinvokereventidFloat:delayFloat:origin[3], Float:angles[3], Float:fparam1Float:fparam2iParam1iParam2bParam1bParam2)
{
    if((
eventid != g_orig_event_balrog7))
        return 
FMRES_IGNORED
    
if(!(<= invoker <= g_MaxPlayers))
        return 
FMRES_IGNORED
    playback_event
(flags FEV_HOSTONLYinvokereventiddelayoriginanglesfparam1fparam2iParam1iParam2bParam1bParam2)
    return 
FMRES_SUPERCEDE
}

public 
fw_CmdStart(iduc_handleseed
{
    new 
Float:flNextAttack get_pdata_float(idm_flNextAttackPLAYER_LINUX_XTRA_OFF)
    if(
g_has_balrog7[id] && get_user_weapon(id) == CSW_M249 && (get_uc(uc_handleUC_Buttons) & IN_ATTACK2) && !(pev(idpev_oldbuttons) & IN_ATTACK2) && flNextAttack 0.1)
    {
        if(!
in_zoom[id])
        {
            
cs_set_user_zoom(idCS_SET_AUGSG552_ZOOM0)
            
emit_sound(idCHAN_ITEM"weapons/zoom.wav"0.202.400100)
            
in_zoom[id] = 1
        
}
        else if(
in_zoom[id])
        {
            
in_zoom[id] = 0
            cs_set_user_zoom
(idCS_RESET_ZOOM1)
            
emit_sound(idCHAN_ITEM"weapons/zoom.wav"0.202.400100)
        }
    }
}

public 
fw_balrog7_PrimaryAttack_Post(Weapon)
{
    new 
Player get_pdata_cbase(Weapon414)
    new 
szClipszAmmo
    get_user_weapon
(PlayerszClipszAmmo)
    if(
Player && Player 33)
    {
        if(
g_has_balrog7[Player])
        {
            if(
szClip 0emit_sound(PlayerCHAN_WEAPONFire_sndVOL_NORMATTN_NORM0PITCH_NORM)
        }
        if(
g_has_balrog7[Player])
        {
            new 
Float:push[3]
            
pev(Playerpev_punchanglepush)
            
xs_vec_sub(pushcl_pushangle[Player], push)
            
xs_vec_mul_scalar(push0.6push)
            
xs_vec_add(pushcl_pushangle[Player], push)
            
set_pev(Playerpev_punchanglepush)
            
            if(!
g_clip_ammo[Player])
                return
            
            
UTIL_PlayWeaponAnimation(Playerrandom_num(12))
            
make_blood_and_bulletholes(Player)
            
make_shell(Player)
            
            if(
get_gametime()-1.0 g_lastexpl[Player])
            {
                
explode(Player)
                
UTIL_PlayWeaponAnimation(Player2)
                
g_lastexpl[Player] = get_gametime()
            }
            if(
in_zoom[Player]) set_pdata_float(Playerm_flNextAttack0.25)
        }
    }
}

public 
explode(id)
{
    if(
is_user_alive(id))
    {
        
message_begin(MSG_ONEget_user_msgid("ScreenFade"), _id);
        
write_short(1<<8);
        
write_short(1<<8);
        
write_short(1<<0);
        
write_byte(255);
        
write_byte(0);
        
write_byte(0);
        
write_byte(100);
        
message_end();
        
        new 
Float:originF[3]
        
fm_get_aim_origin(idoriginF)
        
message_begin(MSG_ALLSVC_TEMPENTITY)
        
write_byte(TE_SPARKS)
        
engfunc(EngFunc_WriteCoordoriginF[0])
        
engfunc(EngFunc_WriteCoordoriginF[1])
        
engfunc(EngFunc_WriteCoordoriginF[2]+30.0)
        
message_end()
        
        
message_begin(MSG_ALLSVC_TEMPENTITY)
        
write_byte(TE_SPARKS)
        
engfunc(EngFunc_WriteCoordoriginF[0]+30.0)
        
engfunc(EngFunc_WriteCoordoriginF[1])
        
engfunc(EngFunc_WriteCoordoriginF[2]+30.0)
        
message_end()
        
        
message_begin(MSG_ALLSVC_TEMPENTITY
        
write_byte(TE_SPARKS)
        
engfunc(EngFunc_WriteCoordoriginF[0])
        
engfunc(EngFunc_WriteCoordoriginF[1]+30.0)
        
engfunc(EngFunc_WriteCoordoriginF[2]+30.0)
        
message_end()
        
        
message_begin(MSG_ALLSVC_TEMPENTITY)
        
write_byte(TE_SPARKS)
        
engfunc(EngFunc_WriteCoordoriginF[0])
        
engfunc(EngFunc_WriteCoordoriginF[1]+40.0)
        
engfunc(EngFunc_WriteCoordoriginF[2]+40.0)
        
message_end()
        
        
message_begin(MSG_ALLSVC_TEMPENTITY)
        
write_byte(TE_SPARKS)
        
engfunc(EngFunc_WriteCoordoriginF[0])
        
engfunc(EngFunc_WriteCoordoriginF[1]+40.0)
        
engfunc(EngFunc_WriteCoordoriginF[2]+30.0)
        
message_end()
        
        
message_begin(MSG_ALLSVC_TEMPENTITY)
        
write_byte(TE_SPARKS)
        
engfunc(EngFunc_WriteCoordoriginF[0])
        
engfunc(EngFunc_WriteCoordoriginF[1]+30.0)
        
engfunc(EngFunc_WriteCoordoriginF[2]+40.0)
        
message_end()
        
        
// Draw explosion
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_EXPLOSION// Temporary entity ID
        
engfunc(EngFunc_WriteCoordoriginF[0]) // engfunc because float
        
engfunc(EngFunc_WriteCoordoriginF[1])
        
engfunc(EngFunc_WriteCoordoriginF[2]+30.0)
        
write_short(sExplo// Sprite index
        
write_byte(20// Scale
        
write_byte(30// Framerate
        
write_byte(0// Flags
        
message_end()
        
        
// Alive...
        
new FM_NULLENT
        
// Get distance between victim and epicenter
        
while((find_ent_in_sphere(aoriginF60.0)) != 0)
        {
            if (
id == a)
                continue 
                
            if(
pev(apev_takedamage) != DAMAGE_NO)
            {
                
ExecuteHamB(Ham_TakeDamageaidid100.0DMG_BULLET)
            }
        }
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_HANDLED
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damage)
{
    if(
victim != attacker && is_user_connected(attacker))
    {
        if(
get_user_weapon(attacker) == CSW_BALROG7)
        {
            if(
g_has_balrog7[attacker])
                
SetHamParamFloat(4damage get_pcvar_float(cvar_dmg_balrog7))
        }
    }
}

stock fm_cs_get_current_weapon_ent(id)
{
    return 
get_pdata_cbase(idOFFSET_ACTIVE_ITEMOFFSET_LINUX);
}

stock fm_cs_get_weapon_ent_owner(ent)
{
    return 
get_pdata_cbase(entOFFSET_WEAPONOWNEROFFSET_LINUX_WEAPONS);
}

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 make_blood_and_bulletholes(id)
{
    new 
aimOrigin[3], targetbody
    get_user_origin
(idaimOrigin3)
    
get_user_aiming(idtargetbody)
    if(
target && target <= g_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(m_iBlood[1])
        
write_short(m_iBlood[0])
        
write_byte(70)
        
write_byte(random_num(12))
        
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 -1)])
        
message_end()
    }
}

public 
balrog7__ItemPostFrame(weapon_entity)
{
    new 
id pev(weapon_entitypev_owner)
    if(!
is_user_connected(id))
        return 
HAM_IGNORED;
    
    if(!
g_has_balrog7[id])
        return 
HAM_IGNORED;
    
    new 
Float:flNextAttack get_pdata_float(idm_flNextAttackPLAYER_LINUX_XTRA_OFF)
    new 
iBpAmmo cs_get_user_bpammo(idCSW_BALROG7);
    new 
iClip get_pdata_int(weapon_entitym_iClipWEAP_LINUX_XTRA_OFF)
    new 
fInReload get_pdata_int(weapon_entitym_fInReloadWEAP_LINUX_XTRA_OFF)
    if(!(
get_user_button(id) & IN_ATTACK))
        
g_lastexpl[id]=get_gametime()
    
    if(
fInReload && flNextAttack <= 0.0)
    {
        new 
min(get_pcvar_num(cvar_clip_balrog7) - iClipiBpAmmo)
        
set_pdata_int(weapon_entitym_iClipiClip jWEAP_LINUX_XTRA_OFF)
        
cs_set_user_bpammo(idCSW_BALROG7iBpAmmo-j);
        
set_pdata_int(weapon_entitym_fInReload0WEAP_LINUX_XTRA_OFF)
        
fInReload 0
    
}
    return 
HAM_IGNORED;
}

public 
balrog7__Reload(weapon_entity)
{
    new 
id pev(weapon_entitypev_owner)
    if(!
is_user_connected(id))
        return 
HAM_IGNORED;
    
    if(!
g_has_balrog7[id])
        return 
HAM_IGNORED;
    
    
g_balrog7_TmpClip[id] = -1;
    new 
iBpAmmo cs_get_user_bpammo(idCSW_BALROG7);
    new 
iClip get_pdata_int(weapon_entitym_iClipWEAP_LINUX_XTRA_OFF)
    if(
iBpAmmo <= 0)
        return 
HAM_SUPERCEDE;
    
    if(
iClip >= get_pcvar_num(cvar_clip_balrog7))
        return 
HAM_SUPERCEDE;
    
    
g_balrog7_TmpClip[id] = iClip;
    return 
HAM_IGNORED;
}

public 
balrog7__Reload_Post(weapon_entity)
{
    new 
id pev(weapon_entitypev_owner)
    if(!
is_user_connected(id))
        return 
HAM_IGNORED;
    
    if(!
g_has_balrog7[id])
        return 
HAM_IGNORED;
    
    if(
g_balrog7_TmpClip[id] == -1)
        return 
HAM_IGNORED;
    
    
set_pdata_int(weapon_entitym_iClipg_balrog7_TmpClip[id], WEAP_LINUX_XTRA_OFF)
    
    
set_pdata_float(weapon_entitym_flTimeWeaponIdleRELOAD_TIMEWEAP_LINUX_XTRA_OFF)
    
    
set_pdata_float(idm_flNextAttackRELOAD_TIMEPLAYER_LINUX_XTRA_OFF)
    
    
set_pdata_int(weapon_entitym_fInReload1WEAP_LINUX_XTRA_OFF)
    
    if(
in_zoom[id])
    {
        
in_zoom[id] = 0
        cs_set_user_zoom
(idCS_RESET_ZOOM1)
        
emit_sound(idCHAN_ITEM"weapons/zoom.wav"0.202.400100)
    }
    
    
UTIL_PlayWeaponAnimation(id3)
    
    return 
HAM_IGNORED;
}

public 
msg_weaplist(msg_idmsg_destmsg_entity)
{
    if(
get_msg_arg_int(8) == CSW_BALROG7)
    {
        
weapon_vars[2] = get_msg_arg_int(2)
        
weapon_vars[3] = get_msg_arg_int(3)
        
weapon_vars[4] = get_msg_arg_int(4)
        
weapon_vars[5] = get_msg_arg_int(5)
        
weapon_vars[6] = get_msg_arg_int(6)
        
weapon_vars[7] = get_msg_arg_int(7)
        
weapon_vars[8] = get_msg_arg_int(8)
        
weapon_vars[9] = get_msg_arg_int(9)
    }
}

public 
set_weaplist(idnum)
{
    if(!
is_user_connected(id))
        return;
    
    
message_begin(MSG_ONEget_user_msgid("WeaponList"), {0,0,0}, id
    
write_string(num "weapon_balrog7"weapon_balrog7_kobra
    
write_byte(weapon_vars[2]) 
    
write_byte(weapon_vars[3]) 
    
write_byte(weapon_vars[4]) 
    
write_byte(weapon_vars[5]) 
    
write_byte(weapon_vars[6]) 
    
write_byte(weapon_vars[7]) 
    
write_byte(weapon_vars[8]) 
    
write_byte(weapon_vars[9]) 
    
message_end()
}

stock drop_weapons(iddropwhat)
{
    static 
weapons[32], numiweaponid
    num 
0
    get_user_weapons
(idweaponsnum)
    
    for (
0numi++)
    {
        
weaponid weapons[i]
        
        if(
dropwhat == && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
        {
            static 
wname[32]
            
get_weaponname(weaponidwnamesizeof wname 1)
            
engclient_cmd(id"drop"wname)
        }
    }
}

public 
make_shell(id)
{
    if(!
is_user_alive(id) || zp_get_user_zombie(id))
        return;
    
    if(
get_user_weapon(id) != CSW_BALROG7
        return;
    
    if(!
g_has_balrog7[id])
        return;
    
    static 
Float:player_origin[3], Float:origin[3], Float:origin2[3], Float:gunorigin[3], Float:oldangles[3], Float:v_forward[3], Float:v_forward2[3], Float:v_up[3], Float:v_up2[3], Float:v_right[3], Float:v_right2[3], Float:viewoffsets[3];
    
pev(id,pev_v_angleoldangles)
    
pev(id,pev_origin,player_origin)
    
pev(idpev_view_ofsviewoffsets);
    
    
engfunc(EngFunc_MakeVectorsoldangles);
    
    
global_get(glb_v_forwardv_forward);
    
global_get(glb_v_upv_up);
    
global_get(glb_v_rightv_right);
    
    
global_get(glb_v_forwardv_forward2);
    
global_get(glb_v_upv_up2);
    
global_get(glb_v_rightv_right2);
    
    
xs_vec_add(player_originviewoffsetsgunorigin);
    
    
xs_vec_mul_scalar(v_forward10.3v_forward);
    
xs_vec_mul_scalar(v_right2.9v_right);
    
xs_vec_mul_scalar(v_up, -3.7v_up);
    
    
xs_vec_mul_scalar(v_forward210.0v_forward2);
    
xs_vec_mul_scalar(v_right23.0v_right2);
    
xs_vec_mul_scalar(v_up2, -4.0v_up2);
    
    
xs_vec_add(gunoriginv_forwardorigin);
    
xs_vec_add(gunoriginv_forward2origin2);
    
xs_vec_add(originv_rightorigin);
    
xs_vec_add(origin2v_right2origin2);
    
xs_vec_add(originv_uporigin);
    
xs_vec_add(origin2v_up2origin2);
    
    new 
Float:velocity[3]
    
get_speed_vector(origin2originrandom_float(140.0160.0), velocity)
    
    new 
angle random_num(0360)
    
    
message_begin(MSG_ONE_UNRELIABLESVC_TEMPENTITY_id)
    
write_byte(TE_MODEL)
    
write_coord_f(origin[0])
    
write_coord_f(origin[1])
    
write_coord_f(origin[2])
    
write_coord_f(velocity[0])
    
write_coord_f(velocity[1])
    
write_coord_f(velocity[2])
    
write_angle(angle)
    
write_short(shells_model)
    
write_byte(1)
    
write_byte(get_pcvar_num(cvar_shellshealth_balrog7) * 10)
    
message_end()
    
    new 
Float:origin3[3]
    
origin3 origin
    
    xs_vec_mul_scalar
(v_forward3.9v_forward);
    
xs_vec_add(originv_forwardorigin);
    
    for(new 
i<= 32i++)
    {
        if(!
is_user_connected(i) || == id) continue;
        
        if(!
is_user_alive(i) && pev(ipev_iuser2) == id && pev(ipev_iuser1) == 4)
        {
            
message_begin(MSG_ONE_UNRELIABLESVC_TEMPENTITY_i)
            
write_byte(TE_MODEL)
            
write_coord_f(origin3[0])
            
write_coord_f(origin3[1])
            
write_coord_f(origin3[2])
            
write_coord_f(velocity[0])
            
write_coord_f(velocity[1])
            
write_coord_f(velocity[2])
            
write_angle(angle)
            
write_short(shells_model)
            
write_byte(1)
            
write_byte(get_pcvar_num(cvar_shellshealth_balrog7) * 10)
            
message_end()    
        }
        else
        {
            
message_begin(MSG_ONE_UNRELIABLESVC_TEMPENTITY_i)
            
write_byte(TE_MODEL)
            
write_coord_f(origin[0])
            
write_coord_f(origin[1])
            
write_coord_f(origin[2])
            
write_coord_f(velocity[0])
            
write_coord_f(velocity[1])
            
write_coord_f(velocity[2])
            
write_angle(angle)
            
write_short(shells_model)
            
write_byte(1)
            
write_byte(get_pcvar_num(cvar_shellshealth_balrog7) * 10)
            
message_end()    
        }
    }
}

stock get_speed_vector(const Float:origin1[3], const Float:origin2[3], Float:speedFloat:new_velocity[3])
{
    
new_velocity[0] = origin2[0] - origin1[0]
    
new_velocity[1] = origin2[1] - origin1[1]
    
new_velocity[2] = origin2[2] - origin1[2]
    new 
Float:num floatsqroot(speed speed / (new_velocity[0] * new_velocity[0] + new_velocity[1] * new_velocity[1] + new_velocity[2] * new_velocity[2]))
    
new_velocity[0] *= num
    new_velocity
[1] *= num
    new_velocity
[2] *= num
    
    
return 1;
}

stock ham_strip_weapon(idweapon[])
{
    if(!
equal(weapon"weapon_"7)) return 0;
    
    new 
wId get_weaponid(weapon);
    if(!
wId) return 0;
    
    new 
wEnt;
    while((
wEnt engfunc(EngFunc_FindEntityByStringwEnt"classname"weapon)) && pev(wEntpev_owner) != id) {}
    if(!
wEnt) return 0;
    
    if(
get_user_weapon(id) == wIdExecuteHamB(Ham_Weapon_RetireWeaponwEnt);
    
    if(!
ExecuteHamB(Ham_RemovePlayerItemidwEnt)) return 0;
    
ExecuteHamB(Ham_Item_KillwEnt);
    
    
set_pev(idpev_weaponspev(idpev_weapons) & ~(1<<wId));
    
    return 
1;

C.Ronaldo is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 12-26-2014 , 01:36   Re: Message for guns
Reply With Quote #2

PHP Code:
public zp_extra_item_selected(iditemid

    if(
itemid != g_itemid_balrog7
        return 
     
    
give_balrog7(id

----->

PHP Code:
public zp_extra_item_selected(iditemid

    if(
itemid != g_itemid_balrog7
        return 
     
    
give_balrog7(id

     
client_print(idprint_chat"[ZP] You bought Balrog M249"


Last edited by wicho; 12-26-2014 at 01:36.
wicho is offline
C.Ronaldo
Senior Member
Join Date: Dec 2014
Old 12-26-2014 , 10:41   Re: Message for guns
Reply With Quote #3

thx it is work but the color message not work i see it like this pic

PHP Code:
#include <amxmodx> 
#include <engine> 
#include <fakemeta> 
#include <fun> 
#include <hamsandwich> 
#include <xs> 
#include <cstrike> 
#include <zombieplague> 
#include <fakemeta_util> 

#define weapon_balrog7_kobra "weapon_m249" 
#define CSW_BALROG7 CSW_M249 

#define ENG_NULLENT        -1 
#define EV_INT_WEAPONKEY    EV_INT_impulse 
#define balrog-7_WEAPONKEY    904 
#define MAX_PLAYERS                32 
#define IsValidUser(%1) (1 <= %1 <= g_MaxPlayers) 
#define write_coord_f(%1)    engfunc(EngFunc_WriteCoord, %1) 

const USE_STOPPED 
const OFFSET_ACTIVE_ITEM 373 
const OFFSET_WEAPONOWNER 41 
const OFFSET_LINUX 
const OFFSET_LINUX_WEAPONS 

#define WEAP_LINUX_XTRA_OFF            4 
#define m_fKnown                44 
#define m_flNextPrimaryAttack             46 
#define m_flTimeWeaponIdle            48 
#define m_iClip                    51 
#define m_fInReload                54 
#define PLAYER_LINUX_XTRA_OFF            5 
#define m_flNextAttack                83 

#define RELOAD_TIME        4.0 
#define BODY_SKIN_W_BALROG7        23 
#define BALROG7_COST        60 

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

new const 
Fire_snd[] = { "weapons/balrog7-1.wav" 

new const 
GUNSHOT_DECALS[] = { 4142434445 

new 
balrog7_V_MODEL[64] = "models/zp/v_balrog7.mdl" 
new balrog7_P_MODEL[64] = "models/zp/p_balrog7.mdl" 
new balrog7_W_MODEL[64] = "models/zp/w_balrog7.mdl" 
new balrog7_SHELL_MODEL[64] = "models/rshell.mdl" 

new cvar_dmg_balrog7g_itemid_balrog7cvar_clip_balrog7cvar_balrog7_ammocvar_shellshealth_balrog7shells_model 
new g_has_balrog7[33
new 
g_MaxPlayersg_orig_event_balrog7g_clip_ammo[33
new 
Float:cl_pushangle[MAX_PLAYERS 1][3], m_iBlood[2], weapon_vars[10
new 
g_balrog7_TmpClip[33
new 
Float:g_lastexpl[33], sExploin_zoom[33

new 
g_iMsgSayTxt 

public plugin_init() 

    
register_plugin("Balrog M249""1.0""Crock / =)"
    
register_event("CurWeapon""CurrentWeapon""be""1=1"
    
RegisterHam(Ham_Item_AddToPlayer"weapon_m249""fw_balrog7_AddToPlayer"
    
RegisterHam(Ham_Use"func_tank""fw_UseStationary_Post"1
    
RegisterHam(Ham_Use"func_tankmortar""fw_UseStationary_Post"1
    
RegisterHam(Ham_Use"func_tankrocket""fw_UseStationary_Post"1
    
RegisterHam(Ham_Use"func_tanklaser""fw_UseStationary_Post"1
    
RegisterHam(Ham_Item_Deploy"weapon_m249""fw_Item_Deploy_Post"1
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_m249""fw_balrog7_PrimaryAttack"
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_m249""fw_balrog7_PrimaryAttack_Post"1
    
RegisterHam(Ham_Item_PostFrame"weapon_m249""balrog7__ItemPostFrame"); 
    
RegisterHam(Ham_Weapon_Reload"weapon_m249""balrog7__Reload"); 
    
RegisterHam(Ham_Weapon_Reload"weapon_m249""balrog7__Reload_Post"1); 
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage"
    
register_forward(FM_CmdStart"fw_CmdStart"
    
register_forward(FM_SetModel"fw_SetModel"
    
register_forward(FM_UpdateClientData"fw_UpdateClientData_Post"1
    
register_forward(FM_PlaybackEvent"fwPlaybackEvent"
     
    
g_iMsgSayTxt get_user_msgid("SayText"
     
    
cvar_dmg_balrog7 register_cvar("zp_balrog-7_dmg""1.15"
    
cvar_clip_balrog7 register_cvar("zp_balrog-7_clip""120"
    
cvar_balrog7_ammo register_cvar("zp_balrog-7_ammo""240"
    
cvar_shellshealth_balrog7 register_cvar("zp_balrog7_shellslife""2"
     
    
register_clcmd("weapon_balrog7""client_cmd_balrog7"
     
    
g_itemid_balrog7 zp_register_extra_item("Balrog M249"BALROG7_COSTZP_TEAM_HUMAN
     
    
g_MaxPlayers get_maxplayers() 


public 
plugin_precache() 

    
precache_model(balrog7_V_MODEL
    
precache_model(balrog7_P_MODEL
    
precache_model(balrog7_W_MODEL
    
shells_model precache_model(balrog7_SHELL_MODEL
    
precache_sound(Fire_snd
    
precache_sound("weapons/balrog7-2.wav"
    
precache_sound("weapons/balrog7_clipin1.wav"
    
precache_sound("weapons/balrog7_clipin2.wav"
    
precache_sound("weapons/balrog7_clipin3.wav"
    
precache_sound("weapons/balrog7_clipout1.wav"
    
precache_sound("weapons/balrog7_clipout2.wav"
    
sExplo precache_model("sprites/zerogxplode.spr"
    
m_iBlood[0] = precache_model("sprites/blood.spr"
    
m_iBlood[1] = precache_model("sprites/bloodspray.spr"
    
precache_generic("sprites/weapon_balrog7.txt"
       
precache_generic("sprites/640hud76.spr"
        
precache_generic("sprites/640hud2.spr"
     
    
register_forward(FM_PrecacheEvent"fwPrecacheEvent_Post"1
    
register_message(78"msg_weaplist"
     


public 
client_cmd_balrog7(id

    
engclient_cmd(id"weapon_m249"


public 
zp_user_humanized_post(id

    
g_has_balrog7[id] = false 


public 
plugin_natives () 

    
register_native("give_weapon_balrog7""native_give_weapon_add"1
    
register_native("drop_weapon_balrog7""native_drop_weapon"1


public 
native_give_weapon_add(id

    
give_balrog7(id


public 
native_drop_weapon(id

    
ham_strip_weapon(id"weapon_m249"


public 
fwPrecacheEvent_Post(type, const name[]) 

    if(
equal("events/m249.sc"name)) 
    { 
        
g_orig_event_balrog7 get_orig_retval() 
        return 
FMRES_HANDLED 
    

    return 
FMRES_IGNORED 


public 
client_connect(id

    
g_has_balrog7[id] = false 


public 
client_disconnect(id

    
g_has_balrog7[id] = false 


public 
zp_user_infected_post(id

    if(
zp_get_user_zombie(id)) 
    { 
        
g_has_balrog7[id] = false 
    



public 
fw_SetModel(entitymodel[]) 

    if(!
is_valid_ent(entity)) 
        return 
FMRES_IGNORED
    static 
szClassName[33
    
entity_get_string(entityEV_SZ_classnameszClassNamecharsmax(szClassName)) 
    if(!
equal(szClassName"weaponbox")) 
        return 
FMRES_IGNORED
    static 
iOwner 
    iOwner 
entity_get_edict(entityEV_ENT_owner
    if(
equal(model"models/w_m249.mdl")) 
    { 
        static 
iStoredSVDID 
        iStoredSVDID 
find_ent_by_owner(ENG_NULLENT"weapon_m249"entity
        if(!
is_valid_ent(iStoredSVDID)) 
            return 
FMRES_IGNORED
        if(
g_has_balrog7[iOwner]) 
        { 
            
entity_set_int(iStoredSVDIDEV_INT_WEAPONKEYbalrog-7_WEAPONKEY
            
g_has_balrog7[iOwner] = false 
            set_weaplist
(iOwner0
            
entity_set_model(entitybalrog7_W_MODEL
            
set_pev(entitypev_bodyBODY_SKIN_W_BALROG7
             
            return 
FMRES_SUPERCEDE
        } 
    } 
    return 
FMRES_IGNORED


public 
give_balrog7(id

    
drop_weapons(id1); 
    new 
iWep2 give_item(id"weapon_m249"
    if(
iWep2 0
    { 
        
cs_set_weapon_ammo(iWep2get_pcvar_num(cvar_clip_balrog7)) 
        
cs_set_user_bpammo(idCSW_BALROG7get_pcvar_num(cvar_balrog7_ammo)) 
        
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("AmmoPickup"), _id
        
write_byte(3
        
write_byte(240
        
message_end() 
        
set_weaplist(id1
    } 
    
g_has_balrog7[id] = true


public 
zp_extra_item_selected(iditemid)  
{  
    if(
itemid != g_itemid_balrog7)  
        return  
      
    
give_balrog7(id)  

     
client_print(idprint_chat"!gZoD*| !tYou bought !yBalrog M249")  
}   

public 
fw_balrog7_AddToPlayer(balrog7id

    if(!
is_valid_ent(balrog7) || !is_user_connected(id)) 
        return 
HAM_IGNORED
     
    if(
entity_get_int(balrog7EV_INT_WEAPONKEY) == balrog-7_WEAPONKEY
    { 
        
g_has_balrog7[id] = true 
        set_weaplist
(id1
        
entity_set_int(balrog7EV_INT_WEAPONKEY0
         
        return 
HAM_HANDLED
    } 
    return 
HAM_IGNORED


public 
fw_UseStationary_Post(entitycalleractivatoruse_type

    if(
use_type == USE_STOPPED && is_user_connected(caller)) 
        
replace_weapon_models(callerget_user_weapon(caller)) 


public 
fw_Item_Deploy_Post(weapon_ent

    static 
owner 
    owner 
fm_cs_get_weapon_ent_owner(weapon_ent
     
    static 
weaponid 
    weaponid 
cs_get_weapon_id(weapon_ent
     
    
replace_weapon_models(ownerweaponid


public 
CurrentWeapon(id

    
replace_weapon_models(idread_data(2)) 


replace_weapon_models(idweaponid

switch (
weaponid

    case 
CSW_BALROG7
    { 
        if(
zp_get_user_zombie(id)) 
            return; 
             
        if(
g_has_balrog7[id]) 
            { 
                
set_pev(idpev_viewmodel2balrog7_V_MODEL
                
set_pev(idpev_weaponmodel2balrog7_P_MODEL
            } 
        } 
    } 


public 
fw_UpdateClientData_Post(PlayerSendWeaponsCD_Handle

    if(!
is_user_alive(Player) || (get_user_weapon(Player) != CSW_BALROG7) || !g_has_balrog7[Player]) 
        return 
FMRES_IGNORED 
     
    set_cd
(CD_HandleCD_flNextAttackhalflife_time () + 0.001
    return 
FMRES_HANDLED 


public 
fw_balrog7_PrimaryAttack(Weapon

    new 
Player get_pdata_cbase(Weapon414
    if(!
g_has_balrog7[Player]) 
        return; 
     
    
pev(Playerpev_punchanglecl_pushangle[Player]) 
    
g_clip_ammo[Player] = cs_get_weapon_ammo(Weapon


public 
fwPlaybackEvent(flagsinvokereventidFloat:delayFloat:origin[3], Float:angles[3], Float:fparam1Float:fparam2iParam1iParam2bParam1bParam2

    if((
eventid != g_orig_event_balrog7)) 
        return 
FMRES_IGNORED 
    
if(!(<= invoker <= g_MaxPlayers)) 
        return 
FMRES_IGNORED 
    playback_event
(flags FEV_HOSTONLYinvokereventiddelayoriginanglesfparam1fparam2iParam1iParam2bParam1bParam2
    return 
FMRES_SUPERCEDE 


public 
fw_CmdStart(iduc_handleseed)  

    new 
Float:flNextAttack get_pdata_float(idm_flNextAttackPLAYER_LINUX_XTRA_OFF
    if(
g_has_balrog7[id] && get_user_weapon(id) == CSW_M249 && (get_uc(uc_handleUC_Buttons) & IN_ATTACK2) && !(pev(idpev_oldbuttons) & IN_ATTACK2) && flNextAttack 0.1
    { 
        if(!
in_zoom[id]) 
        { 
            
cs_set_user_zoom(idCS_SET_AUGSG552_ZOOM0
            
emit_sound(idCHAN_ITEM"weapons/zoom.wav"0.202.400100
            
in_zoom[id] = 
        

        else if(
in_zoom[id]) 
        { 
            
in_zoom[id] = 
            cs_set_user_zoom
(idCS_RESET_ZOOM1
            
emit_sound(idCHAN_ITEM"weapons/zoom.wav"0.202.400100
        } 
    } 


public 
fw_balrog7_PrimaryAttack_Post(Weapon

    new 
Player get_pdata_cbase(Weapon414
    new 
szClipszAmmo 
    get_user_weapon
(PlayerszClipszAmmo
    if(
Player && Player 33
    { 
        if(
g_has_balrog7[Player]) 
        { 
            if(
szClip 0emit_sound(PlayerCHAN_WEAPONFire_sndVOL_NORMATTN_NORM0PITCH_NORM
        } 
        if(
g_has_balrog7[Player]) 
        { 
            new 
Float:push[3
            
pev(Playerpev_punchanglepush
            
xs_vec_sub(pushcl_pushangle[Player], push
            
xs_vec_mul_scalar(push0.6push
            
xs_vec_add(pushcl_pushangle[Player], push
            
set_pev(Playerpev_punchanglepush
             
            if(!
g_clip_ammo[Player]) 
                return 
             
            
UTIL_PlayWeaponAnimation(Playerrandom_num(12)) 
            
make_blood_and_bulletholes(Player
            
make_shell(Player
             
            if(
get_gametime()-1.0 g_lastexpl[Player]) 
            { 
                
explode(Player
                
UTIL_PlayWeaponAnimation(Player2
                
g_lastexpl[Player] = get_gametime() 
            } 
            if(
in_zoom[Player]) set_pdata_float(Playerm_flNextAttack0.25
        } 
    } 


public 
explode(id

    if(
is_user_alive(id)) 
    { 
        
message_begin(MSG_ONEget_user_msgid("ScreenFade"), _id); 
        
write_short(1<<8); 
        
write_short(1<<8); 
        
write_short(1<<0); 
        
write_byte(255); 
        
write_byte(0); 
        
write_byte(0); 
        
write_byte(100); 
        
message_end(); 
         
        new 
Float:originF[3
        
fm_get_aim_origin(idoriginF
        
message_begin(MSG_ALLSVC_TEMPENTITY
        
write_byte(TE_SPARKS
        
engfunc(EngFunc_WriteCoordoriginF[0]) 
        
engfunc(EngFunc_WriteCoordoriginF[1]) 
        
engfunc(EngFunc_WriteCoordoriginF[2]+30.0
        
message_end() 
         
        
message_begin(MSG_ALLSVC_TEMPENTITY
        
write_byte(TE_SPARKS
        
engfunc(EngFunc_WriteCoordoriginF[0]+30.0
        
engfunc(EngFunc_WriteCoordoriginF[1]) 
        
engfunc(EngFunc_WriteCoordoriginF[2]+30.0
        
message_end() 
         
        
message_begin(MSG_ALLSVC_TEMPENTITY)  
        
write_byte(TE_SPARKS
        
engfunc(EngFunc_WriteCoordoriginF[0]) 
        
engfunc(EngFunc_WriteCoordoriginF[1]+30.0
        
engfunc(EngFunc_WriteCoordoriginF[2]+30.0
        
message_end() 
         
        
message_begin(MSG_ALLSVC_TEMPENTITY
        
write_byte(TE_SPARKS
        
engfunc(EngFunc_WriteCoordoriginF[0]) 
        
engfunc(EngFunc_WriteCoordoriginF[1]+40.0
        
engfunc(EngFunc_WriteCoordoriginF[2]+40.0
        
message_end() 
         
        
message_begin(MSG_ALLSVC_TEMPENTITY
        
write_byte(TE_SPARKS
        
engfunc(EngFunc_WriteCoordoriginF[0]) 
        
engfunc(EngFunc_WriteCoordoriginF[1]+40.0
        
engfunc(EngFunc_WriteCoordoriginF[2]+30.0
        
message_end() 
         
        
message_begin(MSG_ALLSVC_TEMPENTITY
        
write_byte(TE_SPARKS
        
engfunc(EngFunc_WriteCoordoriginF[0]) 
        
engfunc(EngFunc_WriteCoordoriginF[1]+30.0
        
engfunc(EngFunc_WriteCoordoriginF[2]+40.0
        
message_end() 
         
        
// Draw explosion 
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY
        
write_byte(TE_EXPLOSION// Temporary entity ID 
        
engfunc(EngFunc_WriteCoordoriginF[0]) // engfunc because float 
        
engfunc(EngFunc_WriteCoordoriginF[1]) 
        
engfunc(EngFunc_WriteCoordoriginF[2]+30.0
        
write_short(sExplo// Sprite index 
        
write_byte(20// Scale 
        
write_byte(30// Framerate 
        
write_byte(0// Flags 
        
message_end() 
         
        
// Alive... 
        
new FM_NULLENT 
        
// Get distance between victim and epicenter 
        
while((find_ent_in_sphere(aoriginF60.0)) != 0
        { 
            if (
id == a
                continue  
                 
            if(
pev(apev_takedamage) != DAMAGE_NO
            { 
                
ExecuteHamB(Ham_TakeDamageaidid100.0DMG_BULLET
            } 
        } 
        return 
PLUGIN_HANDLED 
    

    return 
PLUGIN_HANDLED 


public 
fw_TakeDamage(victiminflictorattackerFloat:damage

    if(
victim != attacker && is_user_connected(attacker)) 
    { 
        if(
get_user_weapon(attacker) == CSW_BALROG7
        { 
            if(
g_has_balrog7[attacker]) 
                
SetHamParamFloat(4damage get_pcvar_float(cvar_dmg_balrog7)) 
        } 
    } 


stock fm_cs_get_current_weapon_ent(id

    return 
get_pdata_cbase(idOFFSET_ACTIVE_ITEMOFFSET_LINUX); 


stock fm_cs_get_weapon_ent_owner(ent

    return 
get_pdata_cbase(entOFFSET_WEAPONOWNEROFFSET_LINUX_WEAPONS); 


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 make_blood_and_bulletholes(id

    new 
aimOrigin[3], targetbody 
    get_user_origin
(idaimOrigin3
    
get_user_aiming(idtargetbody
    if(
target && target <= g_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(m_iBlood[1]) 
        
write_short(m_iBlood[0]) 
        
write_byte(70
        
write_byte(random_num(12)) 
        
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 -1)]) 
        
message_end() 
    } 


public 
balrog7__ItemPostFrame(weapon_entity

    new 
id pev(weapon_entitypev_owner
    if(!
is_user_connected(id)) 
        return 
HAM_IGNORED
     
    if(!
g_has_balrog7[id]) 
        return 
HAM_IGNORED
     
    new 
Float:flNextAttack get_pdata_float(idm_flNextAttackPLAYER_LINUX_XTRA_OFF
    new 
iBpAmmo cs_get_user_bpammo(idCSW_BALROG7); 
    new 
iClip get_pdata_int(weapon_entitym_iClipWEAP_LINUX_XTRA_OFF
    new 
fInReload get_pdata_int(weapon_entitym_fInReloadWEAP_LINUX_XTRA_OFF
    if(!(
get_user_button(id) & IN_ATTACK)) 
        
g_lastexpl[id]=get_gametime() 
     
    if(
fInReload && flNextAttack <= 0.0
    { 
        new 
min(get_pcvar_num(cvar_clip_balrog7) - iClipiBpAmmo
        
set_pdata_int(weapon_entitym_iClipiClip jWEAP_LINUX_XTRA_OFF
        
cs_set_user_bpammo(idCSW_BALROG7iBpAmmo-j); 
        
set_pdata_int(weapon_entitym_fInReload0WEAP_LINUX_XTRA_OFF
        
fInReload 
    

    return 
HAM_IGNORED


public 
balrog7__Reload(weapon_entity

    new 
id pev(weapon_entitypev_owner
    if(!
is_user_connected(id)) 
        return 
HAM_IGNORED
     
    if(!
g_has_balrog7[id]) 
        return 
HAM_IGNORED
     
    
g_balrog7_TmpClip[id] = -1
    new 
iBpAmmo cs_get_user_bpammo(idCSW_BALROG7); 
    new 
iClip get_pdata_int(weapon_entitym_iClipWEAP_LINUX_XTRA_OFF
    if(
iBpAmmo <= 0
        return 
HAM_SUPERCEDE
     
    if(
iClip >= get_pcvar_num(cvar_clip_balrog7)) 
        return 
HAM_SUPERCEDE
     
    
g_balrog7_TmpClip[id] = iClip
    return 
HAM_IGNORED


public 
balrog7__Reload_Post(weapon_entity

    new 
id pev(weapon_entitypev_owner
    if(!
is_user_connected(id)) 
        return 
HAM_IGNORED
     
    if(!
g_has_balrog7[id]) 
        return 
HAM_IGNORED
     
    if(
g_balrog7_TmpClip[id] == -1
        return 
HAM_IGNORED
     
    
set_pdata_int(weapon_entitym_iClipg_balrog7_TmpClip[id], WEAP_LINUX_XTRA_OFF
     
    
set_pdata_float(weapon_entitym_flTimeWeaponIdleRELOAD_TIMEWEAP_LINUX_XTRA_OFF
     
    
set_pdata_float(idm_flNextAttackRELOAD_TIMEPLAYER_LINUX_XTRA_OFF
     
    
set_pdata_int(weapon_entitym_fInReload1WEAP_LINUX_XTRA_OFF
     
    if(
in_zoom[id]) 
    { 
        
in_zoom[id] = 
        cs_set_user_zoom
(idCS_RESET_ZOOM1
        
emit_sound(idCHAN_ITEM"weapons/zoom.wav"0.202.400100
    } 
     
    
UTIL_PlayWeaponAnimation(id3
     
    return 
HAM_IGNORED


public 
msg_weaplist(msg_idmsg_destmsg_entity

    if(
get_msg_arg_int(8) == CSW_BALROG7
    { 
        
weapon_vars[2] = get_msg_arg_int(2
        
weapon_vars[3] = get_msg_arg_int(3
        
weapon_vars[4] = get_msg_arg_int(4
        
weapon_vars[5] = get_msg_arg_int(5
        
weapon_vars[6] = get_msg_arg_int(6
        
weapon_vars[7] = get_msg_arg_int(7
        
weapon_vars[8] = get_msg_arg_int(8
        
weapon_vars[9] = get_msg_arg_int(9
    } 


public 
set_weaplist(idnum

    if(!
is_user_connected(id)) 
        return; 
     
    
message_begin(MSG_ONEget_user_msgid("WeaponList"), {0,0,0}, id)  
    
write_string(num "weapon_balrog7"weapon_balrog7_kobra)  
    
write_byte(weapon_vars[2])  
    
write_byte(weapon_vars[3])  
    
write_byte(weapon_vars[4])  
    
write_byte(weapon_vars[5])  
    
write_byte(weapon_vars[6])  
    
write_byte(weapon_vars[7])  
    
write_byte(weapon_vars[8])  
    
write_byte(weapon_vars[9])  
    
message_end() 


stock drop_weapons(iddropwhat

    static 
weapons[32], numiweaponid 
    num 

    get_user_weapons
(idweaponsnum
     
    for (
0numi++) 
    { 
        
weaponid weapons[i
         
        if(
dropwhat == && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) 
        { 
            static 
wname[32
            
get_weaponname(weaponidwnamesizeof wname 1
            
engclient_cmd(id"drop"wname
        } 
    } 


public 
make_shell(id

    if(!
is_user_alive(id) || zp_get_user_zombie(id)) 
        return; 
     
    if(
get_user_weapon(id) != CSW_BALROG7)  
        return; 
     
    if(!
g_has_balrog7[id]) 
        return; 
     
    static 
Float:player_origin[3], Float:origin[3], Float:origin2[3], Float:gunorigin[3], Float:oldangles[3], Float:v_forward[3], Float:v_forward2[3], Float:v_up[3], Float:v_up2[3], Float:v_right[3], Float:v_right2[3], Float:viewoffsets[3]; 
    
pev(id,pev_v_angleoldangles
    
pev(id,pev_origin,player_origin
    
pev(idpev_view_ofsviewoffsets); 
     
    
engfunc(EngFunc_MakeVectorsoldangles); 
     
    
global_get(glb_v_forwardv_forward); 
    
global_get(glb_v_upv_up); 
    
global_get(glb_v_rightv_right); 
     
    
global_get(glb_v_forwardv_forward2); 
    
global_get(glb_v_upv_up2); 
    
global_get(glb_v_rightv_right2); 
     
    
xs_vec_add(player_originviewoffsetsgunorigin); 
     
    
xs_vec_mul_scalar(v_forward10.3v_forward); 
    
xs_vec_mul_scalar(v_right2.9v_right); 
    
xs_vec_mul_scalar(v_up, -3.7v_up); 
     
    
xs_vec_mul_scalar(v_forward210.0v_forward2); 
    
xs_vec_mul_scalar(v_right23.0v_right2); 
    
xs_vec_mul_scalar(v_up2, -4.0v_up2); 
     
    
xs_vec_add(gunoriginv_forwardorigin); 
    
xs_vec_add(gunoriginv_forward2origin2); 
    
xs_vec_add(originv_rightorigin); 
    
xs_vec_add(origin2v_right2origin2); 
    
xs_vec_add(originv_uporigin); 
    
xs_vec_add(origin2v_up2origin2); 
     
    new 
Float:velocity[3
    
get_speed_vector(origin2originrandom_float(140.0160.0), velocity
     
    new 
angle random_num(0360
     
    
message_begin(MSG_ONE_UNRELIABLESVC_TEMPENTITY_id
    
write_byte(TE_MODEL
    
write_coord_f(origin[0]) 
    
write_coord_f(origin[1]) 
    
write_coord_f(origin[2]) 
    
write_coord_f(velocity[0]) 
    
write_coord_f(velocity[1]) 
    
write_coord_f(velocity[2]) 
    
write_angle(angle
    
write_short(shells_model
    
write_byte(1
    
write_byte(get_pcvar_num(cvar_shellshealth_balrog7) * 10
    
message_end() 
     
    new 
Float:origin3[3
    
origin3 origin 
     
    xs_vec_mul_scalar
(v_forward3.9v_forward); 
    
xs_vec_add(originv_forwardorigin); 
     
    for(new 
i<= 32i++) 
    { 
        if(!
is_user_connected(i) || == id) continue; 
         
        if(!
is_user_alive(i) && pev(ipev_iuser2) == id && pev(ipev_iuser1) == 4
        { 
            
message_begin(MSG_ONE_UNRELIABLESVC_TEMPENTITY_i
            
write_byte(TE_MODEL
            
write_coord_f(origin3[0]) 
            
write_coord_f(origin3[1]) 
            
write_coord_f(origin3[2]) 
            
write_coord_f(velocity[0]) 
            
write_coord_f(velocity[1]) 
            
write_coord_f(velocity[2]) 
            
write_angle(angle
            
write_short(shells_model
            
write_byte(1
            
write_byte(get_pcvar_num(cvar_shellshealth_balrog7) * 10
            
message_end()     
        } 
        else 
        { 
            
message_begin(MSG_ONE_UNRELIABLESVC_TEMPENTITY_i
            
write_byte(TE_MODEL
            
write_coord_f(origin[0]) 
            
write_coord_f(origin[1]) 
            
write_coord_f(origin[2]) 
            
write_coord_f(velocity[0]) 
            
write_coord_f(velocity[1]) 
            
write_coord_f(velocity[2]) 
            
write_angle(angle
            
write_short(shells_model
            
write_byte(1
            
write_byte(get_pcvar_num(cvar_shellshealth_balrog7) * 10
            
message_end()     
        } 
    } 


stock get_speed_vector(const Float:origin1[3], const Float:origin2[3], Float:speedFloat:new_velocity[3]) 

    
new_velocity[0] = origin2[0] - origin1[0
    
new_velocity[1] = origin2[1] - origin1[1
    
new_velocity[2] = origin2[2] - origin1[2
    new 
Float:num floatsqroot(speed speed / (new_velocity[0] * new_velocity[0] + new_velocity[1] * new_velocity[1] + new_velocity[2] * new_velocity[2])) 
    
new_velocity[0] *= num 
    new_velocity
[1] *= num 
    new_velocity
[2] *= num 
     
    
return 1


stock ham_strip_weapon(idweapon[]) 

    if(!
equal(weapon"weapon_"7)) return 0
     
    new 
wId get_weaponid(weapon); 
    if(!
wId) return 0
     
    new 
wEnt
    while((
wEnt engfunc(EngFunc_FindEntityByStringwEnt"classname"weapon)) && pev(wEntpev_owner) != id) {} 
    if(!
wEnt) return 0
     
    if(
get_user_weapon(id) == wIdExecuteHamB(Ham_Weapon_RetireWeaponwEnt); 
     
    if(!
ExecuteHamB(Ham_RemovePlayerItemidwEnt)) return 0
    
ExecuteHamB(Ham_Item_KillwEnt); 
     
    
set_pev(idpev_weaponspev(idpev_weapons) & ~(1<<wId)); 
     
    return 
1


stock print_colored(const index, const input [ ], const any:...)  
{   
    new 
message[191]  
    
vformat(message190input3)  
    
replace_all(message190"!y""^1")  
    
replace_all(message190"!t""^3")  
    
replace_all(message190"!g""^4")  

    if(
index)  
    {  
        
//print to single person  
        
message_begin(MSG_ONEg_iMsgSayTxt_index)  
        
write_byte(index)  
        
write_string(message)  
        
message_end()  
    }  
    else  
    {  
        
//print to all players  
        
new players[32], countiid  
        get_players
(playerscount"ch")  
        for( 
0count++ )  
        {  
            
id players[i]  
            if(!
is_user_connected(id)) continue;  

            
message_begin(MSG_ONE_UNRELIABLEg_iMsgSayTxt_id)  
            
write_byte(id)  
            
write_string(message)  
            
message_end()  
        }  
    }  


Last edited by C.Ronaldo; 09-26-2015 at 21:54.
C.Ronaldo is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 12-26-2014 , 11:11   Re: Message for guns
Reply With Quote #4

Because you dont have added the colorchat stock..

Add this stock at the end of the code and try..

PHP Code:
stock print_colored(const index, const input [ ], const any:...)    
{     
    new 
message[191]    
    
vformat(message190input3)    
    
replace_all(message190"!y""^1")    
    
replace_all(message190"!t""^3")    
    
replace_all(message190"!g""^4")    

    if(
index)    
    {    
        
//print to SINGLE PERSON    
        
message_begin(MSG_ONEg_iMsgSayTxt_index)    
        
write_byte(index)    
        
write_string(message)    
        
message_end()    
    }    
    else    
    {    
        
//print to all players    
        
new players[32], countiid    
        get_players
(playerscount"ch")    
        for( 
0count++ )    
        {    
            
id players[i]    
            if(!
is_user_connected(id)) continue;    

            
message_begin(MSG_ONE_UNRELIABLEg_iMsgSayTxt_id)    
            
write_byte(id)    
            
write_string(message)    
            
message_end()    
        }    
    }    

wicho is offline
C.Ronaldo
Senior Member
Join Date: Dec 2014
Old 12-26-2014 , 11:17   Re: Message for guns
Reply With Quote #5

not work same the problem.

PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <xs>
#include <cstrike>
#include <zombieplague>
#include <fakemeta_util>

#define weapon_balrog7_kobra "weapon_m249"
#define CSW_BALROG7 CSW_M249

#define ENG_NULLENT        -1
#define EV_INT_WEAPONKEY    EV_INT_impulse
#define balrog-7_WEAPONKEY    904
#define MAX_PLAYERS                32
#define IsValidUser(%1) (1 <= %1 <= g_MaxPlayers)
#define write_coord_f(%1)    engfunc(EngFunc_WriteCoord, %1)

const USE_STOPPED 0
const OFFSET_ACTIVE_ITEM 373
const OFFSET_WEAPONOWNER 41
const OFFSET_LINUX 5
const OFFSET_LINUX_WEAPONS 4

#define WEAP_LINUX_XTRA_OFF            4
#define m_fKnown                44
#define m_flNextPrimaryAttack             46
#define m_flTimeWeaponIdle            48
#define m_iClip                    51
#define m_fInReload                54
#define PLAYER_LINUX_XTRA_OFF            5
#define m_flNextAttack                83

#define RELOAD_TIME        4.0
#define BODY_SKIN_W_BALROG7        23
#define BALROG7_COST        60

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)

new const 
Fire_snd[] = { "weapons/balrog7-1.wav" }

new const 
GUNSHOT_DECALS[] = { 4142434445 }

new 
balrog7_V_MODEL[64] = "models/zp/v_balrog7.mdl"
new balrog7_P_MODEL[64] = "models/zp/p_balrog7.mdl"
new balrog7_W_MODEL[64] = "models/zp/w_balrog7.mdl"
new balrog7_SHELL_MODEL[64] = "models/rshell.mdl"

new cvar_dmg_balrog7g_itemid_balrog7cvar_clip_balrog7cvar_balrog7_ammocvar_shellshealth_balrog7shells_model
new g_has_balrog7[33]
new 
g_MaxPlayersg_orig_event_balrog7g_clip_ammo[33]
new 
Float:cl_pushangle[MAX_PLAYERS 1][3], m_iBlood[2], weapon_vars[10]
new 
g_balrog7_TmpClip[33]
new 
Float:g_lastexpl[33], sExploin_zoom[33]

new 
g_iMsgSayTxt

public plugin_init()
{
    
register_plugin("Balrog M249""1.0""Crock / =)")
    
register_event("CurWeapon""CurrentWeapon""be""1=1")
    
RegisterHam(Ham_Item_AddToPlayer"weapon_m249""fw_balrog7_AddToPlayer")
    
RegisterHam(Ham_Use"func_tank""fw_UseStationary_Post"1)
    
RegisterHam(Ham_Use"func_tankmortar""fw_UseStationary_Post"1)
    
RegisterHam(Ham_Use"func_tankrocket""fw_UseStationary_Post"1)
    
RegisterHam(Ham_Use"func_tanklaser""fw_UseStationary_Post"1)
    
RegisterHam(Ham_Item_Deploy"weapon_m249""fw_Item_Deploy_Post"1)
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_m249""fw_balrog7_PrimaryAttack")
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_m249""fw_balrog7_PrimaryAttack_Post"1)
    
RegisterHam(Ham_Item_PostFrame"weapon_m249""balrog7__ItemPostFrame");
    
RegisterHam(Ham_Weapon_Reload"weapon_m249""balrog7__Reload");
    
RegisterHam(Ham_Weapon_Reload"weapon_m249""balrog7__Reload_Post"1);
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
register_forward(FM_CmdStart"fw_CmdStart")
    
register_forward(FM_SetModel"fw_SetModel")
    
register_forward(FM_UpdateClientData"fw_UpdateClientData_Post"1)
    
register_forward(FM_PlaybackEvent"fwPlaybackEvent")
    
    
g_iMsgSayTxt get_user_msgid("SayText")
    
    
cvar_dmg_balrog7 register_cvar("zp_balrog-7_dmg""1.15")
    
cvar_clip_balrog7 register_cvar("zp_balrog-7_clip""120")
    
cvar_balrog7_ammo register_cvar("zp_balrog-7_ammo""240")
    
cvar_shellshealth_balrog7 register_cvar("zp_balrog7_shellslife""2")
    
    
register_clcmd("weapon_balrog7""client_cmd_balrog7")
    
    
g_itemid_balrog7 zp_register_extra_item("Balrog M249"BALROG7_COSTZP_TEAM_HUMAN)
    
    
g_MaxPlayers get_maxplayers()
}

public 
plugin_precache()
{
    
precache_model(balrog7_V_MODEL)
    
precache_model(balrog7_P_MODEL)
    
precache_model(balrog7_W_MODEL)
    
shells_model precache_model(balrog7_SHELL_MODEL)
    
precache_sound(Fire_snd)
    
precache_sound("weapons/balrog7-2.wav")
    
precache_sound("weapons/balrog7_clipin1.wav")
    
precache_sound("weapons/balrog7_clipin2.wav")
    
precache_sound("weapons/balrog7_clipin3.wav")
    
precache_sound("weapons/balrog7_clipout1.wav")
    
precache_sound("weapons/balrog7_clipout2.wav")
    
sExplo precache_model("sprites/zerogxplode.spr")
    
m_iBlood[0] = precache_model("sprites/blood.spr")
    
m_iBlood[1] = precache_model("sprites/bloodspray.spr")
    
precache_generic("sprites/weapon_balrog7.txt")
       
precache_generic("sprites/640hud76.spr")
        
precache_generic("sprites/640hud2.spr")
    
    
register_forward(FM_PrecacheEvent"fwPrecacheEvent_Post"1)
    
register_message(78"msg_weaplist")
    
}

public 
client_cmd_balrog7(id)
{
    
engclient_cmd(id"weapon_m249")
}

public 
zp_user_humanized_post(id)
{
    
g_has_balrog7[id] = false
}

public 
plugin_natives ()
{
    
register_native("give_weapon_balrog7""native_give_weapon_add"1)
    
register_native("drop_weapon_balrog7""native_drop_weapon"1)
}

public 
native_give_weapon_add(id)
{
    
give_balrog7(id)
}

public 
native_drop_weapon(id)
{
    
ham_strip_weapon(id"weapon_m249")
}

public 
fwPrecacheEvent_Post(type, const name[])
{
    if(
equal("events/m249.sc"name))
    {
        
g_orig_event_balrog7 get_orig_retval()
        return 
FMRES_HANDLED
    
}
    return 
FMRES_IGNORED
}

public 
client_connect(id)
{
    
g_has_balrog7[id] = false
}

public 
client_disconnect(id)
{
    
g_has_balrog7[id] = false
}

public 
zp_user_infected_post(id)
{
    if(
zp_get_user_zombie(id))
    {
        
g_has_balrog7[id] = false
    
}
}

public 
fw_SetModel(entitymodel[])
{
    if(!
is_valid_ent(entity))
        return 
FMRES_IGNORED;
    static 
szClassName[33]
    
entity_get_string(entityEV_SZ_classnameszClassNamecharsmax(szClassName))
    if(!
equal(szClassName"weaponbox"))
        return 
FMRES_IGNORED;
    static 
iOwner
    iOwner 
entity_get_edict(entityEV_ENT_owner)
    if(
equal(model"models/w_m249.mdl"))
    {
        static 
iStoredSVDID
        iStoredSVDID 
find_ent_by_owner(ENG_NULLENT"weapon_m249"entity)
        if(!
is_valid_ent(iStoredSVDID))
            return 
FMRES_IGNORED;
        if(
g_has_balrog7[iOwner])
        {
            
entity_set_int(iStoredSVDIDEV_INT_WEAPONKEYbalrog-7_WEAPONKEY)
            
g_has_balrog7[iOwner] = false
            set_weaplist
(iOwner0)
            
entity_set_model(entitybalrog7_W_MODEL)
            
set_pev(entitypev_bodyBODY_SKIN_W_BALROG7)
            
            return 
FMRES_SUPERCEDE;
        }
    }
    return 
FMRES_IGNORED;
}

public 
give_balrog7(id)
{
    
drop_weapons(id1);
    new 
iWep2 give_item(id"weapon_m249")
    if(
iWep2 0)
    {
        
cs_set_weapon_ammo(iWep2get_pcvar_num(cvar_clip_balrog7))
        
cs_set_user_bpammo(idCSW_BALROG7get_pcvar_num(cvar_balrog7_ammo))
        
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("AmmoPickup"), _id)
        
write_byte(3)
        
write_byte(240)
        
message_end()
        
set_weaplist(id1)
    }
    
g_has_balrog7[id] = true;
}

public 
zp_extra_item_selected(iditemid

    if(
itemid != g_itemid_balrog7
        return 
     
    
give_balrog7(id

     
client_print(idprint_chat"!gZoD*| !tYou bought !yBalrog M249"
}  

public 
fw_balrog7_AddToPlayer(balrog7id)
{
    if(!
is_valid_ent(balrog7) || !is_user_connected(id))
        return 
HAM_IGNORED;
    
    if(
entity_get_int(balrog7EV_INT_WEAPONKEY) == balrog-7_WEAPONKEY)
    {
        
g_has_balrog7[id] = true
        set_weaplist
(id1)
        
entity_set_int(balrog7EV_INT_WEAPONKEY0)
        
        return 
HAM_HANDLED;
    }
    return 
HAM_IGNORED;
}

public 
fw_UseStationary_Post(entitycalleractivatoruse_type)
{
    if(
use_type == USE_STOPPED && is_user_connected(caller))
        
replace_weapon_models(callerget_user_weapon(caller))
}

public 
fw_Item_Deploy_Post(weapon_ent)
{
    static 
owner
    owner 
fm_cs_get_weapon_ent_owner(weapon_ent)
    
    static 
weaponid
    weaponid 
cs_get_weapon_id(weapon_ent)
    
    
replace_weapon_models(ownerweaponid)
}

public 
CurrentWeapon(id)
{
    
replace_weapon_models(idread_data(2))
}

replace_weapon_models(idweaponid)
{
switch (
weaponid)
{
    case 
CSW_BALROG7:
    {
        if(
zp_get_user_zombie(id))
            return;
            
        if(
g_has_balrog7[id])
            {
                
set_pev(idpev_viewmodel2balrog7_V_MODEL)
                
set_pev(idpev_weaponmodel2balrog7_P_MODEL)
            }
        }
    }
}

public 
fw_UpdateClientData_Post(PlayerSendWeaponsCD_Handle)
{
    if(!
is_user_alive(Player) || (get_user_weapon(Player) != CSW_BALROG7) || !g_has_balrog7[Player])
        return 
FMRES_IGNORED
    
    set_cd
(CD_HandleCD_flNextAttackhalflife_time () + 0.001)
    return 
FMRES_HANDLED
}

public 
fw_balrog7_PrimaryAttack(Weapon)
{
    new 
Player get_pdata_cbase(Weapon414)
    if(!
g_has_balrog7[Player])
        return;
    
    
pev(Playerpev_punchanglecl_pushangle[Player])
    
g_clip_ammo[Player] = cs_get_weapon_ammo(Weapon)
}

public 
fwPlaybackEvent(flagsinvokereventidFloat:delayFloat:origin[3], Float:angles[3], Float:fparam1Float:fparam2iParam1iParam2bParam1bParam2)
{
    if((
eventid != g_orig_event_balrog7))
        return 
FMRES_IGNORED
    
if(!(<= invoker <= g_MaxPlayers))
        return 
FMRES_IGNORED
    playback_event
(flags FEV_HOSTONLYinvokereventiddelayoriginanglesfparam1fparam2iParam1iParam2bParam1bParam2)
    return 
FMRES_SUPERCEDE
}

public 
fw_CmdStart(iduc_handleseed
{
    new 
Float:flNextAttack get_pdata_float(idm_flNextAttackPLAYER_LINUX_XTRA_OFF)
    if(
g_has_balrog7[id] && get_user_weapon(id) == CSW_M249 && (get_uc(uc_handleUC_Buttons) & IN_ATTACK2) && !(pev(idpev_oldbuttons) & IN_ATTACK2) && flNextAttack 0.1)
    {
        if(!
in_zoom[id])
        {
            
cs_set_user_zoom(idCS_SET_AUGSG552_ZOOM0)
            
emit_sound(idCHAN_ITEM"weapons/zoom.wav"0.202.400100)
            
in_zoom[id] = 1
        
}
        else if(
in_zoom[id])
        {
            
in_zoom[id] = 0
            cs_set_user_zoom
(idCS_RESET_ZOOM1)
            
emit_sound(idCHAN_ITEM"weapons/zoom.wav"0.202.400100)
        }
    }
}

public 
fw_balrog7_PrimaryAttack_Post(Weapon)
{
    new 
Player get_pdata_cbase(Weapon414)
    new 
szClipszAmmo
    get_user_weapon
(PlayerszClipszAmmo)
    if(
Player && Player 33)
    {
        if(
g_has_balrog7[Player])
        {
            if(
szClip 0emit_sound(PlayerCHAN_WEAPONFire_sndVOL_NORMATTN_NORM0PITCH_NORM)
        }
        if(
g_has_balrog7[Player])
        {
            new 
Float:push[3]
            
pev(Playerpev_punchanglepush)
            
xs_vec_sub(pushcl_pushangle[Player], push)
            
xs_vec_mul_scalar(push0.6push)
            
xs_vec_add(pushcl_pushangle[Player], push)
            
set_pev(Playerpev_punchanglepush)
            
            if(!
g_clip_ammo[Player])
                return
            
            
UTIL_PlayWeaponAnimation(Playerrandom_num(12))
            
make_blood_and_bulletholes(Player)
            
make_shell(Player)
            
            if(
get_gametime()-1.0 g_lastexpl[Player])
            {
                
explode(Player)
                
UTIL_PlayWeaponAnimation(Player2)
                
g_lastexpl[Player] = get_gametime()
            }
            if(
in_zoom[Player]) set_pdata_float(Playerm_flNextAttack0.25)
        }
    }
}

public 
explode(id)
{
    if(
is_user_alive(id))
    {
        
message_begin(MSG_ONEget_user_msgid("ScreenFade"), _id);
        
write_short(1<<8);
        
write_short(1<<8);
        
write_short(1<<0);
        
write_byte(255);
        
write_byte(0);
        
write_byte(0);
        
write_byte(100);
        
message_end();
        
        new 
Float:originF[3]
        
fm_get_aim_origin(idoriginF)
        
message_begin(MSG_ALLSVC_TEMPENTITY)
        
write_byte(TE_SPARKS)
        
engfunc(EngFunc_WriteCoordoriginF[0])
        
engfunc(EngFunc_WriteCoordoriginF[1])
        
engfunc(EngFunc_WriteCoordoriginF[2]+30.0)
        
message_end()
        
        
message_begin(MSG_ALLSVC_TEMPENTITY)
        
write_byte(TE_SPARKS)
        
engfunc(EngFunc_WriteCoordoriginF[0]+30.0)
        
engfunc(EngFunc_WriteCoordoriginF[1])
        
engfunc(EngFunc_WriteCoordoriginF[2]+30.0)
        
message_end()
        
        
message_begin(MSG_ALLSVC_TEMPENTITY
        
write_byte(TE_SPARKS)
        
engfunc(EngFunc_WriteCoordoriginF[0])
        
engfunc(EngFunc_WriteCoordoriginF[1]+30.0)
        
engfunc(EngFunc_WriteCoordoriginF[2]+30.0)
        
message_end()
        
        
message_begin(MSG_ALLSVC_TEMPENTITY)
        
write_byte(TE_SPARKS)
        
engfunc(EngFunc_WriteCoordoriginF[0])
        
engfunc(EngFunc_WriteCoordoriginF[1]+40.0)
        
engfunc(EngFunc_WriteCoordoriginF[2]+40.0)
        
message_end()
        
        
message_begin(MSG_ALLSVC_TEMPENTITY)
        
write_byte(TE_SPARKS)
        
engfunc(EngFunc_WriteCoordoriginF[0])
        
engfunc(EngFunc_WriteCoordoriginF[1]+40.0)
        
engfunc(EngFunc_WriteCoordoriginF[2]+30.0)
        
message_end()
        
        
message_begin(MSG_ALLSVC_TEMPENTITY)
        
write_byte(TE_SPARKS)
        
engfunc(EngFunc_WriteCoordoriginF[0])
        
engfunc(EngFunc_WriteCoordoriginF[1]+30.0)
        
engfunc(EngFunc_WriteCoordoriginF[2]+40.0)
        
message_end()
        
        
// Draw explosion
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_EXPLOSION// Temporary entity ID
        
engfunc(EngFunc_WriteCoordoriginF[0]) // engfunc because float
        
engfunc(EngFunc_WriteCoordoriginF[1])
        
engfunc(EngFunc_WriteCoordoriginF[2]+30.0)
        
write_short(sExplo// Sprite index
        
write_byte(20// Scale
        
write_byte(30// Framerate
        
write_byte(0// Flags
        
message_end()
        
        
// Alive...
        
new FM_NULLENT
        
// Get distance between victim and epicenter
        
while((find_ent_in_sphere(aoriginF60.0)) != 0)
        {
            if (
id == a)
                continue 
                
            if(
pev(apev_takedamage) != DAMAGE_NO)
            {
                
ExecuteHamB(Ham_TakeDamageaidid100.0DMG_BULLET)
            }
        }
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_HANDLED
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damage)
{
    if(
victim != attacker && is_user_connected(attacker))
    {
        if(
get_user_weapon(attacker) == CSW_BALROG7)
        {
            if(
g_has_balrog7[attacker])
                
SetHamParamFloat(4damage get_pcvar_float(cvar_dmg_balrog7))
        }
    }
}

stock fm_cs_get_current_weapon_ent(id)
{
    return 
get_pdata_cbase(idOFFSET_ACTIVE_ITEMOFFSET_LINUX);
}

stock fm_cs_get_weapon_ent_owner(ent)
{
    return 
get_pdata_cbase(entOFFSET_WEAPONOWNEROFFSET_LINUX_WEAPONS);
}

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 make_blood_and_bulletholes(id)
{
    new 
aimOrigin[3], targetbody
    get_user_origin
(idaimOrigin3)
    
get_user_aiming(idtargetbody)
    if(
target && target <= g_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(m_iBlood[1])
        
write_short(m_iBlood[0])
        
write_byte(70)
        
write_byte(random_num(12))
        
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 -1)])
        
message_end()
    }
}

public 
balrog7__ItemPostFrame(weapon_entity)
{
    new 
id pev(weapon_entitypev_owner)
    if(!
is_user_connected(id))
        return 
HAM_IGNORED;
    
    if(!
g_has_balrog7[id])
        return 
HAM_IGNORED;
    
    new 
Float:flNextAttack get_pdata_float(idm_flNextAttackPLAYER_LINUX_XTRA_OFF)
    new 
iBpAmmo cs_get_user_bpammo(idCSW_BALROG7);
    new 
iClip get_pdata_int(weapon_entitym_iClipWEAP_LINUX_XTRA_OFF)
    new 
fInReload get_pdata_int(weapon_entitym_fInReloadWEAP_LINUX_XTRA_OFF)
    if(!(
get_user_button(id) & IN_ATTACK))
        
g_lastexpl[id]=get_gametime()
    
    if(
fInReload && flNextAttack <= 0.0)
    {
        new 
min(get_pcvar_num(cvar_clip_balrog7) - iClipiBpAmmo)
        
set_pdata_int(weapon_entitym_iClipiClip jWEAP_LINUX_XTRA_OFF)
        
cs_set_user_bpammo(idCSW_BALROG7iBpAmmo-j);
        
set_pdata_int(weapon_entitym_fInReload0WEAP_LINUX_XTRA_OFF)
        
fInReload 0
    
}
    return 
HAM_IGNORED;
}

public 
balrog7__Reload(weapon_entity)
{
    new 
id pev(weapon_entitypev_owner)
    if(!
is_user_connected(id))
        return 
HAM_IGNORED;
    
    if(!
g_has_balrog7[id])
        return 
HAM_IGNORED;
    
    
g_balrog7_TmpClip[id] = -1;
    new 
iBpAmmo cs_get_user_bpammo(idCSW_BALROG7);
    new 
iClip get_pdata_int(weapon_entitym_iClipWEAP_LINUX_XTRA_OFF)
    if(
iBpAmmo <= 0)
        return 
HAM_SUPERCEDE;
    
    if(
iClip >= get_pcvar_num(cvar_clip_balrog7))
        return 
HAM_SUPERCEDE;
    
    
g_balrog7_TmpClip[id] = iClip;
    return 
HAM_IGNORED;
}

public 
balrog7__Reload_Post(weapon_entity)
{
    new 
id pev(weapon_entitypev_owner)
    if(!
is_user_connected(id))
        return 
HAM_IGNORED;
    
    if(!
g_has_balrog7[id])
        return 
HAM_IGNORED;
    
    if(
g_balrog7_TmpClip[id] == -1)
        return 
HAM_IGNORED;
    
    
set_pdata_int(weapon_entitym_iClipg_balrog7_TmpClip[id], WEAP_LINUX_XTRA_OFF)
    
    
set_pdata_float(weapon_entitym_flTimeWeaponIdleRELOAD_TIMEWEAP_LINUX_XTRA_OFF)
    
    
set_pdata_float(idm_flNextAttackRELOAD_TIMEPLAYER_LINUX_XTRA_OFF)
    
    
set_pdata_int(weapon_entitym_fInReload1WEAP_LINUX_XTRA_OFF)
    
    if(
in_zoom[id])
    {
        
in_zoom[id] = 0
        cs_set_user_zoom
(idCS_RESET_ZOOM1)
        
emit_sound(idCHAN_ITEM"weapons/zoom.wav"0.202.400100)
    }
    
    
UTIL_PlayWeaponAnimation(id3)
    
    return 
HAM_IGNORED;
}

public 
msg_weaplist(msg_idmsg_destmsg_entity)
{
    if(
get_msg_arg_int(8) == CSW_BALROG7)
    {
        
weapon_vars[2] = get_msg_arg_int(2)
        
weapon_vars[3] = get_msg_arg_int(3)
        
weapon_vars[4] = get_msg_arg_int(4)
        
weapon_vars[5] = get_msg_arg_int(5)
        
weapon_vars[6] = get_msg_arg_int(6)
        
weapon_vars[7] = get_msg_arg_int(7)
        
weapon_vars[8] = get_msg_arg_int(8)
        
weapon_vars[9] = get_msg_arg_int(9)
    }
}

public 
set_weaplist(idnum)
{
    if(!
is_user_connected(id))
        return;
    
    
message_begin(MSG_ONEget_user_msgid("WeaponList"), {0,0,0}, id
    
write_string(num "weapon_balrog7"weapon_balrog7_kobra
    
write_byte(weapon_vars[2]) 
    
write_byte(weapon_vars[3]) 
    
write_byte(weapon_vars[4]) 
    
write_byte(weapon_vars[5]) 
    
write_byte(weapon_vars[6]) 
    
write_byte(weapon_vars[7]) 
    
write_byte(weapon_vars[8]) 
    
write_byte(weapon_vars[9]) 
    
message_end()
}

stock drop_weapons(iddropwhat)
{
    static 
weapons[32], numiweaponid
    num 
0
    get_user_weapons
(idweaponsnum)
    
    for (
0numi++)
    {
        
weaponid weapons[i]
        
        if(
dropwhat == && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
        {
            static 
wname[32]
            
get_weaponname(weaponidwnamesizeof wname 1)
            
engclient_cmd(id"drop"wname)
        }
    }
}

public 
make_shell(id)
{
    if(!
is_user_alive(id) || zp_get_user_zombie(id))
        return;
    
    if(
get_user_weapon(id) != CSW_BALROG7
        return;
    
    if(!
g_has_balrog7[id])
        return;
    
    static 
Float:player_origin[3], Float:origin[3], Float:origin2[3], Float:gunorigin[3], Float:oldangles[3], Float:v_forward[3], Float:v_forward2[3], Float:v_up[3], Float:v_up2[3], Float:v_right[3], Float:v_right2[3], Float:viewoffsets[3];
    
pev(id,pev_v_angleoldangles)
    
pev(id,pev_origin,player_origin)
    
pev(idpev_view_ofsviewoffsets);
    
    
engfunc(EngFunc_MakeVectorsoldangles);
    
    
global_get(glb_v_forwardv_forward);
    
global_get(glb_v_upv_up);
    
global_get(glb_v_rightv_right);
    
    
global_get(glb_v_forwardv_forward2);
    
global_get(glb_v_upv_up2);
    
global_get(glb_v_rightv_right2);
    
    
xs_vec_add(player_originviewoffsetsgunorigin);
    
    
xs_vec_mul_scalar(v_forward10.3v_forward);
    
xs_vec_mul_scalar(v_right2.9v_right);
    
xs_vec_mul_scalar(v_up, -3.7v_up);
    
    
xs_vec_mul_scalar(v_forward210.0v_forward2);
    
xs_vec_mul_scalar(v_right23.0v_right2);
    
xs_vec_mul_scalar(v_up2, -4.0v_up2);
    
    
xs_vec_add(gunoriginv_forwardorigin);
    
xs_vec_add(gunoriginv_forward2origin2);
    
xs_vec_add(originv_rightorigin);
    
xs_vec_add(origin2v_right2origin2);
    
xs_vec_add(originv_uporigin);
    
xs_vec_add(origin2v_up2origin2);
    
    new 
Float:velocity[3]
    
get_speed_vector(origin2originrandom_float(140.0160.0), velocity)
    
    new 
angle random_num(0360)
    
    
message_begin(MSG_ONE_UNRELIABLESVC_TEMPENTITY_id)
    
write_byte(TE_MODEL)
    
write_coord_f(origin[0])
    
write_coord_f(origin[1])
    
write_coord_f(origin[2])
    
write_coord_f(velocity[0])
    
write_coord_f(velocity[1])
    
write_coord_f(velocity[2])
    
write_angle(angle)
    
write_short(shells_model)
    
write_byte(1)
    
write_byte(get_pcvar_num(cvar_shellshealth_balrog7) * 10)
    
message_end()
    
    new 
Float:origin3[3]
    
origin3 origin
    
    xs_vec_mul_scalar
(v_forward3.9v_forward);
    
xs_vec_add(originv_forwardorigin);
    
    for(new 
i<= 32i++)
    {
        if(!
is_user_connected(i) || == id) continue;
        
        if(!
is_user_alive(i) && pev(ipev_iuser2) == id && pev(ipev_iuser1) == 4)
        {
            
message_begin(MSG_ONE_UNRELIABLESVC_TEMPENTITY_i)
            
write_byte(TE_MODEL)
            
write_coord_f(origin3[0])
            
write_coord_f(origin3[1])
            
write_coord_f(origin3[2])
            
write_coord_f(velocity[0])
            
write_coord_f(velocity[1])
            
write_coord_f(velocity[2])
            
write_angle(angle)
            
write_short(shells_model)
            
write_byte(1)
            
write_byte(get_pcvar_num(cvar_shellshealth_balrog7) * 10)
            
message_end()    
        }
        else
        {
            
message_begin(MSG_ONE_UNRELIABLESVC_TEMPENTITY_i)
            
write_byte(TE_MODEL)
            
write_coord_f(origin[0])
            
write_coord_f(origin[1])
            
write_coord_f(origin[2])
            
write_coord_f(velocity[0])
            
write_coord_f(velocity[1])
            
write_coord_f(velocity[2])
            
write_angle(angle)
            
write_short(shells_model)
            
write_byte(1)
            
write_byte(get_pcvar_num(cvar_shellshealth_balrog7) * 10)
            
message_end()    
        }
    }
}

stock get_speed_vector(const Float:origin1[3], const Float:origin2[3], Float:speedFloat:new_velocity[3])
{
    
new_velocity[0] = origin2[0] - origin1[0]
    
new_velocity[1] = origin2[1] - origin1[1]
    
new_velocity[2] = origin2[2] - origin1[2]
    new 
Float:num floatsqroot(speed speed / (new_velocity[0] * new_velocity[0] + new_velocity[1] * new_velocity[1] + new_velocity[2] * new_velocity[2]))
    
new_velocity[0] *= num
    new_velocity
[1] *= num
    new_velocity
[2] *= num
    
    
return 1;
}

stock ham_strip_weapon(idweapon[])
{
    if(!
equal(weapon"weapon_"7)) return 0;
    
    new 
wId get_weaponid(weapon);
    if(!
wId) return 0;
    
    new 
wEnt;
    while((
wEnt engfunc(EngFunc_FindEntityByStringwEnt"classname"weapon)) && pev(wEntpev_owner) != id) {}
    if(!
wEnt) return 0;
    
    if(
get_user_weapon(id) == wIdExecuteHamB(Ham_Weapon_RetireWeaponwEnt);
    
    if(!
ExecuteHamB(Ham_RemovePlayerItemidwEnt)) return 0;
    
ExecuteHamB(Ham_Item_KillwEnt);
    
    
set_pev(idpev_weaponspev(idpev_weapons) & ~(1<<wId));
    
    return 
1;
}

stock print_colored(const index, const input [ ], const any:...)     
{      
    new 
message[191]     
    
vformat(message190input3)     
    
replace_all(message190"!y""^1")     
    
replace_all(message190"!t""^3")     
    
replace_all(message190"!g""^4")     

    if(
index)     
    {     
        
//print to SINGLE PERSON     
        
message_begin(MSG_ONEg_iMsgSayTxt_index)     
        
write_byte(index)     
        
write_string(message)     
        
message_end()     
    }     
    else     
    {     
        
//print to all players     
        
new players[32], countiid     
        get_players
(playerscount"ch")     
        for( 
0count++ )     
        {     
            
id players[i]     
            if(!
is_user_connected(id)) continue;     

            
message_begin(MSG_ONE_UNRELIABLEg_iMsgSayTxt_id)     
            
write_byte(id)     
            
write_string(message)     
            
message_end()     
        }     
    }     

C.Ronaldo is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 12-26-2014 , 11:53   Re: Message for guns
Reply With Quote #6

because you do wrong.

change this:

PHP Code:
client_print(idprint_chat"!gZoD*| !tYou bought !yBalrog M249"
to this:

PHP Code:
print_colored(id"!gZoD*| !tYou bought !yBalrog M249"

Last edited by wicho; 12-26-2014 at 11:54.
wicho is offline
C.Ronaldo
Senior Member
Join Date: Dec 2014
Old 12-26-2014 , 12:17   Re: Message for guns
Reply With Quote #7

work thx
C.Ronaldo is offline
Reply



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 12:31.


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