AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [REQ] No scope, no shoot (https://forums.alliedmods.net/showthread.php?t=294334)

blanko 02-25-2017 07:05

[REQ] No scope, no shoot
 
Having seen it before and that's a great idea to make it so that the rifles won't shoot unless they are scoped.

blanko 02-28-2017 22:01

Re: [REQ] No scope, no shoot
 
Is this impossible to be done?

Bugsy 02-28-2017 23:02

Re: [REQ] No scope, no shoot
 
It's doable.

edon1337 03-01-2017 07:38

Re: [REQ] No scope, no shoot
 
Not tested
Code:
#include < amxmodx > #include < cstrike > #include < hamsandwich > #include < fakemeta > new const VALID_WEAPONS[ ][ ] = {     "weapon_awp",     "weapon_scout",     "weapon_g3sg1",     "weapon_sg550" } public plugin_init( ) {     register_plugin( "Block Shoot Unless Scoped", "1.0", "DoNii" );     for ( new i; i < sizeof VALID_WEAPONS; i++ )     RegisterHam( Ham_Weapon_PrimaryAttack, VALID_WEAPONS[ i ], "fw_HamPrimaryAttack" ); } public fw_HamPrimaryAttack( ent ) {     if( pev_valid( ent ) != 2 )     return HAM_IGNORED;     new id = pev( ent, pev_owner );     new zoom = cs_get_user_zoom( id );         if( ( zoom == CS_RESET_ZOOM ) || ( zoom == CS_SET_NO_ZOOM ) )     return HAM_SUPERCEDE;         return HAM_IGNORED; }

blanko 03-01-2017 18:16

Re: [REQ] No scope, no shoot
 
not working, edon

edon1337 03-02-2017 07:49

Re: [REQ] No scope, no shoot
 
Code:
#include < amxmodx > #include < cstrike > #include < hamsandwich > #include < fakemeta > new const VALID_WEAPONS[ ][ ] = {     "weapon_awp",     "weapon_scout",     "weapon_g3sg1",     "weapon_sg550" } const m_flNextPrimaryAttack = 46 const EXTRAOFFSET_WEAPON = 4 public plugin_init( ) {     register_plugin( "Block Shoot Unless Scoped", "1.0", "DoNii" );     for ( new i; i < sizeof VALID_WEAPONS; i++ )     RegisterHam( Ham_Weapon_PrimaryAttack, VALID_WEAPONS[ i ], "fw_HamPrimaryAttack" ); } public fw_HamPrimaryAttack( ent ) {     if( pev_valid( ent ) != 2 )     return HAM_IGNORED;     new id = pev( ent, pev_owner );     new zoom = cs_get_user_zoom( id );         if( zoom == CS_RESET_ZOOM ) {         set_pdata_float( ent , m_flNextPrimaryAttack , 9999.0 , EXTRAOFFSET_WEAPON );         return HAM_SUPERCEDE;     }       return HAM_IGNORED; }

OciXCrom 03-02-2017 08:34

Re: [REQ] No scope, no shoot
 
Doesn't work as well. Here:

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

#define m_pPlayer 41
#define m_flNextPrimaryAttack 46
#define XO_WEAPON 4

new const g_szWeapons[][] = { "weapon_awp""weapon_scout""weapon_g3sg1""weapon_sg550" }

public 
plugin_init()
{
    
register_plugin("No Shoot Unless Scoped""1.0""OciXCrom @ alliedmods.net")
    
    for(new 
isizeof(g_szWeapons); i++)
        
RegisterHam(Ham_Weapon_PrimaryAttackg_szWeapons[i], "OnShootPre")
}

public 
OnShootPre(iEnt)
{
    static 
id
    id 
get_pdata_cbase(iEntm_pPlayerXO_WEAPON)
    
    if(
cs_get_user_zoom(id) < CS_SET_FIRST_ZOOM)
    {
        
set_pdata_float(iEntm_flNextPrimaryAttack1.0XO_WEAPON)
        return 
HAM_SUPERCEDE
    
}
    
    return 
HAM_IGNORED



blanko 03-02-2017 09:30

Re: [REQ] No scope, no shoot
 
Quote:

Originally Posted by OciXCrom (Post 2500023)
Doesn't work as well. Here:

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

#define m_pPlayer 41
#define m_flNextPrimaryAttack 46
#define XO_WEAPON 4

new const g_szWeapons[][] = { "weapon_awp""weapon_scout""weapon_g3sg1""weapon_sg550" }

public 
plugin_init()
{
    
register_plugin("No Shoot Unless Scoped""1.0""OciXCrom @ alliedmods.net")
    
    for(new 
isizeof(g_szWeapons); i++)
        
RegisterHam(Ham_Weapon_PrimaryAttackg_szWeapons[i], "OnShootPre")
}

public 
OnShootPre(iEnt)
{
    static 
id
    id 
get_pdata_cbase(iEntm_pPlayerXO_WEAPON)
    
    if(
cs_get_user_zoom(id) < CS_SET_FIRST_ZOOM)
    {
        
set_pdata_float(iEntm_flNextPrimaryAttack1.0XO_WEAPON)
        return 
HAM_SUPERCEDE
    
}
    
    return 
HAM_IGNORED



Nothing happened, didn't work my friend.

OciXCrom 03-02-2017 09:35

Re: [REQ] No scope, no shoot
 
It works, but the animation glitches out. Pay attention to the ammo - it doesn't change, it also doesn't do damage. You only see a fake shoot animation/bullet. I'm not sure if this glitch can be prevented.

edon1337 03-02-2017 09:57

Re: [REQ] No scope, no shoot
 
Quote:

Originally Posted by OciXCrom (Post 2500023)
Doesn't work as well.

Did you test it or you're just guessing ?


All times are GMT -4. The time now is 02:01.

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