Raised This Month: $51 Target: $400
 12% 

Solved SG552 Zoom isn't like AWP Zoom


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ZombieTheMan01
Senior Member
Join Date: Aug 2015
Location: Turkey
Old 06-16-2017 , 08:15   SG552 Zoom isn't like AWP Zoom
Reply With Quote #1

I've seen it somewhere before. The guys officially used SG552 Zoom as AWP ZOOM. And I decided to test it. I could not do it with any kind of effort. If you have friends who can do it with you, then I'm happy.
VIDEO(Tuned D3D)
SCREENSHOT(OpenGL):





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

new const GUNSHOT_DECALS[] = { 4142434445 }

new 
g_eventg_has[33], g_clip[33], oldweap[33]

new 
g_hasZoom2g_hasZoomFloat:g_flNextUseTime[33], smoke

public plugin_init()
{
    
register_plugin("[Weapon]: SG552 ZOOM for AWP ZOOM""0.1""unknown")    
    
register_event("CurWeapon","CurrentWeapon","be","1=1")
    
    
//register_forward(FM_SetModel, "SetModel")
    
register_forward(FM_UpdateClientData"UpdateClientData_Post"1)
    
register_forward(FM_PlaybackEvent"PlaybackEvent")

    
RegisterHam(Ham_TraceAttack"worldspawn""TraceAttack"1)
    
RegisterHam(Ham_Item_AddToPlayer"weapon_sg552""AddToPlayer")
    
RegisterHam(Ham_Item_PostFrame"weapon_sg552""ItemPostFrame")
    
    
RegisterHam(Ham_Weapon_Reload"weapon_sg552""Reload")
    
RegisterHam(Ham_Weapon_Reload"weapon_sg552""Reload_Post"1)    
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_sg552""PrimaryAttack")
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_sg552""PrimaryAttack_Post"1)
    
RegisterHam(Ham_Item_Holster"weapon_sg552""Holster_Post"1)
    
register_forward(FM_CmdStart"CmdStart")
    
RegisterHam(Ham_Weapon_SecondaryAttack"weapon_sg552""SecondaryAttack")

    
register_clcmd("say sg552""give_weapon")
}
public 
plugin_precache()
{    
    
smoke precache_model("sprites/sniper_scope.spr")
}

public 
SecondaryAttack(weapon)
{
   new 
id get_pdata_cbase(weapon414)
   
   if(
g_has[id])
      return 
HAM_SUPERCEDE

   
return HAM_IGNORED
}

public 
TraceAttack(iEntiAttackerFloat:flDamageFloat:fDir[3], ptriDamageType)
{
    if(!
is_user_alive(iAttacker))
        return

    new 
g_currentweapon get_user_weapon(iAttacker)

    if(
g_currentweapon != CSW_SG552) return
    
    if(!
g_has[iAttacker]) return

    static 
Float:flEnd[3]
    
get_tr2(ptrTR_vecEndPosflEnd)
    
    if(
iEnt)
    {
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_DECAL)
        
engfunc(EngFunc_WriteCoord,flEnd[0])
        
engfunc(EngFunc_WriteCoord,flEnd[1])
        
engfunc(EngFunc_WriteCoord,flEnd[2])
        
write_byte(GUNSHOT_DECALS[random_num (0sizeof GUNSHOT_DECALS -1)])
        
write_short(iEnt)
        
message_end()
    }
    else
    {
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_WORLDDECAL)
        
engfunc(EngFunc_WriteCoord,flEnd[0])
        
engfunc(EngFunc_WriteCoord,flEnd[1])
        
engfunc(EngFunc_WriteCoord,flEnd[2])
        
write_byte(GUNSHOT_DECALS[random_num (0sizeof GUNSHOT_DECALS -1)])
        
message_end()
    }
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_GUNSHOTDECAL)
    
engfunc(EngFunc_WriteCoord,flEnd[0])
    
engfunc(EngFunc_WriteCoord,flEnd[1])
    
engfunc(EngFunc_WriteCoord,flEnd[2])    
    
write_short(iAttacker)
    
