How to circle players? (Players in a circle)
#1

Deleted.
Reply
#2

Deleted.
Reply
#3

Make random spawn positions near the rock in that interior, then when the player teleports there, set him to one of those positions.
Reply
#4

Well you will have to use SetPlayerPos some maths and loops.
I'll try this later if I have the time.
Reply
#5

pawn Code:
new counter = 0, perangle = 0, players[MAX_PLAYERS]; foreach( new i: Player ) { new Float:x, Float:y, Float:z; GetPlayerPos( playerid, x, y, z); if(IsPlayerInRangeOfPoint( i, RANGE, x, y, z)) {counter++; players[i] = 1;} } if( counter != 0 ) { perangle = 360/counter; } new Float: fangle; GetPlayerFacingAngle( playerid, fangle ); for( new m = 0; m <MAX_PLAYERS; m++ ) { new temp = 0; if( players[m] == 1 ) { temp =+ 1; SetPlayerPos( m, x + RANGE * floatcos( fangle + temp*perangle, degrees ), y + RANGE*floatsin(fangle + temp*perangle, degrees), z ); ...
Can someone check if this is the right way to go? I did it on a piece of paper and typed this on mobile. The indent would kill a programmer!
Reply
#6

Deleted.
Reply
#7

This function will get all players and place them in a circle around whoever used the function:
pawn Code:
// function by snoob
stock GetAllHere(playerid)
{
    new Float:Dpos[4];
    GetPlayerPos(playerid, Dpos[0], Dpos[1], Dpos[2]);
    new Dtotal;
    for (new i = 0; i<MAX_PLAYERS; i++) if(IsPlayerConnected(i)) Dtotal++;
    new Float:Dangle = floatdiv(360.0, Dtotal);
 
    new Dtick;
    new Dint = GetPlayerInterior(playerid);
    for (new i = 0; i<MAX_PLAYERS; i++)
    {
 
        if(i == playerid) continue;
        if(IsPlayerConnected(i))
        {
            TogglePlayerControllable(i, false);
            new Float:opp = (Dtick) ? (-Dpos[3]) : (Dpos[3]);
            SetPlayerPos(i,
                Dpos[0]+4.5*floatsin(opp,degrees),
                Dpos[1]+4.5*floatcos(opp,degrees),
                Dpos[2]);
            SetPlayerInterior(playerid, Dint);
            SetPlayerFacingAngle(i, floatsub(360.0, Dangle));
 
            SetPlayerCameraPos(i,
                Dpos[0]+7.5*floatsin(opp,degrees),
                Dpos[1]+7.5*floatcos(opp,degrees),
                Dpos[2]+5);
 
            SetPlayerCameraLookAt(i, Dpos[0], Dpos[1], Dpos[2]);
 
            Dpos[3] += Dangle;
 
            if(Dtick) Dtick = 0;
            else Dtick++;
        }
 
    }
    return 1;
}

//Usage:

CMD:getall(playerid, params[])
{
    GetAllHere(playerid);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)