[+REP] Circle all
#1

Hello everyone, I have made a command for events, it brings everyone (lined up) to the admin's position. But I want a command to bring them in a circle, not in a line. All what I know is that we use sin and cos for it someone help plz ;(
Reply
#2

Well you can just add new positions that make a circle knd of like in minecraft hunger games.
Reply
#3

Quote:
Originally Posted by KeithCooper
Посмотреть сообщение
Well you can just add new positions that make a circle knd of like in minecraft hunger games.
Bro, it brings the players to the admin's position (the admin who circled the players), also I want an exact circle..
Reply
#4

You need random position in circle ?
PHP код:
GetRandomPointInCircle(Float:x,Float:y,Float:size,&Float:tx,&Float:ty); 
https://sampforum.blast.hk/showthread.php?tid=591010
Reply
#5

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
You need random position in circle ?
PHP код:
GetRandomPointInCircle(Float:x,Float:y,Float:size,&Float:tx,&Float:ty); 
https://sampforum.blast.hk/showthread.php?tid=591010
No, I want ID 0 comes first, then ID 1 is next to him and id 2 next to id 1 etc.. it will be in "for" function ofc.
Reply
#6

B U M P
Reply
#7

Example Code:
Код:
new max_players = 0, idx = 0;

for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++){
	if(IsPlayerConnected(i)){
		max_players++; //count players
	}
}
	
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++){
	if(IsPlayerConnected(i)){
		new Float:tx, Float:ty, Float:tz, Float:angle;
		
		GetRandomClockPos(x,y,z, 15.0, tx,ty,tz,angle,single_clock(max_players,idx));
		// center position distance
		
		SetPlayerPos(i,tx,ty,tz);
		SetPlayerFacingAngle(i,angle);
		SetCameraBehindPlayer(i);
		idx++;
	}
}
https://sampforum.blast.hk/showthread.php?tid=591010

Bird's-eye view:
Reply
#8

Share your command tho.

And @Abyss, why you do
PHP код:
for(new 0GetPlayerPoolSize(); <= ji++) 
instead of just
PHP код:
for(new 0 i <= GetPlayerPoolSize(); i++) 
?
Reply
#9

Quote:
Originally Posted by Shinja
Посмотреть сообщение
Share your command tho.

And @Abyss, why you do
PHP код:
for(new 0GetPlayerPoolSize(); <= ji++) 
instead of just
PHP код:
for(new 0 i <= GetPlayerPoolSize(); i++) 
?
Because in your case GetPlayerPoolSize() is called at every iteration of loop but in his only once.
So his way of doing it is faster overall.
Reply
#10

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
Example Code:
Код:
new max_players = 0, idx = 0;

for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++){
	if(IsPlayerConnected(i)){
		max_players++; //count players
	}
}
	
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++){
	if(IsPlayerConnected(i)){
		new Float:tx, Float:ty, Float:tz, Float:angle;
		
		GetRandomClockPos(x,y,z, 15.0, tx,ty,tz,angle,single_clock(max_players,idx));
		// center position distance
		
		SetPlayerPos(i,tx,ty,tz);
		SetPlayerFacingAngle(i,angle);
		SetCameraBehindPlayer(i);
		idx++;
	}
}
https://sampforum.blast.hk/showthread.php?tid=591010

Bird's-eye view:
Thank you a lot. I will try it when I'm on PC.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)