Raised This Month: $90 Target: $400
 22% 

Crosshair thunderbolt issue


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Apb hq
Senior Member
Join Date: Apr 2014
Old 03-14-2019 , 09:53   Crosshair thunderbolt issue
Reply With Quote #1

Hi everyone i need a little help with this plugin in fact when you use the thunderbolt and you scope you dont have a crosshair the zoom is like when you use crosshair 0 and when you aim on the enemy a + via hudmessage appears , i want to disable all those features and get the default scope
Here is the code thanks in advance
PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <cstrike>
#include <fun>

#define PLUGIN "[CSO] Thunderbolt"
#define VERSION "3.0"
#define AUTHOR "Dias"

#define DAMAGE 600
#define DEFAULT_AMMO 20
#define RELOAD_TIME 2.67

#define DELAY_SOUND 0.25

#define CSW_THUNDERBOLT CSW_AWP
#define weapon_thunderbolt "weapon_awp"
#define old_event "events/awp.sc"
#define old_w_model "models/w_awp.mdl"
#define WEAPON_SECRETCODE 4234234

#define V_MODEL "models/v_sfsniper2.mdl"
#define P_MODEL "models/p_sfsniper.mdl"
#define W_MODEL "models/w_sfsniper.mdl"

new const WeaponSounds[5][] = 
{
    
"weapons/sfsniper-1.wav",
    
"weapons/sfsniper_insight1.wav",
    
"weapons/sfsniper_zoom.wav",
    
"weapons/sfsniper_idle.wav",
    
"weapons/sfsniper_draw.wav"
}

new const 
WeaponResources[4][] = 
{
    
"sprites/weapon_sfsniper.txt",
    
"sprites/640hud2_2.spr",
    
"sprites/640hud10_2.spr",
    
"sprites/640hud81_2.spr"
}

enum
{
    
TB_ANIM_IDLE 0,
    
TB_ANIM_SHOOT,
    
TB_ANIM_DRAW
}

// MACROS
#define Get_BitVar(%1,%2) (%1 & (1 << (%2 & 31)))
#define Set_BitVar(%1,%2) %1 |= (1 << (%2 & 31))
#define UnSet_BitVar(%1,%2) %1 &= ~(1 << (%2 & 31))

new g_Had_Thunderboltg_Zoomedg_Aim_HudId
new Float:g_TargetOrigin[3], Float:CheckDelay[33]
new 
g_Msg_CurWeapong_Msg_AmmoX
new g_Beam_SprIdg_Smoke_SprIdg_HamBot_Registerg_Event_Thunderbolt

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("CurWeapon""Event_CurWeapon""be""1=1")
    
    
register_forward(FM_UpdateClientData"fw_UpdateClientData_Post"1)    
    
register_forward(FM_PlaybackEvent"fw_PlaybackEvent")        
    
register_forward(FM_SetModel"fw_SetModel")
    
register_forward(FM_CmdStart"fw_CmdStart")
    
    
RegisterHam(Ham_TraceAttack"player""fw_TraceAttack_Player")
    
RegisterHam(Ham_TraceAttack"worldspawn""fw_TraceAttack_World")
    
    
RegisterHam(Ham_Item_AddToPlayerweapon_thunderbolt"fw_AddToPlayer_Post"1)
    
RegisterHam(Ham_Item_Deployweapon_thunderbolt"fw_Item_Deploy_Post"1)
    
    
g_Msg_CurWeapon get_user_msgid("CurWeapon")
    
g_Msg_AmmoX get_user_msgid("AmmoX")
    
    
g_Aim_HudId CreateHudSyncObj(8)
    
    
register_clcmd("admin_get_thunderbolt""get_thunderbolt"ADMIN_BAN)
    
register_clcmd("weapon_sfsniper""CLCMD_HookWeapon")
}