write_byte(GUNSHOT_DECALS[random_num (0sizeof GUNSHOT_DECALS -1)])
    
message_end()
}

//public PrecacheEvent_Post(type, const name[]) if(equal("events/sg552.sc", name)) g_event = get_orig_retval()

public client_disconnect(idg_has[id] = false

/*public SetModel(ent, model[])
{
    if(!is_valid_ent(ent))
        return FMRES_IGNORED
    
    static szClassName[33]
    entity_get_string(ent, EV_SZ_classname, szClassName, charsmax(szClassName))
        
    if(!equal(szClassName, "weaponbox"))
        return FMRES_IGNORED
        
    if(equal(model, "models/w_sg552.mdl"))
    {
    
        if(!is_valid_ent(find_ent_by_owner(-1, "weapon_sg552", ent)))
            return FMRES_IGNORED
    
        if(g_has[entity_get_edict(ent, EV_ENT_owner)])
        {
            entity_set_int(find_ent_by_owner(-1, "weapon_sg552", ent), EV_INT_impulse, 45488)
            
            g_has[entity_get_edict(ent, EV_ENT_owner)] = false
            
            entity_set_model(ent, "models/w_sg552.mdl")
            
            return FMRES_SUPERCEDE
        }
    }
    return FMRES_IGNORED
}*/

public give_weapon(id)
{
    new 
iWep2 give_item(id,"weapon_sg552")
    if( 
iWep2 )
    {
        
cs_set_weapon_ammo(iWep250)
        
cs_set_user_bpammo (idCSW_SG552250)    
        
set_anim(id2)
        
set_pdata_float(id831.05)
    }
    
g_has[id] = true
}

public 
AddToPlayer(wpnid)
{
    if(!
is_valid_ent(wpn) || !is_user_connected(id))
        return 
HAM_IGNORED
    
    
if(entity_get_int(wpnEV_INT_impulse) == 45488)
    {
        
g_has[id] = true
        
        entity_set_int
(wpnEV_INT_impulse0)
    }
    return 
HAM_IGNORED
}

public 
CurrentWeapon(id)
{
    
replace_weapon_models(idread_data(2))
    if(
read_data(2) != CSW_SG552 || !g_has[id]) return

    if(
g_hasZoom == || g_hasZoom2 == 2)
    {
        
set_pev(idpev_viewmodel2"")

    }
    else 
set_pev(idpev_viewmodel2"models/v_sg552.mdl")

}

replace_weapon_models(idwpnid)
{
    switch (
wpnid)
    {
        case 
CSW_SG552:
        {            
            if(
g_has[id])
            {
                
set_pev(idpev_viewmodel2"models/v_sg552.mdl")
                
set_pev(idpev_weaponmodel2"models/p_sg552.mdl")
                if(
oldweap[id] != CSW_SG552
                {
                    
set_anim(id2)
                    
set_pdata_float(id831.05)
                }
            }
        }
    }
    
oldweap[id] = wpnid
}

public 
UpdateClientData_Post(PlayerSendWeaponsCD_Handle)
{
    if(!
is_user_alive(Player) || (get_user_weapon(Player) != CSW_SG552 || !g_has[Player]))
        return 
FMRES_IGNORED
    
    set_cd
(CD_HandleCD_flNextAttackhalflife_time () + 0.001)
    return 
FMRES_HANDLED
}

public 
client_PostThink(id)
{
    if(!
is_user_alive(id) || !g_has[id] || get_user_weapon(id) != CSW_SG552)
        return

    if(
g_hasZoom2 && g_hasZoom)    
    {
        static 
Float:Origin[3]; get_position(id3.0, -4.0, -7.0Origin)
    
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY
        
write_byte(TE_EXPLOSION
        
engfunc(EngFunc_WriteCoordOrigin[0])
        
engfunc(EngFunc_WriteCoordOrigin[1])
        
engfunc(EngFunc_WriteCoordOrigin[2])
        
write_short(smoke)
        
write_byte(5)
        
write_byte(1)
        
write_byte(14)
        
message_end()
    }
}

public 
PrimaryAttack(wpn)
{
    new 
id get_pdata_cbase(wpn414)
    if (!
g_has[id]) return
}

public 
PlaybackEvent(flagsinvokereventidFloat:delayFloat:origin[3], Float:angles[3], Float:fparam1Float:fparam2iParam1iParam2bParam1bParam2)
{
    if ((
eventid != g_event))
        return 
FMRES_IGNORED
    
if (!(<= invoker <= get_maxplayers()))
    return 
FMRES_IGNORED

    playback_event
(flags FEV_HOSTONLYinvokereventiddelayoriginanglesfparam1fparam2iParam1iParam2bParam1bParam2)
    return 
FMRES_SUPERCEDE
}

public 
PrimaryAttack_Post(wpn)
{
    new 
id get_pdata_cbase(wpn414)
    
    if(!
is_user_alive(id) || !g_has[id])
        return
    
    
emit_sound(idCHAN_WEAPON"weapons/sg552-1.wav"VOL_NORMATTN_NORM0PITCH_NORM)
    
emit_sound(idCHAN_WEAPON"weapons/sg552-2.wav"VOL_NORMATTN_NORM0PITCH_NORM)
    
set_anim(idrandom_num(3,5))
}

stock set_anim(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()
}

public 
ItemPostFrame(wpn
{
    new 
id pev(wpnpev_owner)
    if (!
is_user_connected(id)) return HAM_IGNORED

    
if (!g_has[id])return HAM_IGNORED

    
static iClipExtra
     
    iClipExtra 
50
    
new Float:flNextAttack get_pdata_float(id835)

    new 
iBpAmmo cs_get_user_bpammo(idCSW_SG552)
    new 
iClip get_pdata_int(wpn514)

    new 
fInReload get_pdata_int(wpn544

    if( 
fInReload && flNextAttack <= 0.0 )
    {
        new 
min(iClipExtra iClipiBpAmmo)
    
        
set_pdata_int(wpn51iClip j4)
        
cs_set_user_bpammo(idCSW_SG552iBpAmmo-j)
        
        
set_pdata_int(wpn5404)
        
fInReload 0
    
}
    return 
HAM_IGNORED
}

public 
Reload(wpn
{
    new 
id pev(wpnpev_owner)
    if(!
is_user_connected(id)) return HAM_IGNORED

    
if(!g_has[id]) return HAM_IGNORED

    
static iClipExtra

    
//if(g_has[id])
    
iClipExtra 50

    g_clip
[id] = -1

    
new iBpAmmo cs_get_user_bpammo(idCSW_SG552)
    new 
iClip get_pdata_int(wpn514)

    if (
iBpAmmo <= 0)
        return 
HAM_SUPERCEDE

    
if (iClip >= iClipExtra)
        return 
HAM_SUPERCEDE

    g_clip
[id] = iClip

    
return HAM_IGNORED
}

public 
Reload_Post(wpn
{
    new 
id pev(wpnpev_owner)
    if (!
is_user_connected(id))
        return 
HAM_IGNORED

    
if (!g_has[id])
        return 
HAM_IGNORED

    
if (g_clip[id] == -1)
        return 
HAM_IGNORED

    set_pdata_int
(wpn51g_clip[id], 4)

    
set_pdata_int(wpn5414)
    
    
g_hasZoom 0
    g_hasZoom2 
0
    set_anim
(id1)

    return 
HAM_IGNORED
}

public 
Holster_Post(weapon_entity)
{
    static 
Player
    Player 
get_pdata_cbase(weapon_entity414)
    
    
g_flNextUseTime[Player] = 0.0

    
if(g_has[Player])
    {
        
g_hasZoom false
        g_hasZoom2 
false
        cs_set_user_zoom
(PlayerCS_RESET_ZOOM1)
    }
}

public 
CmdStart(iduc_handleseed)
{
    if (!
is_user_alive(id) || !g_has[id])
        return 
FMRES_IGNORED
    
    
if((get_uc(uc_handleUC_Buttons) & IN_ATTACK2) && !(pev(idpev_oldbuttons) & IN_ATTACK2))
    {
        new 
szClipszAmmo
        
new szWeapID get_user_weapon(idszClipszAmmo)

        if(
szWeapID == CSW_SG552 && g_has[id] && !g_hasZoom == true)
        {
            
g_hasZoom 1
            cs_set_user_zoom
(idCS_SET_FIRST_ZOOM1)
            
emit_sound(idCHAN_ITEM"weapons/zoom.wav"0.202.400100)
        }
        else if(
szWeapID == CSW_SG552 && g_has[id] && !g_hasZoom2 == true)
        {
            
g_hasZoom2 true
            cs_set_user_zoom
(idCS_SET_SECOND_ZOOM2)
            
emit_sound(idCHAN_ITEM"weapons/zoom.wav"0.202.400100)
        }
        else if(
szWeapID == CSW_SG552 && g_has[id] && g_hasZoom)
        {
            
g_hasZoom false
            g_hasZoom2 
0
            cs_set_user_zoom
(idCS_RESET_ZOOM0)    
        }
    }
    return 
FMRES_IGNORED
}

stock get_position(entFloat:forwFloat:rightFloat:upFloat:vStart[])
{
    static 
Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
    
    
pev(entpev_originvOrigin)
    
pev(entpev_view_ofs,vUp//for player
    
xs_vec_add(vOrigin,vUp,vOrigin)
    
pev(entpev_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

__________________
FREE PLUGINS:

2021 and before -> ALL PLUGIN LINK IS HERE <-

2022:
Zombie: The Original [%70 Completed]

Last edited by ZombieTheMan01; 07-15-2020 at 10:10.
ZombieTheMan01 is offline
ZombieTheMan01
Senior Member
Join Date: Aug 2015
Location: Turkey
Old 06-16-2017 , 12:10   Re: SG552 Zoom isn't like AWP Zoom
Reply With Quote #2

Will you help me?
__________________
FREE PLUGINS:

2021 and before -> ALL PLUGIN LINK IS HERE <-

2022:
Zombie: The Original [%70 Completed]
ZombieTheMan01 is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 06-16-2017 , 12:13   Re: SG552 Zoom isn't like AWP Zoom
Reply With Quote #3

Use this for zoom, note that only weapons that already have secondary attack will be called:

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>

#define is_str_empty(%1)    ( %1[0] == EOS )

new cvar;

public 
plugin_init( )
{
    
register_plugin"Zoom for all weapons""1.0""Craxor" );

    new 
szWeaponName[20];

    for( new 
i=131i++ )
    {
        
get_weaponnameiszWeaponNamecharsmax(szWeaponName) )

        if( !
is_str_empty(szWeaponName) )
        {
            
RegisterHam(Ham_Weapon_SecondaryAttackszWeaponName"ham_SecondaryAttackZoom"true)
        }
    }

    
/*
        2 - First awp zoom
        3 - Second awp zoom
        4 - AUG/SG552 zoom style.
    */
    
cvar register_cvar"amx_zoom_type""2" );
}


public 
ham_SecondaryAttackZooment )
{
    if( 
pev_valident ) )
    {
        new 
id peventpev_owner );
        new 
pCvar get_pcvar_num(cvar);

        if( 
is_user_aliveid ) )
        {
            
cs_set_user_zoomidcs_get_user_zoom(id) == pCvar pCvar);
        }
    }

__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
ZombieTheMan01
Senior Member
Join Date: Aug 2015
Location: Turkey
Old 06-16-2017 , 12:27   Re: SG552 Zoom isn't like AWP Zoom
Reply With Quote #4

Quote:
Originally Posted by Craxor View Post
Use this for zoom, note that only weapons that already have secondary attack will be called:

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>

#define is_str_empty(%1)    ( %1[0] == EOS )

new cvar;

public 
plugin_init( )
{
    
register_plugin"Zoom for all weapons""1.0""Craxor" );

    new 
szWeaponName[20];

    for( new 
i=131i++ )
    {
        
get_weaponnameiszWeaponNamecharsmax(szWeaponName) )

        if( !
is_str_empty(szWeaponName) )
        {
            
RegisterHam(Ham_Weapon_SecondaryAttackszWeaponName"ham_SecondaryAttackZoom"true)
        }
    }

    
/*
        2 - First awp zoom
        3 - Second awp zoom
        4 - AUG/SG552 zoom style.
    */
    
cvar register_cvar"amx_zoom_type""2" );
}


