Raised This Month: $ Target: $400
 0% 

Zoom


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AwesomeMan
Member
Join Date: Jun 2013
Old 07-25-2013 , 06:57   Zoom
Reply With Quote #1

Hello, I want a player to unzoom when they change a weapon. As I made ak47 zoomable, works great but when player changes weapon it doesnt unzoom, it keeps the zoom. Heres the code i tried for unzooming while weapon change;

Code:
public event_curweapon(id)
{
	new gun = read_data(2)
	
	if((gun != CSW_AK47 && g_hasZoom[id])) {
		g_hasZoom[ id ] = false
		cs_set_user_zoom(id,CS_RESET_ZOOM,0)
	}
}
also, it does set g_hasZoom[id] to false but it doesnt unzoom.

In plugin_init
register_event("CurWeapon", "event_curweapon", "be", "1=1")
and this to set zoom on ATTACK2:
cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 0 )
AwesomeMan is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 07-25-2013 , 10:54   Re: Zoom
Reply With Quote #2

PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#tryinclude < cstrike_pdatas > 

#if !defined _cbaseentity_included 
        #assert Cstrike Pdatas and Offsets library required! Read the below instructions:   \ 
                
1. Download it at forums.alliedmods.net/showpost.php?p=1712101#post1712101   \ 
                
2. Put it into amxmodx/scripting/include/ folder   
                
3. Compile this plugin locallydetailswiki.amxmodx.org/index.php/Compiling_Plugins_%28AMX_Mod_X%29   
                
4. Install compiled plugindetailswiki.amxmodx.org/index.php/Configuring_AMX_Mod_X#Installing 
#endif 

#define PLUGIN_NAME "New-Plugin"
#define PLUGIN_VERSION "0.0.0.1"
#define PLUGIN_AUTHOR "Andrei"

public plugin_init( ) 
{
    
register_plugin
    

        
PLUGIN_NAME
        
PLUGIN_VERSION
        
PLUGIN_AUTHOR 
    
);
    
    
register_forwardFM_CmdStart"Forward__CmdStart_Post", ._post true );
    
    
RegisterHamHam_Item_Holster"weapon_ak47""CBasePlayerItem__Holster_Pre", .Post false );
}

public 
Forward__CmdStart_PostpPlayerUcCmdiRandomSeed )
{
    if( !
is_user_alivepPlayer ) || get_user_weaponpPlayer ) != CSW_AK47 )
        return 
FMRES_IGNORED;
    if( ~
get_pdata_intpPlayerm_afButtonPressedXO_CBASEPLAYER ) & IN_ATTACK2 )
        return 
FMRES_IGNORED;
    
    new 
pEntity get_pdata_cbasepPlayerm_pActiveItemXO_CBASEPLAYER );
    
    if( 
get_pdata_floatpEntitym_flNextSecondaryAttackXO_CBASEPLAYERITEM ) > 0.0 )
        return 
FMRES_IGNORED;
    if( 
get_pdata_floatpPlayerm_flNextAttackXO_CBASEMONSTER ) > 0.0 )
        return 
FMRES_IGNORED;
        
    
set_pdata_floatpEntitym_flNextSecondaryAttack0.3XO_CBASEPLAYERITEM );
    
    
CBasePlayerItem__Holster_PrepEntity )
    
    return 
FMRES_IGNORED;
}

public 
CBasePlayerItem__Holster_PrepEntity )
{
    new 
pPlayer get_pdata_cbasepEntitym_pPlayerXO_CBASEPLAYERITEM );
    new 
iFOV get_pdata_intpPlayerm_iFOVXO_CBASEPLAYER ) == 90 55 90;
    
    
set_pdata_intpPlayerm_iFOViFOV );

Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
AwesomeMan
Member
Join Date: Jun 2013
Old 07-25-2013 , 12:03   Re: Zoom
Reply With Quote #3

Quote:
Originally Posted by Bos93 View Post
PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#tryinclude < cstrike_pdatas > 

