This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

AWP & SCOUT auto fast switch


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
Costin83
Senior Member
Join Date: Jul 2008
Location: Romania
Old 02-08-2009 , 01:25   AWP & SCOUT auto fast switch
Reply With Quote #1

Well, we all know that when you fire an AWP or SCOUT we need to fast-switch it, else we will still have a zoomed weapon after we fire a shot. Maybe someone like me (a total noob with snipers) will find usefull to have a plugin that auto fast-switches weapons after he fiered a bullet (only if the sniper is scoped)

So I made this plugin for ME and for annybody who has noobs on his server .

Note that is a little delay between switching weapons. I made it this way by will due to compatibility with other plugins (for example those which have to deal with player speed). Though it can be much faster like instantly fast-switch.

Feel free to modify use it however you want, add cvars, etc. annyways it's not my code, I just copy/paste much of it from other plugins.

CVARS: fast_zoom 1|0 (1=plugin ON | 0=plugin OFF)

Note: This is my first plugin attempt and it will not get aprooved.

Credits: tuty for the quick reply and adding a cvar to toggle the plugin on/off KARMA+ tuty !
VEN for his plugin "zoom_info" from which I've copied most of the code
And SuicideDog for his plugin "Sniper Realism" copied some code from him either

Edit#1: Now only fakemeta requiered, updated to ver. 0.2 thx to tuty .
Edit#2: Again, thanks to tuty added support for "hud_fastswitch 0" wich made the plugin useless due to "select" problem. I didn't thought about that, I never used hud_fastswitch 0 so I forgotten that issue .
Attached Files
File Type: sma Get Plugin or Get Source (fast_zoom.sma - 1212 views - 1.1 KB)

Last edited by Costin83; 02-08-2009 at 13:39.
Costin83 is offline
Send a message via Yahoo to Costin83
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 02-08-2009 , 04:56   Re: AWP & SCOUT auto fast switch
Reply With Quote #2

You dont need to include <engine>

Because you have fakemeta ^^


PHP Code:
if ((get_user_button(id)&IN_ATTACK)) 
use this

PHP Code:
if(pev(idpev_button) & IN_ATTACK)
... 
PHP Code:

get_user_weapon
(idclipammo
i think is enough

PHP Code:
get_user_weapon(id

PS: make a cvar to enable / disable plugin
__________________

Last edited by tuty; 02-08-2009 at 05:01.
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
Costin83
Senior Member
Join Date: Jul 2008
Location: Romania
Old 02-08-2009 , 05:55   Re: AWP & SCOUT auto fast switch
Reply With Quote #3

Thanks tuty
I didn't knew that
Updated version 0.2
now only fakemeta thanks to tuty

PS: baga si u ID-ul meu in lista pls
Costin83 is offline
Send a message via Yahoo to Costin83
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 02-08-2009 , 07:02   Re: AWP & SCOUT auto fast switch
Reply With Quote #4

or you can make in this way

PHP Code:
new button pev(idpev_button);

if(
button IN_ATTACK)
{
 
// do something

__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-22-2009 , 22:20   Re: AWP & SCOUT auto fast switch
Reply With Quote #5

There are major errors in this that prevent it from being approved. Here are some of them:

Your algorithm is not well developed enough.

If you would like any information regarding possible adjustments you could make or things you could do to make this better, please feel free to post here or PM me.

Unapproved.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Costin83
Senior Member
Join Date: Jul 2008
Location: Romania
Old 02-23-2009 , 15:44   Re: AWP & SCOUT auto fast switch
Reply With Quote #6

Quote:
Originally Posted by Hawk552 View Post
There are major errors in this that prevent it from being approved. Here are some of them:

Your algorithm is not well developed enough.

If you would like any information regarding possible adjustments you could make or things you could do to make this better, please feel free to post here or PM me.

Unapproved.
Well, I didn't intended to get aprooved, and yes, I would like to improove my plugin, just to make sure I've done something that might be usefull, so if you want to help me making a quality plugin just point me to the right direction Thanks
Costin83 is offline
Send a message via Yahoo to Costin83
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-24-2009 , 10:46   Re: AWP & SCOUT auto fast switch
Reply With Quote #7

The biggest problem is that your method of detection is inaccurate. It checks whether they're olding down the attack button or not but doesn't detect if they actually shot. I think there's a hook in Ham Sandwich for the actual attack event which you can use, instead.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-24-2009 , 13:48   Re: AWP & SCOUT auto fast switch
Reply With Quote #8

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

// weapons offsets
const m_pPlayer            41
const m_flNextPrimaryAttack    46
const m_flNextSecondaryAttack    47
const m_iClip                51

// players offsets
const m_iFOV            363

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
RegisterHam(Ham_Item_PostFrame"weapon_scout""Sniper_PostFrame")
    
RegisterHam(Ham_Item_PostFrame"weapon_awp""Sniper_PostFrame")
}

public 
Sniper_PostFrameiEnt )
{
    static 
id id get_pdata_cbase(iEntm_pPlayer4)
    static 
iButton iButton pev(idpev_button)

    if(    (!(
iButton IN_ATTACK2) || get_pdata_float(iEntm_flNextSecondaryAttack4) > 0.0)
    &&    (
iButton IN_ATTACK)
    &&    
get_pdata_int(iEntm_iClip4)
    &&    
get_pdata_float(iEntm_flNextPrimaryAttack4) <= 0.0    )
    {
        
// player is shooting

        
if( get_pdata_int(idm_iFOV5) < 90 )
        {
            
// player is shooting and is zooming
        
}
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 02-24-2009 , 13:51   Re: AWP & SCOUT auto fast switch
Reply With Quote #9

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

// weapons offsets
const m_pPlayer            41
const m_flNextPrimaryAttack    46
const m_flNextSecondaryAttack    47
const m_iClip                51

// players offsets
const m_iFOV            363

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
RegisterHam(Ham_Item_PostFrame"weapon_scout""Sniper_PostFrame")
    
RegisterHam(Ham_Item_PostFrame"weapon_awp""Sniper_PostFrame")
}

public 
Sniper_PostFrameiEnt )
{
    static 
id id get_pdata_cbase(iEntm_pPlayer4)
    static 
iButton iButton pev(idpev_button)

    if(    (!(
iButton IN_ATTACK2) || get_pdata_float(iEntm_flNextSecondaryAttack4) > 0.0)
    &&    (
iButton IN_ATTACK)
    &&    
get_pdata_int(iEntm_iClip4)
    &&    
get_pdata_float(iEntm_flNextPrimaryAttack4) <= 0.0    )
    {
        
// player is shooting

        
if( get_pdata_int(idm_iFOV5) < 90 )
        {
            
// player is shooting and is zooming
        
}
    }

ConnorMcleod can sing the contents of "hamsandwich.inc" without look at it.
joaquimandrade is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-24-2009 , 13:54   Re: AWP & SCOUT auto fast switch
Reply With Quote #10

Just by looking and playing with the HLSDK and you will see it's not that hard.
Arkshine 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 19:18.


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