Raised This Month: $ Target: $400
 0% 

Hook from another plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JocAnis
Veteran Member
Join Date: Jun 2010
Old 09-30-2018 , 05:36   Hook from another plugin
Reply With Quote #1

hey..im wondering, is there any chance to hook a chat message from other plugin to ours?
for example, in plugin1.sma we have:

ColorChat( 0, RED, "IDEMO NIS" )

So is there any chance, my plugin2.sma can hook "IDEMO NIS" (or that say equali to idemo nis) which is printed in chat to everyone in the server?

like how we get ct/tr win hooking.. ?

register_message( get_user_msgid( "TextMsg" ) ,"message_textmsg" );

something with
Code:
get_user_msgid( "SayText" )

get_user_msgid( "TextMsg" )
being plugin1.amxx before plugin2.amxx in plugins.ini ?
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)

Last edited by JocAnis; 09-30-2018 at 05:44.
JocAnis is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 09-30-2018 , 06:47   Re: Hook from another plugin
Reply With Quote #2

found the way...can admin lock the thread?
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 09-30-2018 , 07:28   Re: Hook from another plugin
Reply With Quote #3

There's no need to lock. Also you should post the solution for people searching to solve the same problem in the future.
__________________
klippy is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 09-30-2018 , 07:56   Re: Hook from another plugin
Reply With Quote #4

allright, thanks to DarkGL, hes abnormal haha
https://forums.alliedmods.net/showthread.php?t=150047
who really needs it, he will find the solution easily there
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 10-01-2018 , 16:16   Re: Hook from another plugin
Reply With Quote #5

Quote:
Originally Posted by JocAnis View Post
allright, thanks to DarkGL, hes abnormal haha
https://forums.alliedmods.net/showthread.php?t=150047
who really needs it, he will find the solution easily there
Orpheu for something that simple, no thanks.

https://wiki.alliedmods.net/Half-Lif...Events#SayText

Will be called for every receiver, if you only want it once you have to filter it somehow. There might be different ways depending on what you plan to do with it, you have not disclosed that information though. Please read here as well: http://xyproblem.info/
Code:
register_message(get_user_msgid("SayText"), "msgSayText"); public msgSayText(MsgID, Destination[3], receiver) {     new sender = get_msg_arg_int(1);         static szText[192];     get_msg_arg_string(4, szText, charsmax(szText));     server_print("SayText:^nSender: %d^nReceiver: %d^nContent:^n%s", sender, receiver, szText); }
__________________

Last edited by Black Rose; 10-01-2018 at 16:19.
Black Rose is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 10-01-2018 , 19:12   Re: Hook from another plugin
Reply With Quote #6

i think i was clear what i wanted...one plugin is sending:

ColorChat( 0, RED, "IDEMO NIS" )

how to catch it in another plugin? your code only hooks say commands (classical)...so i dont get it why should i read http://xyproblem.info/ :/
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 10-01-2018 , 21:00   Re: Hook from another plugin
Reply With Quote #7

Modify the colorchat to use emessage_ instead of message_ functions for sending messages, then you will be able to hook them.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
JocAnis
Veteran Member
Join Date: Jun 2010
Old 10-02-2018 , 09:10   Re: Hook from another plugin
Reply With Quote #8

@oci thanks for that tip...but if i need it for my purpose (my plugins), i will connect both plugins somehow (natives)...the thing is about other plugin which is already on the server...so noone of head admins will change their plugin's colorchat to match to mine...so i did it opposite, like in this thread
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 10-02-2018 , 10:12   Re: Hook from another plugin
Reply With Quote #9

You don't need to change it. You can create a different one with a new name so they don't have to replace their own.

PS: ColorChat contains bugs, I don't suggest you use it. Have a look at CromChat.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
JocAnis
Veteran Member
Join Date: Jun 2010
Old 10-02-2018 , 11:24   Re: Hook from another plugin
Reply With Quote #10

im not 100% sure i undestand you...well, who wouldnt be lazy to modify prokreedz.sma (with the emessage_ colorchat) and put again...even its annoying to me to do...isnt it easier just put that plugin i submitted?

ps: im sorry but i dont see any advantage in your cromchat compared to the colorchat..if you tell me or if i experience any bug ill think about it
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis 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 13:35.


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