AlliedModders

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

v3x 04-23-2005 23:21

Distance
 
Alright.. for get_user_aiming(), what is the distance measured in?

Also, what would be the approximate distance between you and another player side by side?

EDIT:
Actually, I want to get the distance between 2 players. So I assume I'd use get_user_origin() and get_distance().

BioHazardousWaste 04-24-2005 00:06

Yeah.. I was wondering this as well. I give out a bonus 1 exp for a "long range" hit, which is >= 1500 units. But then, apparently I got a long range hit (according to debug chat) with a knife. But then.. my server I think is completely screwed up

Rosbief 04-24-2005 12:59

maybe
 
Code:

new userorigin[3]
get_userorigin(id , userorigin , 0)

new useroriginsecondperson[3]
get_userorigin(target , useroriginsecondperson , 0)

if ( get_distance(userorigin , useroriginsecondperson) <= 60 ) {
 // Code here
}

Something simular.
Offcourse you need to change the secondpersonorigin.
It's only a example

or more what you would like

Code:

new userorigin[3]
get_user_origin ( id , userorigin , 0 )

new target , body
get_user_aiming ( id, target, body, 9999 )

new targetorigin[3]
get_user_origin (target , targetorigin , 0)

if ( get_distance(userorigin , targetorigin) <= 60 ) {
 // Code here
}

Now the maximum distance is 9999 , but you can change that.
I'm not quite sure whats the distance side by side.
Maybe try somethim around 100.

Hope this helped :)

v3x 04-24-2005 14:50

Hmm, I was gonna use get_entity_distance().. Anywho, thanks.. This plugin will be interesting when I'm done. :D

Cronck 04-24-2005 15:02

Maybe someone could help me with this...

I need to make a heal function for my Mod. The users calls a command when pointing at a teammate, and it should heal him if the distance isn't very far.

get_user_aiming() // Does this return the id of the user its pointing at?
And how do i set the function only to be run if the distance is like a max of 2 meters?

Rosbief 04-24-2005 15:27

basicaly
 
you can just use the code i gave v3x.

Code:

new target , body
get_user_aiming ( id, target, body, 9999 )

set_user_health ( target , get_user_health(target) + 10 )

This does:

if person a looks at person b,
it gives person b +10 hp

v3x 04-24-2005 16:49

Could I use http://amxmodx.org/funcwiki.php?go=func&id=379 ?

Rosbief 04-25-2005 13:31

yes
 
yes that would work to

v3x 04-25-2005 15:26

Alright .. Would that work if a knife hit somebody? Like, id hit id2.

Rosbief 04-25-2005 18:25

well
 
don't know foir sure.
its two ents touching so if people touch dont know for sure if knife.

maybe make it like

on ent touching
if id has knife equipeed and attack button?
but don't know for sure.


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

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