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

Solved read data from events and hook 2 things


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nacknic
Senior Member
Join Date: Mar 2019
Old 06-09-2019 , 14:29   read data from events and hook 2 things
Reply With Quote #1

for example 1:
Code:
register_event( "SendAudio", "t_win", "a", "2=%!MRAD_terwin" );
register_event( "SendAudio","ct_win", "a", "2=%!MRAD_ctwin" );
example 2 hook them both:
Code:
register_event( "SendAudio", "win", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin" );
so, how i read 2=%!MRAD_terwin or 2=%!MRAD_ctwin ?
read_data( 2 ) ?

Last edited by nacknic; 06-09-2019 at 23:38.
nacknic is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-09-2019 , 15:54   Re: read data from events and hook 2 things
Reply With Quote #2

Why don't you try it and find out for yourself?
__________________
Bugsy is offline
thEsp
BANNED
Join Date: Aug 2017
Old 06-09-2019 , 16:55   Re: read data from events and hook 2 things
Reply With Quote #3

Determine whether read_data(2) is 1 or 2.. via switch statement. That's it all.
thEsp is offline
nacknic
Senior Member
Join Date: Mar 2019
Old 06-09-2019 , 18:47   Re: read data from events and hook 2 things
Reply With Quote #4

Quote:
Originally Posted by thEsp View Post
Determine whether read_data(2) is 1 or 2.. via switch statement. That's it all.
i did simple thing to check:
Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>

public plugin_init( ) 
	register_event( "SendAudio", "win", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin" );
	
public win( )
{
	new sz[ 51 ];
	client_print( 0, print_chat, "%S", read_data( 2, sz, charsmax( sz ) );
}
its works, show me !MRAD_ctwin when ct win and !MRAD_terwin when t win.

now when i try to check like that, not works, i know its because '%' in %!MRAD_terwin" and %!MRAD_cterwin", but i not know what to do to check , can you help me please ?
Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>

public plugin_init( ) 
	register_event( "SendAudio", "win", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin" );
	
public win( )
{
	new sz[ 51 ];
	read_data( 2, sz, charsmax( sz ) );
	
	if ( equal( sz, "%!MRAD_terwin" ) )
		client_print( 0, print_chat, "T" );
	else if ( equal( sz, "%!MRAD_cterwin" ) )
	         client_print( 0, print_chat, "CT" );
}
nacknic is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-09-2019 , 19:08   Re: read data from events and hook 2 things
Reply With Quote #5

Not sure if the % is or isn't causing an issue here. Try checking only the part of the string with the team name:
PHP Code:
#include <amxmodx>

public plugin_init( ) 
    
register_event"SendAudio""win""a""2=%!MRAD_terwin""2=%!MRAD_ctwin" );
    
public 
win( )
{
    new 
sz16 ];
    
read_data2szcharsmaxsz ) );
    
    if ( 
equalsz], "ter" ) , )
        
client_print0print_chat"T" );
    else
        
client_print0print_chat"CT" );

__________________

Last edited by Bugsy; 06-09-2019 at 20:08.
Bugsy is offline
nacknic
Senior Member
Join Date: Mar 2019
Old 06-09-2019 , 23:35   Re: read data from events and hook 2 things
Reply With Quote #6

Quote:
Originally Posted by Bugsy View Post
Not sure if the % is or isn't causing an issue here. Try checking only the part of the string with the team name:
PHP Code:
#include <amxmodx>

public plugin_init( ) 
    
register_event"SendAudio""win""a""2=%!MRAD_terwin""2=%!MRAD_ctwin" );
    
public 
win( )
{
    new 
sz16 ];
    
read_data2szcharsmaxsz ) );
    
    if ( 
equalsz], "ter" ) , )
        
client_print0print_chat"T" );
    else
        
client_print0print_chat"CT" );

hi, i learn from you that i can sub-string in equal operator, i did this, and work 100% [thank you] i write my code:
Code:
#include <amxmodx>

public plugin_init( ) 
    register_event( "SendAudio", "win", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin" );
    
public win( )
{
    new sz[ 16 ];
    read_data( 2, sz, charsmax( sz ) );
    
    if ( equal( sz[ 1 ], "!MRAD_terwin" ) )
        client_print( 0, print_chat, "T" );
    else if ( equal( sz[ 1 ], "!MRAD_ctwin" ) )
        client_print( 0, print_chat, "CT" );
}
when i start sz[ 1 ], its skipping the all '%' problem

Last edited by nacknic; 06-09-2019 at 23:37.
nacknic 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 06:59.


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