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

2 questions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
daniel46
Senior Member
Join Date: Dec 2011
Old 06-04-2014 , 15:08   2 questions
Reply With Quote #1

i have a spray high code but some times it will just show 000000000000

Code:
public EventSpray ( )  
{  
	new iPlayer = read_data( 2 );
	if( !SprayContest || AlreadySprayed[ iPlayer ] )
	{
		return;
	}
	new iOrigin[ 3 ];  
	iOrigin[ 0 ] = read_data( 3 );  
	iOrigin[ 1 ] = read_data( 4 );  
	iOrigin[ 2 ] = read_data( 5 );  
	
	new Float:vecOrigin[ 3 ];  
	IVecFVec( iOrigin, vecOrigin );  
	
	new Float:vecDirection[ 3 ];  
	velocity_by_aim( iPlayer, 5, vecDirection );  
	
	new Float:vecStop[ 3 ];  
	xs_vec_add( vecOrigin, vecDirection, vecStop );  
	
	xs_vec_mul_scalar( vecDirection, -1.0, vecDirection );  
	
	new Float:vecStart[ 3 ];  
	xs_vec_add( vecOrigin, vecDirection, vecStart );  
	
	engfunc( EngFunc_TraceLine, vecStart, vecStop, IGNORE_MONSTERS, -1, 0 );  
	
	get_tr2( 0, TR_vecPlaneNormal, vecDirection );  
	
	vecDirection[ 2 ] = 0.0;  
	
	xs_vec_normalize( vecDirection, vecDirection );  
	
	xs_vec_mul_scalar( vecDirection, 5.0, vecDirection );  
	
	xs_vec_add( vecOrigin, vecDirection, vecStart );  
	
	xs_vec_copy( vecStart, vecStop );  
	vecStop[ 2 ] -= 9999.0;  
	
	engfunc( EngFunc_TraceLine, vecStart, vecStop, IGNORE_MONSTERS, -1, 0 );  
	
	get_tr2( 0, TR_vecEndPos, vecStop );  
	
	new Float:FinalMeters;
	
	FinalMeters = (vecStart[ 2 ] - vecStop[ 2 ]) * 0.0254;
	
	SprayContestMeters[ iPlayer] = FinalMeters;
	
	AlreadySprayed[ iPlayer ] = true;
	
	ColorChat( 0 , "^3%s ^1Sprayed ^4%f ^1Meters from the ground" , UserName( iPlayer ) , FinalMeters )
}
and also how can i check if player using any button and if he is what button
daniel46 is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 06-04-2014 , 16:48   Re: 2 questions
Reply With Quote #2

I do not know if that's what you wanted, but see if works and add what you want.

PHP Code:
public EventSpray()
{    
    new 
iOrigin];
    
iOrigin] = read_data);
    
iOrigin] = read_data);
    
iOrigin] = read_data);
        
    new 
Float:fSprayOrigin];
    
IVecFVeciOriginfSprayOrigin );
    
    new 
client read_data);
    
    new 
Float:fPlayerOrigin];
    
get_user_originclientiOrigin);
    
IVecFVeciOriginfPlayerOrigin );
        
    new 
Float:fDirection];
    
xs_vec_subfSprayOriginfPlayerOriginfDirection );
    
xs_vec_mul_scalarfDirection10.0 vector_lengthfDirection ), fDirection );

    new 
Float:fStop];
    
xs_vec_addfSprayOriginfDirectionfStop );
    
xs_vec_mul_scalarfDirection, -1.0fDirection );
    
    new 
Float:fStart];
    
xs_vec_addfSprayOriginfDirectionfStart );
    
engfuncEngFunc_TraceLinefStartfStopIGNORE_MONSTERS, -1);
    
get_tr20TR_vecPlaneNormalfDirection );
    
fDirection] = 0.0;
    
    
xs_vec_mul_scalarfDirection5.0 vector_lengthfDirection ), fDirection );
    
xs_vec_addfSprayOriginfDirectionfStart );
    
xs_vec_copyfStartfStop );
    
fStop] -= 9999.0;
    
    
engfuncEngFunc_TraceLinefStartfStopIGNORE_MONSTERS, -1)
    
get_tr20TR_vecEndPosfStop )

    new 
Float:fSprayDistance fStart] - fStop];
    
    
ColorChat0RED"^3%s ^1Sprayed ^x04 %.3f ^1Meters from the ground."UserNameiPlayer ), fSprayDistance );
    
    return 
PLUGIN_CONTINUE;


Last edited by Fuck For Fun; 06-04-2014 at 16:50.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-04-2014 , 16:59   Re: 2 questions
Reply With Quote #3

It is not possible to determine which keyboard button a player is pressing. You can only know the commands sent to the server.

Also, the forum rule require that your topic title be descriptive. Please update your title to describe your question or issue. If you fail to do so, you risk your threads being trashed.

Also, only one topic per thread.
__________________

Last edited by fysiks; 06-04-2014 at 17:00.
fysiks is offline
daniel46
Senior Member
Join Date: Dec 2011
Old 06-04-2014 , 17:02   Re: 2 questions
Reply With Quote #4

sorry i ment all the IN_ how can i check what button of does he is pressing
daniel46 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-04-2014 , 17:05   Re: 2 questions
Reply With Quote #5

Search for get_user_button().

Also:

Quote:
Originally Posted by fysiks View Post
Also, the forum rule require that your topic title be descriptive. Please update your title to describe your question or issue. If you fail to do so, you risk your threads being trashed.

Also, only one topic per thread.
__________________
fysiks is offline
daniel46
Senior Member
Join Date: Dec 2011
Old 06-04-2014 , 17:12   Re: 2 questions
Reply With Quote #6

so can i do like this?

static Button;
Button = fm_get_user_button( client );

and then

if( Button != IN_MOVE )

cause i know you can do like this

if( Button & IN_MOVE )

for if yes but i want if no
daniel46 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-04-2014 , 17:18   Re: 2 questions
Reply With Quote #7

PHP Code:
if(!(Button IN_MOVE)) 
or
PHP Code:
if(PressedButton &= ~IN_MOVE
Idk if the syntax of the second way should be like this, probably some sign is wrong, but I think that's it.
__________________

Last edited by Flick3rR; 06-04-2014 at 17:19.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
daniel46
Senior Member
Join Date: Dec 2011
Old 06-04-2014 , 17:19   Re: 2 questions
Reply With Quote #8

what i want if negative like you do normaly !=
daniel46 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-04-2014 , 17:20   Re: 2 questions
Reply With Quote #9

I told you to search. All the information you need is available. Write your code based on the information you found. Test it. If you can't get it to work, start a new thread with an appropriate topic title with the full code that you were testing.

This is also the last warning before I lock this thread for fixing your topic title:

Quote:
Originally Posted by fysiks View Post
Also, the forum rules require that your topic title be descriptive. Please update your title to describe your question or issue. If you fail to do so, you risk your threads being trashed.
__________________
fysiks is offline
daniel46
Senior Member
Join Date: Dec 2011
Old 06-04-2014 , 17:26   Re: 2 questions
Reply With Quote #10

ok you can lock it if you say evrything is in there
daniel46 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:45.


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