Raised This Month: $ Target: $400
 0% 

Give player a radius?


Post New Thread Reply   
 
Thread Tools Display Modes
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 12-06-2006 , 20:13   Re: Give player a radius?
Reply With Quote #11

I know i'm not very good with loops ;), i've looking over your code now Thanks hehe
hlstriker is offline
The Specialist
BANNED
Join Date: Nov 2006
Old 12-06-2006 , 20:22   Re: Give player a radius?
Reply With Quote #12

np. if you have any questions feel free to ask .also i have a qustion ? how long do you plan on running a foor loop ? continuously ? thats a bad way to do it. maybee use a client_PreThink . in my plugin i used a set task only becasue i wanted them punished every 2 seconds . you could use a client_PreThink.
The Specialist is offline
Send a message via AIM to The Specialist
stupok
Veteran Member
Join Date: Feb 2006
Old 12-06-2006 , 20:26   Re: Give player a radius?
Reply With Quote #13

How's this? Also, I have a question about find_sphere_class(). Does it find the entity closest to the player first? In that case, 32 should be 1 in the below code and the for() loop can be removed.
Code:
public check_radius(id) {     new radius = 100     new entlist[32]     new origin1[3], origin2[3]         get_user_origin(id, origin)     find_sphere_class(id,"player", float:radius, entlist, 32)     for(new i = 0; i <= 32; i++)     {         get_user_origin(i, origin2)         if(get_distance(origin1, origin2) > radius)         {             entity_set_int(id, EV_INT_solid, SOLID_NOT)         }         else         {             entity_set_int(id, EV_INT_solid, SOLID_BBOX)         }     } }
stupok is offline
The Specialist
BANNED
Join Date: Nov 2006
Old 12-06-2006 , 20:35   Re: Give player a radius?
Reply With Quote #14

um actually first i think it doesnt return indexs only the number . somebody correct me if im wrong ? but you can use a find_ent_sphere to get the # of ents then use that and a for with a get_distance to return the actual indexs . like so

Code:
new number_ents = find_sphere_class(id,"player",float: radius,maxents,32); for(new i = 0 ; i < number_ents ; ++i) {                 new indexs = find_distance(PlayerA,PlayerB); }

Last edited by The Specialist; 12-06-2006 at 20:43.
The Specialist is offline
Send a message via AIM to The Specialist
stupok
Veteran Member
Join Date: Feb 2006
Old 12-06-2006 , 20:48   Re: Give player a radius?
Reply With Quote #15

find_sphere_class

Next time look it up. In my example, "maxents" is 32.

Does it find the closest player first?
stupok is offline
The Specialist
BANNED
Join Date: Nov 2006
Old 12-06-2006 , 20:53   Re: Give player a radius?
Reply With Quote #16

like i said it doesnt return there index only the number of players around that entity .
The Specialist is offline
Send a message via AIM to The Specialist
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 12-06-2006 , 20:59   Re: Give player a radius?
Reply With Quote #17

Ok, it works now... but sometimes you can go right through players... and others you kind of chop through them like your getting BBOX then NOT off and on fast.

Here is the code i'm using, feel free to change stuff to make it work better
Code:
    new players[32];     new num;     get_players(players, num, "a");     for(new i = 0; i < num; i++) {         if( (is_user_alive(players[i]) && is_user_alive(id)) && (is_user_connected(players[i]) && is_user_connected(id)) ) {             if(!(players[i] == id)) {                 new distance;                 new origin1[3], origin2[3];                 new radius = 100;                                 get_user_origin(players[i], origin1);                 get_user_origin(id, origin2);                 distance = get_distance(origin1, origin2);                 if(distance < radius) {                     entity_set_int(players[i], EV_INT_solid, SOLID_NOT);                     entity_set_int(id, EV_INT_solid, SOLID_NOT);                 } else {                     entity_set_int(players[i], EV_INT_solid, SOLID_BBOX);                     entity_set_int(id, EV_INT_solid, SOLID_BBOX);                 }             }         }     }
hlstriker is offline
The Specialist
BANNED
Join Date: Nov 2006
Old 12-06-2006 , 21:02   Re: Give player a radius?
Reply With Quote #18

Give player a radius?12-06-06 08:56 PMdon't post if you don't know what you're talking about...

somebodys to much of a pussie to leave there name ? kiss my ass
The Specialist is offline
Send a message via AIM to The Specialist
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 12-06-2006 , 21:07   Re: Give player a radius?
Reply With Quote #19

That wasn't me : /, I really appreciate your help! I left you + karma earlier too
hlstriker is offline
The Specialist
BANNED
Join Date: Nov 2006
Old 12-06-2006 , 21:08   Re: Give player a radius?
Reply With Quote #20

Quote:
Originally Posted by hlstriker View Post
That wasn't me : /, I really appreciate your help! I left you + karma earlier too
I know , im still going to help even though alot people are idiots. they cant help it , its not there fualt there daddy touched them
The Specialist is offline
Send a message via AIM to The Specialist
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 06:59.


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