[+REP] Circle all - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [+REP] Circle all (
/showthread.php?tid=613988)
[+REP] Circle all -
Ahmed21 - 03.08.2016
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 ;(
Re: [+REP] Circle all - Quinncell - 03.08.2016
Well you can just add new positions that make a circle knd of like in minecraft hunger games.
Re: [+REP] Circle all -
Ahmed21 - 03.08.2016
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..
Re: [+REP] Circle all -
AbyssMorgan - 03.08.2016
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
Re: [+REP] Circle all -
Ahmed21 - 03.08.2016
Quote:
Originally Posted by AbyssMorgan
|
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.
Re: [+REP] Circle all -
Ahmed21 - 03.08.2016
B U M P
Re: [+REP] Circle all -
AbyssMorgan - 03.08.2016
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:
Re: [+REP] Circle all -
Shinja - 03.08.2016
Share your command tho.
And @Abyss, why you do
PHP код:
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
instead of just
PHP код:
for(new i = 0 i <= GetPlayerPoolSize(); i++)
?
Re: [+REP] Circle all -
[cS]Owain - 03.08.2016
Quote:
Originally Posted by Shinja
Share your command tho.
And @Abyss, why you do
PHP код:
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
instead of just
PHP код:
for(new i = 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.
Re: [+REP] Circle all -
Ahmed21 - 03.08.2016
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.