Well you can just add new positions that make a circle knd of like in minecraft hunger games.
Posts: 1,208
Threads: 36
Joined: Apr 2015
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
Posts: 1,208
Threads: 36
Joined: Apr 2015
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:
Posts: 79
Threads: 2
Joined: Dec 2010
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.