Raised This Month: $ Target: $400
 0% 

Getting entity distance and hooking to USE


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OneMoreLevel
Senior Member
Join Date: Aug 2009
Location: Look behind you... Very
Old 10-24-2009 , 20:10   Getting entity distance and hooking to USE
Reply With Quote #1

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?
__________________
60/100 60%
[||||||||||||||||||||]
Project: Warfighter mod
Blog:
http://sites.google.com/site/dailymultitasker/
PHP Code:
   if ( i_help_you "Yes" ) == )
    
set_user_karma(onemorelevel,add,+1
OneMoreLevel is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-24-2009 , 20:14   Re: Getting entity distance and hooking to USE
Reply With Quote #2

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.
__________________
Arkshine is offline
OneMoreLevel
Senior Member
Join Date: Aug 2009
Location: Look behind you... Very
Old 10-24-2009 , 20:20   Re: Getting entity distance and hooking to USE
Reply With Quote #3

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.)
__________________
60/100 60%
[||||||||||||||||||||]
Project: Warfighter mod
Blog:
http://sites.google.com/site/dailymultitasker/
PHP Code:
   if ( i_help_you "Yes" ) == )
    
set_user_karma(onemorelevel,add,+1
OneMoreLevel is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-24-2009 , 20:38   Re: Getting entity distance and hooking to USE
Reply With Quote #4

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      } }
__________________
Arkshine is offline
Reply


Thread Tools
Display Modes

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 17:39.


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