Raised This Month: $32 Target: $400
 8% 

Weapon firing when MOTD appears | CVAR not updating |


Post New Thread Reply   
 
Thread Tools Display Modes
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-12-2018 , 17:16   Re: Weapon firing when MOTD appears | CVAR not updating |
Reply With Quote #11

Quote:
Originally Posted by ^SmileY View Post
This m_flNextPrimaryAttack will not work since weapon is already fired.

set_pdata_int(id, m_bCanShoot, false);

Try with
Didn't work either

876 is the value for that off-set in Windows, right?
__________________

Last edited by edon1337; 07-12-2018 at 17:16.
edon1337 is offline
Old 07-13-2018, 03:50
Ghosted
This message has been deleted by Ghosted.
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 07-13-2018 , 04:03   Re: Weapon firing when MOTD appears | CVAR not updating |
Reply With Quote #12

Quote:
Originally Posted by edon1337 View Post
PHP Code:
new bool:g_bVictoryBlockAttack33 ];

#define g_iBitsum (1<<CSW_P228)|(1<<CSW_GLOCK)|(1<<CSW_C4)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_UMP45)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)

public plugin_init( )
{
    for( new 
CSW_P228<= CSW_P90i++ )
    {
        if( 
g_iBitsum & (1<<i) )
        continue;
        
        
get_weaponnameiszWeaponNamecharsmaxszWeaponName ) );
        
RegisterHamHam_Weapon_PrimaryAttackszWeaponName"@HamPrimaryAttack_Pre" );
    }
}

public @
HamPrimaryAttack_PreiEnt )
{
    new 
id;
    
id peviEntpev_owner );
    
    if( 
g_bVictoryBlockAttackid ] )
    {
        
set_pdata_floatiEntm_flNextPrimaryAttack9999.9);
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;
}

VictoryiPlayer )
{
    new 
szPlayers32 ], iNumiTempID;
    
get_playersszPlayersiNum"a" );
    
    for( new 
iiNumi++ )
    {
        
iTempID szPlayers];
        
g_bVictoryBlockAttackiTempID ] = true;
    }

#1 Your code is not compilable cause there is not szWeaponName
#2 You should use new const instead of #define on bitsums, cause it wont work.
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM
Ghosted is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 07-13-2018 , 04:05   Re: Weapon firing when MOTD appears | CVAR not updating |
Reply With Quote #13

Try this, its working fiNe

Code:
new bool:g_bVictoryBlockAttack[ 33 ]; 

new const g_iBitsum = (1<<CSW_P228)|(1<<CSW_GLOCK)|(1<<CSW_C4)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_UMP45)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE);

public plugin_init( ) 
{ 
new szWeaponName[32];
    for( new i = CSW_P228; i <= CSW_P90; i++ ) 
    { 
        if( g_iBitsum & (1<<i) ) 
        continue; 
         
        get_weaponname( i, szWeaponName, charsmax( szWeaponName ) ); 
        RegisterHam( Ham_Weapon_PrimaryAttack, szWeaponName, "@HamPrimaryAttack_Pre" ); 
    } 
} 

public @HamPrimaryAttack_Pre( iEnt ) 
{ 
    new id; 
    id = pev( iEnt, pev_owner ); 
     
    if( g_bVictoryBlockAttack[ id ] ) 
    { 
        return HAM_SUPERCEDE; 
    } 
     
    return HAM_IGNORED; 
} 

Victory( iPlayer ) 
{ 
    new szPlayers[ 32 ], iNum; 
    get_players( szPlayers, iNum, "a" ); 
     
    for( new i; i < iNum; i++ ) 
    { 
        g_bVictoryBlockAttack[szPlayers[ i ]] = true; 
    } 
}
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM

Last edited by Ghosted; 07-13-2018 at 04:06.
Ghosted is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-13-2018 , 04:29   Re: Weapon firing when MOTD appears | CVAR not updating |
Reply With Quote #14

Quote:
Originally Posted by ^SmileY View Post
This m_flNextPrimaryAttack will not work since weapon is already fired.

set_pdata_int(id, m_bCanShoot, false);

Try with
What? The code should work. If it doesn't then probably the if check is never true. There must be some logic error in the plugin.
edon, do some debugging to see if set_pdata_float is reached or not.