#if !defined _cbaseentity_included 
        #assert Cstrike Pdatas and Offsets library required! Read the below instructions:   \ 
                
1. Download it at forums.alliedmods.net/showpost.php?p=1712101#post1712101   \ 
                
2. Put it into amxmodx/scripting/include/ folder   
                
3. Compile this plugin locallydetailswiki.amxmodx.org/index.php/Compiling_Plugins_%28AMX_Mod_X%29   
                
4. Install compiled plugindetailswiki.amxmodx.org/index.php/Configuring_AMX_Mod_X#Installing 
#endif 

#define PLUGIN_NAME "New-Plugin"
#define PLUGIN_VERSION "0.0.0.1"
#define PLUGIN_AUTHOR "Andrei"

public plugin_init( ) 
{
    
register_plugin
    

        
PLUGIN_NAME
        
PLUGIN_VERSION
        
PLUGIN_AUTHOR 
    
);
    
    
register_forwardFM_CmdStart"Forward__CmdStart_Post", ._post true );
    
    
RegisterHamHam_Item_Holster"weapon_ak47""CBasePlayerItem__Holster_Pre", .Post false );
}

public 
Forward__CmdStart_PostpPlayerUcCmdiRandomSeed )
{
    if( !
is_user_alivepPlayer ) || get_user_weaponpPlayer ) != CSW_AK47 )
        return 
FMRES_IGNORED;
    if( ~
get_pdata_intpPlayerm_afButtonPressedXO_CBASEPLAYER ) & IN_ATTACK2 )
        return 
FMRES_IGNORED;
    
    new 
pEntity get_pdata_cbasepPlayerm_pActiveItemXO_CBASEPLAYER );
    
    if( 
get_pdata_floatpEntitym_flNextSecondaryAttackXO_CBASEPLAYERITEM ) > 0.0 )
        return 
FMRES_IGNORED;
    if( 
get_pdata_floatpPlayerm_flNextAttackXO_CBASEMONSTER ) > 0.0 )
        return 
FMRES_IGNORED;
        
    
set_pdata_floatpEntitym_flNextSecondaryAttack0.3XO_CBASEPLAYERITEM );
    
    
CBasePlayerItem__Holster_PrepEntity )
    
    return 
FMRES_IGNORED;
}

public 
CBasePlayerItem__Holster_PrepEntity )
{
    new 
pPlayer get_pdata_cbasepEntitym_pPlayerXO_CBASEPLAYERITEM );
    new 
iFOV get_pdata_intpPlayerm_iFOVXO_CBASEPLAYER ) == 90 55 90;
    
    
set_pdata_intpPlayerm_iFOViFOV );

Cheers
Works great, thank you =D
AwesomeMan is offline
Old 07-26-2013, 13:29
LordOfNothing
This message has been deleted by ConnorMcLeod. Reason: troll, or posting random confusing code, or posting for posts count
Smatify
Senior Member
Join Date: Nov 2012
Location: Where ever you want
Old 07-26-2013 , 13:47   Re: Zoom
Reply With Quote #4

Quote:
Originally Posted by LordOfNothing View Post
#tryinclude < cstrike_pdatas > wtf ???
Quote:
Originally Posted by ConnorMcLeod View Post
If you use those includes, you can include them like this :
PHP Code:
#tryinclude <cstrike_pdatas>

#if !defined _cbaseentity_included
        #assert Cstrike Pdatas and Offsets library required! Read the below instructions:   \
                
1. Download it at forums.alliedmods.net/showpost.php?p=1712101#post1712101   \
                
2. Put it into amxmodx/scripting/include/ folder   \
                
3. Compile this plugin locallydetailswiki.amxmodx.org/index.php/Compiling_Plugins_%28AMX_Mod_X%29   \
                
4. Install compiled plugindetailswiki.amxmodx.org/index.php/Configuring_AMX_Mod_X#Installing
#endif 
__________________
Selling Hosting stuff such as Webspace and Game- & VoiceServer

I'm also selling Steam Keys.
For more informations, contact me.

(Homepage is under development)
Smatify 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 06:20.


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