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

How to get Aim position?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Minfas
Member
Join Date: Dec 2017
Old 08-07-2019 , 12:37   How to get Aim position?
Reply With Quote #1

Hi, I am new to sourcepawn and I want to spawn Marker at player's aim location.

What I am trying to do is something like this:
Spoiler


PHP Code:
public Action LookAtWeapon(int clientint args)
{
    if (
IsClientInGame(client) && IsPlayerAlive(client)) {
        
TE_SetupBeamRingPoint(const float center[3], 22gI_BeamSpritegI_HaloSprite0600.16.00.00color100);
    }
    return 
Plugin_Handled;

How to get center of the BeamRingPoint at player's aim location? I was searching a while but really I don't know.
Thanks for all replies.

Last edited by Minfas; 11-07-2019 at 01:54.
Minfas is offline
lugui
Senior Member
Join Date: Feb 2016
Location: GetClientAbsOrigin();
Old 08-08-2019 , 07:39   Re: How to get Aim position?
Reply With Quote #2

Can you clarify your question?
Do you want to know how to get the coordinates a player is lloking at?
Do you want to know how to position the beam centred where the player is looking at?
__________________
Add me for commissions!
Steam: [U:1:88621772]
Discord: lugui#0889
My Plugins
lugui is offline
Minfas
Member
Join Date: Dec 2017
Old 08-08-2019 , 09:21   Re: How to get Aim position?
Reply With Quote #3

Quote:
Originally Posted by lugui View Post
Can you clarify your question?
Do you want to know how to get the coordinates a player is lloking at?
Do you want to know how to position the beam centred where the player is looking at?
Yes I want the beam centered where the player is looking at.
Minfas is offline
lugui
Senior Member
Join Date: Feb 2016
Location: GetClientAbsOrigin();
Old 08-09-2019 , 08:07   Re: How to get Aim position?
Reply With Quote #4

try this: https://forums.alliedmods.net/showpo...92&postcount=3
__________________
Add me for commissions!
Steam: [U:1:88621772]
Discord: lugui#0889
My Plugins

Last edited by lugui; 08-09-2019 at 08:08. Reason: typo
lugui is offline
Minfas
Member
Join Date: Dec 2017
Old 08-10-2019 , 07:52   Re: How to get Aim position?
Reply With Quote #5

I dont know how to use it properly, it says new style declaration required.

Spoiler
Minfas is offline
farawayf
Senior Member
Join Date: Jan 2019
Old 08-10-2019 , 08:36   Re: How to get Aim position?
Reply With Quote #6

PHP Code:
bool TracePlayerAim(int clientfloat vec[3]) {
    if (!
IsClientInGame(client))
        return 
false;

    
float vecangles[3], vecorigin[3];
    
GetClientEyeAngles(clientvecangles);
    
GetClientEyePosition(clientvecorigin);

    
Handle traceray TR_TraceRayFilterEx(vecoriginvecanglesMASK_SHOT_HULLRayType_InfiniteTraceEntityFilterPlayers);
    if (
TR_DidHit(traceray)) {
        
TR_GetEndPosition(vectraceray);
        
delete traceray;

        return 
true;
    }
    
delete traceray;
    return 
false;
}

stock bool TraceEntityFilterPlayers(int entityint contentsMask) {
    return 
entity MaxClients;


Last edited by farawayf; 08-10-2019 at 08:40.
farawayf is offline
Minfas
Member
Join Date: Dec 2017
Old 08-10-2019 , 10:32   Re: How to get Aim position?
Reply With Quote #7

Problem solved. Thanks for help. ;)

Last edited by Minfas; 08-10-2019 at 16:46. Reason: It took some time
Minfas 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:06.


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