Circle teleports..
#1

Hello,

I' need your help guys so, I would like to create a command who will teleport a players around a others players. Like, he was turned like a circle.



* blue = a simple player
* red = the trajector the other players will do when I type a commands.

- btw : I would like to know how it's possible to freeze a players but he can aim a another players?

Sorry for bad english.
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=470318

pawn Код:
// 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;
}
I see this script, but how I can implement it for one players?
Reply
#3

Uuup
Reply
#4

pawn Код:
teleportAllAroundPlayer(playerid, Float: radius, ...) // Made by RajatPawar - no biggie
{
    new Float: pX, Float: pY, Float: pZ, totPlayers = (numargs() - 2), Float: pAngle;
    GetPlayerPos(playerid, pX, pY, pZ);
    GetPlayerFacingAngle(playerid, pAngle);

    new offSet = floatround((360 / totPlayers));

    for(new i = 2; i < numargs(); i++)
        SetPlayerPos(getarg(i), (pX + (radius * floatcos( - (pAngle + offSet), degrees ))), (pY + ( radius * floatsin( - (pAngle + offSet), degrees ))), pZ);


    return 1;
}
I just made this, it should work. I haven't tested it since I am not on a GTA: SA enabled PC, but the usage works like -

pawn Код:
teleportAllAroundPlayer(playerid, 5.0, 1, 5, 6, 7);
This should teleport players with IDs 1, 5, 6 & 7 around player with player ID as 'playerid' in a circle of radius 5 units.
Lowercase, because I like it like that sometimes. You can declare 'offSet' as a float and remove the floatround to improve the accuracy. Also, you can use Mapandreas to get the correct Z co-ordinate for the NEW position of each player TOO. If that's the case, I'll edit it later on your request.
Reply
#5

Thanks Rajat,

But how I can do like this.. /cmd <ID> will teleport 1 player (who the guys is aiming).

Ex.
My id: 3
Id: 1 is aiming me.
*a guys type /cmd 3*
Teleport me around id:1
Reply
#6

Any idea?
Reply
#7

uupppppppppp
Reply
#8

Use GetPlayerTargetPlayer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)