AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Looking at?.. (https://forums.alliedmods.net/showthread.php?t=17028)

DahVid 08-24-2005 17:56

Looking at?..
 
Well, I'm making a plugin but I can't really get a grasp on it.

I'm trying to figure out how to find the closest player who's looking at you, and you are looking at him..

Also, how do I get an entity for a player. My friend suggest that I use is_visible. Sounds logical (If theres not a better way) but I don't use engine much.

I was thinking its like..
new player=find_ent_by_class(-1,"Player")

Zenith77 08-24-2005 18:52

yea i think the ent thing is right...yoou could take a look at physic or w/e that name is from super hero mod...she does the exact samething(finds the closet player)...

Velocity36 08-24-2005 20:04

Code:
{     new id = parm[0]     new targetid, body         {         get_user_aiming(id, targetid, body)         if (targetid)         } }

Maybe?

DahVid 08-24-2005 20:07

I mean generally looking at -- that's positively aiming at..

Velocity36 08-24-2005 20:08

Yea..

LynX 08-24-2005 20:13

Yes, what this peep with pistol said.
get_user_aiming is what you need.

DahVid 08-24-2005 20:44

How would I tell if they were both looking at eachotheR? it's confusing the hell out of me.

Would I use a variable that checks all players? If so then how do i find the id of the original dude looking at the dude. I was going to do

if(equali(originalid,targetoflooker)) {

but i don't think it'll work or something. *sigh*

Zenith77 08-24-2005 21:00

Code:
{     new id = parm[0]     new targetid, body, targetid_other, body_other     new palyers[32]     new num[32]         {         get_user_aiming(id, targetid, body)         get_players(players, num, "a")         for( new i = 0; i<num; i++){              get_user_aiming(i ,targetid_other, body_other)              get_user_userid(i)              get_user_userid(id)        if(target_id == get_user_userid(i) && targetid_other == get_user_userid(i) ){           //bla bla bla.....            }           } }


something like that...not sure if this will work though...

DahVid 08-24-2005 21:05

I don't understand that code at all. I'm hoping it doesn't work because it looks very decapritated.

Zenith77 08-24-2005 21:06

well i coudnt really indent or anything cuz i amde it through the post :/


All times are GMT -4. The time now is 14:18.

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