public 
plugin_precache()
{
    
precache_model(V_MODEL)
    
precache_model(P_MODEL)
    
precache_model(W_MODEL)
    
    for(new 
0sizeof(WeaponSounds); i++) 
        
engfunc(EngFunc_PrecacheSoundWeaponSounds[i])
    for(new 
0sizeof(WeaponResources); i++)
    {
        if(
== 0engfunc(EngFunc_PrecacheGenericWeaponResources[0])
        else 
engfunc(EngFunc_PrecacheModelWeaponResources[i])
    }
    
    
g_Beam_SprId =  engfunc(EngFunc_PrecacheModel"sprites/laserbeam.spr")
    
g_Smoke_SprId engfunc(EngFunc_PrecacheModel"sprites/wall_puff1.spr")
    
    
register_forward(FM_PrecacheEvent"fw_PrecacheEvent_Post"1)    
}

public 
client_putinserver(id)
{
    if(
is_user_bot(id) && !g_HamBot_Register)
    {
        
g_HamBot_Register 1
        set_task
(0.1"Do_RegisterHamBot"id)
    }
}

public 
Do_RegisterHamBot(id)
{
    
RegisterHamFromEntity(Ham_TraceAttackid"fw_TraceAttack_Player")
}

public 
fw_PrecacheEvent_Post(type, const name[])
{
    if(
equal(old_eventname)) g_Event_Thunderbolt get_orig_retval()
}

public 
get_thunderbolt(id)
{
    if(!
is_user_alive(id))
        return
        
    
Set_BitVar(g_Had_Thunderboltid)
    
UnSet_BitVar(g_Zoomedid)
    
    
fm_give_item(idweapon_thunderbolt)
    
    static 
weapon_entweapon_ent fm_find_ent_by_owner(-1weapon_thunderboltid)
    if(
pev_valid(weapon_ent)) cs_set_weapon_ammo(weapon_ent1)
    
    
cs_set_user_bpammo(idCSW_THUNDERBOLTDEFAULT_AMMO)
}

public 
Event_CurWeapon(id)
{
    static 
CSWIDCSWID read_data(2)
    if(
CSWID != CSW_THUNDERBOLT || !Get_BitVar(g_Had_Thunderboltid))
        return
        
    if(
cs_get_user_zoom(id) > && !Get_BitVar(g_Zoomedid)) // Zoom
    
{
        
set_pev(idpev_viewmodel2"")
        
Set_BitVar(g_Zoomedid)
    } else { 
// Not Zoom
        
set_pev(idpev_viewmodel2V_MODEL)
        
UnSet_BitVar(g_Zoomedid)
    }
    
    
UpdateAmmo(id, -1cs_get_user_bpammo(idCSW_THUNDERBOLT))
}

public 
CLCMD_HookWeapon(id)
{
    
engclient_cmd(idweapon_thunderbolt)
    return
}

public 
fw_UpdateClientData_Post(idsendweaponscd_handle)
{
    if(!
is_user_alive(id))
        return 
FMRES_IGNORED    
    
if(get_user_weapon(id) == CSW_THUNDERBOLT && Get_BitVar(g_Had_Thunderboltid))
        
set_cd(cd_handleCD_flNextAttackget_gametime() + 0.001
    
    return 
FMRES_HANDLED
}

public 
fw_PlaybackEvent(flagsinvokereventidFloat:delayFloat:origin[3], Float:angles[3], Float:fparam1Float:fparam2iParam1iParam2bParam1bParam2)
{
    if(
eventid != g_Event_Thunderbolt)
        return 
FMRES_IGNORED
    
if (!is_user_alive(invoker))
        return 
FMRES_IGNORED        
    
if(get_user_weapon(invoker) != CSW_THUNDERBOLT || !Get_BitVar(g_Had_Thunderboltinvoker))
        return 
FMRES_IGNORED
    
    engfunc
(EngFunc_PlaybackEventflags FEV_HOSTONLYinvokereventiddelayoriginanglesfparam1fparam2iParam1iParam2bParam1bParam2)
    
Thunderbolt_Shooting(invoker)

    return 
FMRES_SUPERCEDE
}

public 
fw_SetModel(entitymodel[])
{
    if(!
pev_valid(entity))
        return 
FMRES_IGNORED
    
    
static Classname[64]
    
pev(entitypev_classnameClassnamesizeof(Classname))
    
    if(!
equal(Classname"weaponbox"))
        return 
FMRES_IGNORED
    
    
static id
    id 
pev(entitypev_owner)
    
    if(
equal(modelold_w_model))
    {
        static 
weapon
        weapon 
fm_get_user_weapon_entity(entityCSW_THUNDERBOLT)
        
        if(!
pev_valid(weapon))
            return 
FMRES_IGNORED
        
        
if(Get_BitVar(g_Had_Thunderboltid))
        {
            
UnSet_BitVar(g_Had_Thunderboltid)
            
            
set_pev(weaponpev_impulseWEAPON_SECRETCODE)
            
set_pev(weaponpev_iuser4cs_get_user_bpammo(idCSW_THUNDERBOLT))
            
            
engfunc(EngFunc_SetModelentityW_MODEL)
            
            return 
FMRES_SUPERCEDE
        
}
    }

    return 
FMRES_IGNORED;
}

public 
fw_CmdStart(idUcHandleSeed)
{
    if(!
is_user_alive(id))
        return
    if(
get_user_weapon(id) != CSW_THUNDERBOLT || !Get_BitVar(g_Had_Thunderboltid))
        return
    if(
cs_get_user_zoom(id) <= 1)
        return
    
    if(
get_gametime() - DELAY_SOUND CheckDelay[id])
    {
        static 
BodyTarget
        get_user_aiming
(idTargetBody99999)
        
        if(
is_user_alive(Target))
        {
            
emit_sound(idCHAN_WEAPONWeaponSounds[1], VOL_NORMATTN_NORM0PITCH_NORM)
            
            
set_hudmessage(25000, -1.0, -1.000.10.1)
            
ShowSyncHudMsg(idg_Aim_HudId"+")
        }
        
        
CheckDelay[id] = get_gametime()
    }
}

public 
Thunderbolt_Shooting(id)
{
    
set_weapon_anim(idTB_ANIM_SHOOT)
    
emit_sound(idCHAN_WEAPONWeaponSounds[0], VOL_NORMATTN_NORM0PITCH_NORM)
    
    static 
AmmoAmmo cs_get_user_bpammo(idCSW_THUNDERBOLT)
    
    
Ammo--
    
UpdateAmmo(id, -1Ammo)
    
    if(
Ammo <= 0)
    {
        static 
EntEnt fm_get_user_weapon_entity(idCSW_THUNDERBOLT)
        if(
pev_valid(Ent)) cs_set_weapon_ammo(Ent0)
        
        
cs_set_user_bpammo(idCSW_THUNDERBOLT0)
    }

    
Create_Laser(idg_TargetOrigin)
    
    
// Fixed Shell Eject
    
set_pdata_float(id11199999999.05)

    
// Next Attack
    
Set_Player_NextAttack(idCSW_THUNDERBOLTRELOAD_TIME)
}

public 
Create_Laser(idFloat:End[3])
{
    static 
Float:Start[3]
    
Stock_Get_Postion(id50.05.0, -5.0Start)
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_BEAMPOINTS)
    
engfunc(EngFunc_WriteCoordStart[0])
    
engfunc(EngFunc_WriteCoordStart[1])
    
engfunc(EngFunc_WriteCoordStart[2])
    
engfunc(EngFunc_WriteCoordEnd[0])
    
engfunc(EngFunc_WriteCoordEnd[1])
    
engfunc(EngFunc_WriteCoordEnd[2])
    
write_short(g_Beam_SprId)
    
write_byte(0)
    
write_byte(0)
    
write_byte(10)
    
write_byte(25)
    
write_byte(0)
    
write_byte(0)
    
write_byte(0)
    
write_byte(200)
    
write_byte(200)
    
write_byte(0)
    
message_end()    
}

public 
fw_AddToPlayer_Post(entid)
{
    if(
pev(entpev_impulse) == WEAPON_SECRETCODE)
    {
        
Set_BitVar(g_Had_Thunderboltid)
        
cs_set_user_bpammo(idCSW_THUNDERBOLTpev(entpev_iuser4))
        
        
set_pev(entpev_impulse0)
    }            
    
    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("WeaponList"), _id)
    
write_string((Get_BitVar(g_Had_Thunderboltid) ? "weapon_sfsniper" "weapon_awp"))
    
write_byte(1)
    
write_byte(30)
    
write_byte(-1)
    
write_byte(-1)
    
write_byte(0)
    
write_byte(2)
    
write_byte(CSW_THUNDERBOLT)
    
write_byte(0)
    
message_end()
}

