Raised This Month: $ Target: $400
 0% 

2 questions!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
atomic
Veteran Member
Join Date: Jan 2005
Location: What The Foot?
Old 11-03-2005 , 10:42   2 questions!
Reply With Quote #1

1.how do i get all players that is a specific radius!

2. how do i get the person that im looking at (in my crosshair)

im making a mod
__________________
atomic is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 11-03-2005 , 10:55  
Reply With Quote #2

1) Something like this:
Code:
#define DISTANCE  999 // Edit this to w/e you want new g_iOrigins[33][3]; new g_iPlace[3] = { 2398, 281, 3 } // Edit this to the origin you want public MyFunc() {   new iPlayers[32]   new iNum, iDistance;   get_players(iPlayers, iNum, "a");   for(new i = 0; i <= iNum; i++)   {     new id = iPlayers[i];     if(!is_user_connected(id)) continue;     get_user_origin(id, g_iOrigins[id], 0);     iDistance = get_distance(g_iOrigins[id], g_iPlace);     if(iDistance <= DISTANCE)     {       client_print(id, 3, "Hooray, you're close!");     }     else     {       client_print(id, 3, "Ah crap, you're not close!");     }   } }
2) I think get_user_aiming should work..
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
atomic
Veteran Member
Join Date: Jan 2005
Location: What The Foot?
Old 11-03-2005 , 11:12  
Reply With Quote #3



so if i want to ... for example... slap the user im looking at...how would i do that
__________________
atomic is offline
LynX
Veteran Member
Join Date: Oct 2004
Old 11-03-2005 , 11:14  
Reply With Quote #4

There is easier way v3x.

Code:
new origin[3], eOrigin[3]; new Float:vel[3]; get_user_origin( id, origin ); new players[32]; new num, player; get_players(players, num, "a");   for (new i = 0; i < num; i++) {     player = players[i];               if( player != id ) {                 //Check their range.         get_user_origin( player, eOrigin );                 if( get_distance( origin, eOrigin ) <= distance ) // distance = any number you specify         {               // do stuff here         }     } }

Also, get_user_aiming shall be enough for you second question.
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 11-03-2005 , 11:18  
Reply With Quote #5

Code:
public MyFunc( id ) {   new index, tmp;   get_user_aiming(id, index, tmp);   if(!is_user_connected(index) || !is_user_alive(index))   {     client_print(id, 4, "You're not aiming at someone");   }   else   {     new szUserName[33];     get_user_name(index, szUserName, 32);     client_print(id, 4, "Slapped %s", szUserName);     user_slap(index, 0);   } }
Should work

Edit: LynX, he's not talking about getting the distances between 2 players. At least I don't think he is..
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
LynX
Veteran Member
Join Date: Oct 2004
Old 11-03-2005 , 11:26  
Reply With Quote #6

Don't ask me, I just posted mine pushaway code ( removed the pushaway from it )
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-03-2005 , 14:14  
Reply With Quote #7

1.
Code:
while((ent = find_ent_in_sphere(ent,origin,radius)) != 0) {     if(!is_user_connected(ent)) continue;  }

2.
Code:
new ent, body;  get_user_aiming(id,ent,body);

Shorter alternatives for the win. Seriously, we have find_ent_in_sphere for a reason, use it.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
atomic
Veteran Member
Join Date: Jan 2005
Location: What The Foot?
Old 11-03-2005 , 15:02  
Reply With Quote #8

Code:
new ent, body;  get_user_aiming(id,ent,body);

so if i want to do something with that person im aiming at, what is the person called... id??



Code:
new ent, body; get_user_aiming(id,ent,body); } client_print (id, "im watching you") }
just an example..the } { is total wrong
__________________
atomic is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 11-03-2005 , 15:23  
Reply With Quote #9

It'd be "ent".
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
atomic
Veteran Member
Join Date: Jan 2005
Location: What The Foot?
Old 11-03-2005 , 15:47  
Reply With Quote #10

__________________
atomic is offline
Reply



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 23:40.


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