AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved [HELP] Stopping Brass Event (https://forums.alliedmods.net/showthread.php?t=318043)

hellmonja 08-10-2019 15:12

[HELP] Stopping Brass Event
 
Any way to stop an event? I'm trying to stop the Brass event (https://wiki.alliedmods.net/Half-Lif...e_Events#Brass) for M3, Scout, and AWP, but nothing works. Here's what I have so far:
PHP Code:

register_event("Brass""Event_Brass""a");
...
public 
Event_Brass()
{
    new 
user read_data(15);
    
client_print(userprint_chat"BRASS!");

    return 
PLUGIN_HANDLED


The client_print is there to tell me if it's hooked, and it is so far. But it doesn't stop the shell that's ejecting after you shoot...

thEsp 08-10-2019 15:23

Re: [HELP] Stopping Brass Event
 
Register (hook) it as a message?

hellmonja 08-10-2019 15:29

Re: [HELP] Stopping Brass Event
 
Quote:

Originally Posted by thEsp (Post 2662803)
Register (hook) it as a message?

What do you mean?
PHP Code:

register_event("Brass""Event_Brass""a"); 

Like this?...

CrazY. 08-10-2019 16:11

Re: [HELP] Stopping Brass Event
 
Code:
register_message(get_user_msgid("Brass"), "EjectBrass"); ... public EjectBrass() {     return PLUGIN_HANDLED; }

or hook Ham_Weapon_PrimaryAttack and set the m_flEjectBrass member to 0.0

HamletEagle 08-10-2019 17:13

Re: [HELP] Stopping Brass Event
 
register_event is a post hook, you can not block anything.
register_message is a pre hook.

hellmonja 08-10-2019 23:37

Re: [HELP] Stopping Brass Event
 
Quote:

Originally Posted by CrazY. (Post 2662810)
Code:
register_message(get_user_msgid("Brass"), "EjectBrass"); ... public EjectBrass() {     return PLUGIN_HANDLED; }

or hook Ham_Weapon_PrimaryAttack and set the m_flEjectBrass member to 0.0

It works! Thank you! So basically I just had to switch from event to message, I didn't understand that the first thEsp told me. Finally fixed it after a long while.:bacon!:

Quote:

Originally Posted by HamletEagle (Post 2662818)
register_event is a post hook, you can not block anything.
register_message is a pre hook.

Very good to know, thank you very much! I'm sure I'll keep that in mind from now on... :)

Natsheh 08-11-2019 01:46

Re: [HELP] Stopping Brass Event
 
You also can block the message using set_msg_block(get_user_userid("Brass"), BLOCK_SET) it will be much better.


All times are GMT -4. The time now is 17:22.

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