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

[REQ] No scope, no shoot


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
blanko
Senior Member
Join Date: Aug 2008
Old 02-25-2017 , 07:05   [REQ] No scope, no shoot
Reply With Quote #1

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 is offline
blanko
Senior Member
Join Date: Aug 2008
Old 02-28-2017 , 22:01   Re: [REQ] No scope, no shoot
Reply With Quote #2

Is this impossible to be done?
__________________
blanko is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-28-2017 , 23:02   Re: [REQ] No scope, no shoot
Reply With Quote #3

It's doable.
__________________
Bugsy is online now
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 03-01-2017 , 07:38   Re: [REQ] No scope, no shoot
Reply With Quote #4

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; }
__________________

Last edited by edon1337; 03-01-2017 at 07:38.
edon1337 is offline
blanko
Senior Member
Join Date: Aug 2008
Old 03-01-2017 , 18:16   Re: [REQ] No scope, no shoot
Reply With Quote #5

not working, edon
__________________
blanko is offline
Old 03-02-2017, 00:36
EFFx
This message has been deleted by EFFx. Reason: nvm
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 03-02-2017 , 07:49   Re: [REQ] No scope, no shoot
Reply With Quote #6

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; }
__________________

Last edited by edon1337; 03-02-2017 at 07:51.
edon1337 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-02-2017 , 08:34   Re: [REQ] No scope, no shoot
Reply With Quote #7

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

__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
blanko
Senior Member
Join Date: Aug 2008
Old 03-02-2017 , 09:30   Re: [REQ] No scope, no shoot
Reply With Quote #8

Quote:
Originally Posted by OciXCrom View Post
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.
__________________
blanko is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-02-2017 , 09:35   Re: [REQ] No scope, no shoot
Reply With Quote #9

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.
__________________

Last edited by OciXCrom; 03-02-2017 at 09:35.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 03-02-2017 , 09:57   Re: [REQ] No scope, no shoot
Reply With Quote #10

Quote:
Originally Posted by OciXCrom View Post
Doesn't work as well.
Did you test it or you're just guessing ?
__________________
edon1337 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 10:54.


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