AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   How to get Aim position? (https://forums.alliedmods.net/showthread.php?t=317983)

Minfas 08-07-2019 12:37

How to get Aim position?
 
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.

lugui 08-08-2019 07:39

Re: How to get Aim position?
 
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?

Minfas 08-08-2019 09:21

Re: How to get Aim position?
 
Quote:

Originally Posted by lugui (Post 2662447)
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.

lugui 08-09-2019 08:07

Re: How to get Aim position?
 
try this: https://forums.alliedmods.net/showpo...92&postcount=3

Minfas 08-10-2019 07:52

Re: How to get Aim position?
 
I dont know how to use it properly, it says new style declaration required.

Spoiler

farawayf 08-10-2019 08:36

Re: How to get Aim position?
 
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;



Minfas 08-10-2019 10:32

Re: How to get Aim position?
 
Problem solved. Thanks for help. ;)


All times are GMT -4. The time now is 12:11.

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