public 
ham_SecondaryAttackZooment )
{
    if( 
pev_valident ) )
    {
        new 
id peventpev_owner );
        new 
pCvar get_pcvar_num(cvar);

        if( 
is_user_aliveid ) )
        {
            
cs_set_user_zoomidcs_get_user_zoom(id) == pCvar pCvar);
        }
    }

I could not tell you exactly, I guess. That's exactly the gun's fault. There is scope in "AWP zoom". But the SG552 does not show the scope in the "AWP Zoom" style. I want to have scope in SG552.
EXAMPLE VIDEO (SG552 Lycanthrope/No Custom Weapon HUD)
__________________
FREE PLUGINS:

2021 and before -> ALL PLUGIN LINK IS HERE <-

2022:
Zombie: The Original [%70 Completed]

Last edited by ZombieTheMan01; 06-16-2017 at 12:29. Reason: Added link
ZombieTheMan01 is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 06-16-2017 , 12:31   Re: SG552 Zoom isn't like AWP Zoom
Reply With Quote #5

I've just tested and it is exactly the same(means is working fine for me). Do you have non-steam ?
__________________
Project: Among Us

Last edited by Craxor; 06-16-2017 at 12:32.
Craxor is offline
Send a message via ICQ to Craxor
ZombieTheMan01
Senior Member
Join Date: Aug 2015
Location: Turkey
Old 06-16-2017 , 12:41   Re: SG552 Zoom isn't like AWP Zoom
Reply With Quote #6

