View Single Post
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-05-2011 , 10:19   Re: Make AWP 100% accurate
Reply With Quote #7

Forget about retrieving a decent signature for such function because the content is almost the same for such weapons and it's impossible to get a signature from that.

What you can do is to find the address of this function from PrimaryAttack.

Something like :

Code:
#include <amxmodx> #include <fakemeta> #include <hamsandwich> #include <orpheu> #include <orpheu_advanced> const m_pPlayer = 41; const Float:AwpAdjustedSpread = 0.08; public plugin_init() {     register_plugin( "", "", "" );         // Find AWPFire() address.     new startAddress = OrpheuGetFunctionAddress( OrpheuGetFunctionFromClass( "weapon_awp", "PrimaryAttack", "CBasePlayerWeapon" ) );     new fireAddress  = OrpheuGetNextCallAtAddress( startAddress, .number = 1 );         // We can hook our function.     OrpheuRegisterHook( OrpheuCreateFunction( fireAddress, "AWPFire", "CAWP" ), "OnAWPFire" ); } public OnAWPFire( const weapon, const Float:spread, Float:cycleTime, const bool:useSemi ) {     new player = get_pdata_cbase( weapon, m_pPlayer, 4 );     OrpheuSetParam( 2, pev( player, pev_fov ) == 90 ? -AwpAdjustedSpread : 0.0 ); }

So, now, awp should have the same behavior like you were ducking all the time.


EDIT : forget the files :

functions/CAWP/AWPFire :

Code:
{
    "name"      : "AWPFire",
    "class"     : "CAWP",
    "library"   : "mod",
    "arguments" :
    [
        {
            "type"  : "float"
        },
        {
            "type"  : "float"
        },
        {
            "type"  : "int"
        }
    ]
}


virtualFunctions/CBasePlayerWeapon/PrimaryAttack :

Code:
{
    "name"    : "PrimaryAttack",
    "class"   : "CBasePlayerWeapon",
    "library" : "mod",
    "indexes" : 
    [
        {
            "os"    : "windows",
            "mod"   : "cstrike",
            "value" : 87
        },
        {
            "os"    : "linux",
            "mod"   : "cstrike",
            "value" : 89
        }
    ]
}
__________________

Last edited by Arkshine; 09-05-2011 at 10:38.
Arkshine is offline