Quote:
Originally Posted by edon1337 View Post
Didn't work either
876 is the value for that off-set in Windows, right?
No. 876 is the full offset. In a plugin you have to divide by the size, so 876/4 to use set_pdata_int or use set_pdata_bool(amxx 1.8.3 or Connor's stock).
__________________

Last edited by HamletEagle; 07-13-2018 at 04:37.
HamletEagle is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 07-13-2018 , 04:36   Re: Weapon firing when MOTD appears | CVAR not updating |
Reply With Quote #15

Quote:
Originally Posted by HamletEagle View Post
What? The code should work. If it doesn't then probably the if check is never true. There must be some logic error in the plugin.
edon, do some debugging to see if set_pdata_float is reached or not.


No. 876 is the full offset. In a plugin you have to divide by the size, so 876/4.
Yes, error is in the plugin i posted where (in bitsums)
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM
Ghosted is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-13-2018 , 06:45   Re: Weapon firing when MOTD appears | CVAR not updating |
Reply With Quote #16

Quote:
Originally Posted by HamletEagle View Post
What? The code should work. If it doesn't then probably the if check is never true. There must be some logic error in the plugin.
edon, do some debugging to see if set_pdata_float is reached or not.


No. 876 is the full offset. In a plugin you have to divide by the size, so 876/4 to use set_pdata_int or use set_pdata_bool(amxx 1.8.3 or Connor's stock).
Basically the problem is somewhere else
PHP Code:
    new szWeaponName32 ];
    
    for( new 
CSW_P228<= CSW_P90i++ )
    {        
        
get_weaponnameiszWeaponNamecharsmaxszWeaponName ) );
        
RegisterHamHam_Weapon_PrimaryAttackszWeaponName"@HamPrimaryAttack_Pre" );
        
        
log_to_file"test.txt""Weapon name: %s"szWeaponName );
    } 
It only loops once and stops..
Quote:
L 07/13/2018 - 12: 38: 06: Weapon name: weapon_p228
And I get this error
Code:
L 07/13/2018 - 12:44:12: [HAMSANDWICH] Failed to retrieve classtype for "", hook for "@HamPrimaryAttack_Pre" not active.

Quote:
Originally Posted by Ghosted View Post
#1 Your code is not compilable cause there is not szWeaponName
#2 You should use new const instead of #define on bitsums, cause it wont work.
I never said it wasn't compilable? szWeaponName is already in my code I just forgot to add it in the code I provided here, not a big deal.
Yes, that's true that the #define on bitsums doesn't work, but I recently noticed I don't even need the bitsums, so I removed that part.
__________________

Last edited by edon1337; 07-13-2018 at 06:48.
edon1337 is offline
Old 07-13-2018, 09:34
HamletEagle
This message has been deleted by HamletEagle.
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-13-2018 , 09:44   Re: Weapon firing when MOTD appears | CVAR not updating |
Reply With Quote #17

If you debugged properly(adding the debug message before RegisterHam) you would see it actually loops twice:
PHP Code:
Weapon name weapon_p228 1
Weapon name 
=  | 
And if you look at the CSW_ indexes from here: http://amxmodx.org/api/cstrike_const the issue should be more than obvious.
__________________
HamletEagle is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-13-2018 , 10:13   Re: Weapon firing when MOTD appears | CVAR not updating |
Reply With Quote #18

Quote:
Originally Posted by HamletEagle View Post
If you debugged properly(adding the debug message before RegisterHam) you would see it actually loops twice:
PHP Code:
Weapon name weapon_p228 1
Weapon name 
=  | 
And if you look at the CSW_ indexes from here: http://amxmodx.org/api/cstrike_const the issue should be more than obvious.
So should I just skip CSW_GLOCK ?

EDIT: Yea it works, someone should even release a plugin including this and a code that fixes the glitch that Crazy mentioned with the console.
__________________

Last edited by edon1337; 07-13-2018 at 10:21.
edon1337 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-13-2018 , 10:38   Re: Weapon firing when MOTD appears | CVAR not updating |
Reply With Quote #19

Regarding the cvar bug - can you post "amxx version"?

EDIT: You are clearly using a revision of 1.8.3, I see the behavior has changed and I'll see if this is really an issue, but it isn't important for your case. What's important is that you should put all cvars in server.cfg - amxx.cfg is used only for AMXX core cvars and people shouldn't add more cvars to it. It wasn't consistent even before - if you had a plugin that would load before admin.sma your cvars wouldn't be up to date in plugins_init.
__________________

Last edited by klippy; 07-13-2018 at 10:45.
klippy is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-13-2018 , 10:44   Re: Weapon firing when MOTD appears | CVAR not updating |
Reply With Quote #20

Quote:
Originally Posted by KliPPy View Post
Regarding the cvar bug - can you post "amxx version"?

EDIT: You are clearly using a revision of 1.8.3, I see the behavior has changed and I'll see if this is really an issue, but it isn't important for your case. What's important is that you should put all cvars in server.cfg - amxx.cfg is used only for AMXX core cvars.
I'm actually using AMXX 1.8.2 but setting them in server.cfg seems to be working. Thanks.
__________________

Last edited by edon1337; 07-13-2018 at 10:51.
edon1337 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 00:53.


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