AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Getting entity distance and hooking to USE (https://forums.alliedmods.net/showthread.php?t=107280)

OneMoreLevel 10-24-2009 20:10

Getting entity distance and hooking to USE
 
How can I figure out if someone (Anyone), is within 50 units of the entity I created, and how can I make it so that when they are, and when they press the USE key, a menu pops up?

Arkshine 10-24-2009 20:14

Re: Getting entity distance and hooking to USE
 
You can use get_distance or get_distance_f to evaluate the distance between 2 origins.

About the USE, hook Ham_ObjectCaps and check if the button ( IN_USE ) is used. ( get_user_button ) Then you can your menu.

OneMoreLevel 10-24-2009 20:20

Re: Getting entity distance and hooking to USE
 
I dont use ham often and I dont think I understand get_distance.

Mind showing me? (It's not that Im lazy and Im asking for the code to be handed to me, I am just interested in how to do it.)

Arkshine 10-24-2009 20:38

Re: Getting entity distance and hooking to USE
 
http://www.amxmodx.org/funcwiki.php?go=func&id=791

About Ham something like :

Code:
RegisterHam( Ham_ObjectCaps, "player", "Forward_ObjectCaps", 1 ); // public Forward_ObjectCaps ( const Player ) {      if ( get_user_button( Player ) & IN_USE )      {          // Call your menu here      } }


All times are GMT -4. The time now is 17:39.

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