Raised This Month: $51 Target: $400
 12% 

Make a circle with players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
uurbyrkdr
Senior Member
Join Date: Apr 2015
Old 10-09-2015 , 11:09   Make a circle with players
Reply With Quote #1

Hi.
I want to make a circle with players.
It must be depended to number of players.
For X players, i want to teleport them client's x and y coordinates based circle (z is constant).

For example, if 4 player avaible for teleport, them will teleport to;
(X - 100 , Y)
(X + 100 , Y)
(X , Y - 100)
(X , Y + 100)

it's a example only. if there're 5 avaible players, we must make like a pentagon.

is there any way to do this, or is is possible for me?
Thanks for helps..
uurbyrkdr is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 10-09-2015 , 12:28   Re: Make a circle with players
Reply With Quote #2

(sin(pi * 2 * i / 5) * 100, cos(pi * 2 * i / 5) * 100) where i = 1 through 5 makes a pentagon with 100 unit radius
Miu is offline
uurbyrkdr
Senior Member
Join Date: Apr 2015
Old 10-10-2015 , 08:45   Re: Make a circle with players
Reply With Quote #3

Is it can use for every X number?
I mean, if we have 4 players for teleport, it must be like a square.
If we have 5 players, it must be like a pentagon.
How can i do this?
uurbyrkdr is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 10-10-2015 , 09:12   Re: Make a circle with players
Reply With Quote #4

yes, (sin(pi * 2 * i / n) * d, cos(pi * 2 * i / n) * d) where n is the number of players makes an n-sided regular polygon with d radius, that's what I was trying to get across, sorry
Miu is offline
uurbyrkdr
Senior Member
Join Date: Apr 2015
Old 10-11-2015 , 06:04   Re: Make a circle with players
Reply With Quote #5

okey, how can i use sin&cos with code?
i searched but couldn't found :/
uurbyrkdr is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-11-2015 , 07:10   Re: Make a circle with players
Reply With Quote #6

type in search field
https://sm.alliedmods.net/new-api/float/Sine
__________________
Do not Private Message @me
Bacardi is offline
uurbyrkdr
Senior Member
Join Date: Apr 2015
Old 10-11-2015 , 07:12   Re: Make a circle with players
Reply With Quote #7

thank you!
uurbyrkdr is offline
thecount
Veteran Member
Join Date: Jul 2013
Old 10-15-2015 , 11:26   Re: Make a circle with players
Reply With Quote #8

Also, this assumes that the center is 0,0. To change the center just add it on to the coordinates like (sin(...) + offset, cos(...) + offset)
thecount 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 01:02.


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