public 
fw_TraceAttack_Player(entattackerFloat:DamageFloat:fDir[3], ptriDamageType)
{
    if(!
is_user_alive(attacker))
        return 
HAM_IGNORED    
    
if(get_user_weapon(attacker) != CSW_THUNDERBOLT || !Get_BitVar(g_Had_Thunderboltattacker))
        return 
HAM_IGNORED

    get_tr2
(ptrTR_vecEndPosg_TargetOrigin)
    
SetHamParamFloat(3float(DAMAGE))
    
    return 
HAM_HANDLED
}

public 
fw_TraceAttack_World(entattackerFloat:DamageFloat:fDir[3], ptriDamageType)
{
    if(!
is_user_alive(attacker))
        return 
HAM_IGNORED    
    
if(get_user_weapon(attacker) != CSW_THUNDERBOLT || !Get_BitVar(g_Had_Thunderboltattacker))
        return 
HAM_IGNORED

    get_tr2
(ptrTR_vecEndPosg_TargetOrigin)
    
Make_WorldHitEffect(attackerptr)
    
    
SetHamParamFloat(3float(DAMAGE))

    return 
HAM_HANDLED
}

public 
fw_Item_Deploy_Post(Ent)
{
    if(!
pev_valid(Ent))
        return
        
    static 
IdId get_pdata_cbase(Ent414)
    if(!
Get_BitVar(g_Had_ThunderboltId))
        return
        
    
UnSet_BitVar(g_ZoomedId)
        
    
set_pev(Idpev_viewmodel2V_MODEL)
    
set_pev(Idpev_weaponmodel2P_MODEL)    
        
    
set_weapon_anim(IdTB_ANIM_DRAW)
}

