Raised This Month: $ Target: $400
 0% 

Solved [HELP] Player Aim At Entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DarthMan
Veteran Member
Join Date: Aug 2011
Old 03-09-2017 , 13:27   Re: [HELP] Player Aim At Entity
Reply With Quote #1

Quote:
Originally Posted by Kotoamatsukami View Post
First of all, I am just trying to help here and if this still doesn't help, I am sorry.

I will explain here what I am trying to do. Firstly, catch what the 'id' is aiming, and save the aimed target into 'iEnt'. Then, I check in the while loop if the aimed index( iEnt ) is equal to the entity that the user wanted to aim( ent ). So, I check it( ent == iEnt ). If it's equal then show the HUD message that you wanted to show to the user.

I might be wrong but any improvement or rectification towards my code is greatly welcomed.
Thank you..
PHP Code:
public display_map_nameid )
{
    new 
iEntbodyentlist32 ], panel
    
    get_user_aiming
idiEntbody50 )
    
    while( ( 
ent find_ent_by_tnameent"target_map" ) ) !=)
    {
        if ( 
is_user_connectedid ) && ent == iEnt )
        {
            
set_hudmessageg_hud_colour], g_hud_colour], g_hud_colour], -1.0, -1.000.02.00.00.0)
            
show_hudmessageentlistent ], g_mapnamesg_mapselectionpanel ] ] )
        }
        
    
panel++
    }    

I fixed the warning, but it sitll doesn't work.

Code:
public display_map_name( id )
{
    new iEnt, body, entlist[ 32 ], panel
    
    while( ( ent = find_ent_by_tname( ent, "target_map" ) ) !=0 )
    {
        if ( is_user_connected( id ) && ent == iEnt && get_user_aiming( id, iEnt, body, 50 ) )
        {
            set_hudmessage( g_hud_colour[ 0 ], g_hud_colour[ 1 ], g_hud_colour[ 2 ], -1.0, -1.0, 0, 0.0, 2.0, 0.0, 0.0, 2 )
            show_hudmessage( entlist[ id ], g_mapnames[ g_mapselection[ panel ] ] )
        }
        
        panel++
    }    
}
DarthMan is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 03-09-2017 , 14:08   Re: [HELP] Player Aim At Entity
Reply With Quote #2

Code:
public display_map_name( i_Client )
{
	if ( ! is_user_connected( i_Client )  ||  ! is_user_alive( i_Client ))
	return;
	new i_Body, i_Target;	
	get_user_aiming( i_Client, i_Target, i_Body, 100 )

	if( pev_valid( i_Target ) != 2 )
	return;
	
	static sz_tname[ 32 ]; 
	pev( i_Target, pev_targetname, sz_tname, 31 )
	
	if ( !( equal( sz_tname, "target_map" ) ) )
		return;
	
	set_hudmessage( g_hud_colour[ 0 ], g_hud_colour[ 1 ], g_hud_colour[ 2 ], -1.0, -1.0, 0, 0.0, 2.0, 0.0, 0.0, 2 )
	show_hudmessage( i_Client, "Test" ) 
}
Still doesn't work
DarthMan 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 17:46.


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