Quote:
Originally Posted by Craxor View Post
I've just tested and it is exactly the same(means is working fine for me). Do you have non-steam ?
Yeah. I have non-steam.
__________________
FREE PLUGINS:

2021 and before -> ALL PLUGIN LINK IS HERE <-

2022:
Zombie: The Original [%70 Completed]
ZombieTheMan01 is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 06-17-2017 , 01:18   Re: SG552 Zoom isn't like AWP Zoom
Reply With Quote #7

Then problem solved.
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 06-17-2017 , 03:18   Re: SG552 Zoom isn't like AWP Zoom
Reply With Quote #8

You need to modify your weapon_sg552.txt in sprites folder or to create the new one and use it via WeaponList usermsg.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
ZombieTheMan01
Senior Member
Join Date: Aug 2015
Location: Turkey
Old 06-17-2017 , 04:46   Re: SG552 Zoom isn't like AWP Zoom
Reply With Quote #9

Quote:
Originally Posted by Craxor View Post
Then problem solved.
How the problem is solved? Can you tell me?
__________________
FREE PLUGINS:

2021 and before -> ALL PLUGIN LINK IS HERE <-

2022:
Zombie: The Original [%70 Completed]
ZombieTheMan01 is offline
ZombieTheMan01
Senior Member
Join Date: Aug 2015
Location: Turkey
Old 06-17-2017 , 05:20   Re: SG552 Zoom isn't like AWP Zoom
Reply With Quote #10

Quote:
Originally Posted by PRoSToTeM@ View Post
You need to modify your weapon_sg552.txt in sprites folder or to create the new one and use it via WeaponList usermsg.
Thanks for the idea, but I have encode a weapon as the main code on the SG552. It seems to have scope. That's why I need it as a code. And "Weapon List" I do not want to use usermsg. Because all sorts of troubles happening. Probably they wrote it as code on the video.
__________________
FREE PLUGINS:

2021 and before -> ALL PLUGIN LINK IS HERE <-

2022:
Zombie: The Original [%70 Completed]

Last edited by ZombieTheMan01; 06-17-2017 at 05:22. Reason: Added sentence
ZombieTheMan01 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 08:01.


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