funtion question
#1

Hello, how can I made a function to know X and Y coordonate around object pos with diameter off 5 units.
I know my pos I know object pos but how can I SetPlayerPos(Getplayerpos (x,y+1,z)
And the new player pos be an long circle?

P.S if I made that pos for many times the player need to rotate in round of object position (around of circle) with diameter 5 units
Reply
#2

i think that it's what you need:

Quote:

new Float:Pos[3];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
SetPlayerPos(playerid, Pos[0], Pos[1]+1, Pos[2]);

Reply
#3

Yes but this Position SetPlayerPos(playerid, Pos[0], Pos[1]+1, Pos[2]); need to be on the circle with diameter off 5 unit
Reply
#4

An example not sure what you exactly wanted
PHP код:
TeleportPlayerAroundObject(objectidFloatradius) {
    new
        
FloatX,
        
FloatY,
        
FloatZ
    
;
    if(
GetObjectPos(objectidXYZ)) {
        new
            
i,
            
count,
            
players[MAX_PLAYERS]
        ;
        for(
GetPlayerPoolSize(); >= 0; --i) {
            if(
IsPlayerConnected(i)) {
                
players[count++] = i;
            }
        }
        new
            
Floatstep 360.0 count
        
;
        for(
0count; (Floati) += step) {
            
SetPlayerPos(players[--count],
                
floatcos(Floatidegrees) * radius,
                
floatsin(Floatidegrees) * radius,
                
Z
            
);
        }
    }

Reply
#5

Yout function teleport me if I am in coord C teleport in D, if I am in A teleport me in D
I want if I am in A Teleport me in B
I want to teleport me to closet coord of circle

Reply
#6

Ah okay here you go
pawn Код:
TeleportPlayerToObject(playerid, objectid, Float: distance) {
    new
        Float: pX,
        Float: pY,
        Float: pZ
    ;
    if(GetPlayerPos(playerid, pX, pY, pZ)) {
        new
            Float: oX,
            Float: oY,
            Float: oZ
        ;
        if(GetObjectPos(objectid, oX, oY, oZ)) {
            pX -= oX;
            pY -= oY;
            pZ -= oZ;

            distance /= VectorSize(pX, pY, pZ);

            return SetPlayerPos(playerid,
                oX + pX * distance,
                oY + pY * distance,
                oZ
            );
        }
    }
    return false;
}
Reply
#7

THANK YOU VERY MUCH, IT WORKS
Reply
#8

I modiffied at the return SetPlyaerPos( "that operation " +1
But don't work. How can I make to TeleportPlayerToObject and auto rotating in round of object.
I want the player to rotate in round of object with this position and i put the value move.
Reply
#9

Quote:
Originally Posted by zeth98
Посмотреть сообщение
I modiffied at the return SetPlyaerPos( "that operation " +1
But don't work. How can I make to TeleportPlayerToObject and auto rotating in round of object.
I want the player to rotate in round of object with this position and i put the value move.
Could you rephrase that

1. Player gets teleported to the new position
2. Now he should rotate around the object ?

Than you need to use an timer which will rotate him by the given speed? Is this some kind of merry-go-round / carousel
Reply
#10

The function work god, and I put SetPlayerCameraPosLookAt "objectCoord" at a timer 20 miliseconds. And now I want to teleport me around object with 2meters
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)