AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_user_aiming,in range? (https://forums.alliedmods.net/showthread.php?t=60916)

fxfighter 09-16-2007 12:56

get_user_aiming,in range?
 
This get the user id when aimed but how do i make it
only if target is in range...

Code:


public Target(id)
{
    new aimed, body, team1, team2;
    get_user_aiming(id, aimed, body);
    team1 = get_user_team(id);
    team2 = get_user_team(aimed);
   
    if(team1 == team2)
    {
   
    }
}


Miczu 09-16-2007 13:42

Re: get_user_aiming,in range?
 
You could calculate distance between players by checking both origins (get_user_origin).

I'm not a PRO so wait for some better idea, it should be ther :p

Emp` 09-17-2007 01:27

Re: get_user_aiming,in range?
 
Code:

new distance
get_user_aiming(id, aimed, body, distance);

if(distance < YOUR_RANGE)
    //do stuff


XxAvalanchexX 09-17-2007 22:26

Re: get_user_aiming,in range?
 
Emp`, the distance parameter is the number of units to limit the check to. So all he needs to do is set that (the default is 9999). The return value of get_user_aiming is the distance between the player and the hit object.


All times are GMT -4. The time now is 16:09.

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