public 
UpdateAmmo(IdAmmoBpAmmo)
{
    static 
weapon_entweapon_ent fm_get_user_weapon_entity(IdCSW_THUNDERBOLT)
    if(
pev_valid(weapon_ent))
    {
        if(
BpAmmo 0cs_set_weapon_ammo(weapon_ent1)
        else 
cs_set_weapon_ammo(weapon_ent0)
    }
    
    
engfunc(EngFunc_MessageBeginMSG_ONE_UNRELIABLEg_Msg_CurWeapon, {000}, Id)
    
write_byte(1)
    
write_byte(CSW_THUNDERBOLT)
    
write_byte(-1)
    
message_end()
    
    
message_begin(MSG_ONE_UNRELIABLEg_Msg_AmmoX_Id)
    
write_byte(1)
    
write_byte(BpAmmo)
    
message_end()
    
    
cs_set_user_bpammo(IdCSW_THUNDERBOLTBpAmmo)
}

public 
Make_WorldHitEffect(idTrResult)
{
    
// Handle First
    
static Float:vecSrc[3], Float:vecEnd[3], TE_FLAG
    
    get_weapon_attachment
(idvecSrc)
    
global_get(glb_v_forwardvecEnd)
    
    
xs_vec_mul_scalar(vecEnd8192.0vecEnd)
    
xs_vec_add(vecSrcvecEndvecEnd)

    
get_tr2(TrResultTR_vecEndPosvecSrc)
    
get_tr2(TrResultTR_vecPlaneNormalvecEnd)
    
    
xs_vec_mul_scalar(vecEnd2.5vecEnd)
    
xs_vec_add(vecSrcvecEndvecEnd)
    
    
TE_FLAG |= TE_EXPLFLAG_NODLIGHTS
    TE_FLAG 
|= TE_EXPLFLAG_NOSOUND
    TE_FLAG 
|= TE_EXPLFLAG_NOPARTICLES
    
    
// Make Spark
    
for(new 03i++)
    {
        
engfunc(EngFunc_MessageBeginMSG_PASSVC_TEMPENTITYvecEnd0)
        
write_byte(TE_SPARKS)
        
engfunc(EngFunc_WriteCoordvecEnd[0])
        
engfunc(EngFunc_WriteCoordvecEnd[1])
        
engfunc(EngFunc_WriteCoordvecEnd[2] - 10.0)
        
message_end()
    }
    
    
// Make Smoke
    
engfunc(EngFunc_MessageBeginMSG_PASSVC_TEMPENTITYvecEnd0)
    
write_byte(TE_EXPLOSION)
    
engfunc(EngFunc_WriteCoordvecEnd[0])
    
engfunc(EngFunc_WriteCoordvecEnd[1])
    
engfunc(EngFunc_WriteCoordvecEnd[2] - 10.0)
    
write_short(g_Smoke_SprId)
    
write_byte(2)
    
write_byte(50)
    
write_byte(TE_FLAG)
    
message_end()    
}

stock set_weapon_anim(idanim)
{
    
set_pev(idpev_weaponanimanim)
    
    
message_begin(MSG_ONE_UNRELIABLESVC_WEAPONANIM, {000}, id)
    
write_byte(anim)
    
write_byte(pev(idpev_body))
    
message_end()
}

stock Stock_Get_Postion(id,Float:forw,Float:rightFloat:up,Float:vStart[])
{
    static 
Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
    
    
pev(idpev_originvOrigin)
    
pev(idpev_view_ofs,vUp//for player
    
xs_vec_add(vOrigin,vUp,vOrigin)
    
pev(idpev_v_anglevAngle// if normal entity ,use pev_angles
    
    
angle_vector(vAngle,ANGLEVECTOR_FORWARD,vForward//or use EngFunc_AngleVectors
    
angle_vector(vAngle,ANGLEVECTOR_RIGHT,vRight)
    
angle_vector(vAngle,ANGLEVECTOR_UP,vUp)
    
    
vStart[0] = vOrigin[0] + vForward[0] * forw vRight[0] * right vUp[0] * up
    vStart
[1] = vOrigin[1] + vForward[1] * forw vRight[1] * right vUp[1] * up
    vStart
[2] = vOrigin[2] + vForward[2] * forw vRight[2] * right vUp[2] * up


stock get_weapon_attachment(idFloat:output[3], Float:fDis 40.0)

    static 
Float:vfEnd[3], viEnd[3
    
get_user_origin(idviEnd3)  
    
IVecFVec(viEndvfEnd
    
    static 
Float:fOrigin[3], Float:fAngle[3]
    
    
pev(idpev_originfOrigin
    
pev(idpev_view_ofsfAngle)
    
    
xs_vec_add(fOriginfAnglefOrigin
    
    static 
Float:fAttack[3]
    
    
xs_vec_sub(vfEndfOriginfAttack)
    
xs_vec_sub(vfEndfOriginfAttack
    
    static 
Float:fRate
    
    fRate 
fDis vector_length(fAttack)
    
xs_vec_mul_scalar(fAttackfRatefAttack)
    
    
xs_vec_add(fOriginfAttackoutput)
}

stock Set_Player_NextAttack(idCSWIDFloat:NextTime)
{
    static 
EntEnt fm_get_user_weapon_entity(idCSWID)
    if(!
pev_valid(Ent)) return
    
    
set_pdata_float(id83NextTime5)
    
    
set_pdata_float(Ent46 NextTime4)
    
set_pdata_float(Ent47NextTime4)
    
set_pdata_float(Ent48NextTime4)

Apb hq is offline
Reply


Thread Tools
Display Modes

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 16:18.


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