Find players near given origin?>
Hey, I'm just wondering How would I find players (i dont need index, just amount is enough) within given origin. Basically, let's say the origin is 0.0.0 and I want to find if there is any players within 500m near the origin. So, if the origin is 0.0.0 but a player is at 499.0.0 it would detect him, but if he would be at 501.0.0 it wouldnt. How can i do that?
|
Re: Find players near given origin?>
Well, there is several ways.
- Using one native : new playersList[32]; new playersCount = find_sphere_class( 0, "player", RADIUS, playersList, sizeof playersList, ORIGIN ); - Possible to loop with find_ent_in_sphere() and counting. -There is also looping among all players and checking each origin distance. The first is probably the most efficient. |
Re: Find players near given origin?>
Thank you Arkshine :D
I will try it, if I get any problems I will reply back :D Cheers! |
Re: Find players near given origin?>
new playersCount = find_sphere_class( 0, "player", 500.0, playersList, sizeof playersList, origin );
It gives me tag mismatch error when compiling. |
Re: Find players near given origin?>
what is "origin" ? It should be a Float.
|
Re: Find players near given origin?>
It location that is read from file.
set_user_origin(id, origin) works. origin[0] = str_to_num(a) origin[1] = str_to_num(b) origin[2] = str_to_num(c) this is what i use to get the origin How can I transform the origin[0/1/2] to a float? |
Re: Find players near given origin?>
Make origin a float.
new Float:origin[3]; and use str_to_float(a) etc. |
Re: Find players near given origin?>
new float:porigin[3];
porigin[0] = str_to_float(a); porigin[1] = str_to_float(b); porigin[2] = str_to_float(c); It gives me tag mismatch error on porigin[*] = str_to_float(*); For each one. What am I doing wrong here, can't seem to figure out |
Re: Find players near given origin?>
Float: not float:
Case is sensitive. |
Re: Find players near given origin?>
That fix the issue. Thank you very much!
|
| All times are GMT -4. The time now is 15:54. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.