GetObjectPos returns 0.000..
#1

Hey,

I'm trying to make something that can repair a glitch in to my minecraft script. In to do so, I needed to retrieve the location of the object so I wrote this code:

pawn Код:
for(new i; i < MAX_OBJECTS; i++)
    {
        GetObjectPos(i, oX, oY, oZ);
        printf("%f, %f, %f", oX, oY, oZ);
        break;
    }
I stopped and tested in-game and all it does is print "0.00000, 0.00000, 0.00000"... I've been searching for a fix for this for awhile and I don't really know what to do. I've also used streamer.inc and it still occurs.

Does anyone have a clue? I might be breaking the loop to early perhaps. Not sure, It even occurs when I put continue; instead of break;

If anyone has a fix, it'd be grateful.

EDIT: Still doesn't work even without 'continue;' nor 'break;'
Reply
#2

Are you using Incognito's Streamer ?
If yes, try this:
pawn Код:
for( new OBJ = 0; OBJ < MAX_OBJECTS; OBJ ++ )
{
    GetDynamicObjectPos( OBJ, oX, oY, oZ );
    printf( "%f, %f, %f", oX, oY, oZ );
    break;
}
Reply
#3

If you using break; you just will get 1 Object pos with ID: 0


Quote:
Originally Posted by aRoach
Посмотреть сообщение
Are you using Incognito's Streamer ?
If yes, try this:
pawn Код:
for( new OBJ = 0; OBJ < MAX_OBJECTS; OBJ ++ )
{
    GetDynamicObjectRot( OBJ, oX, oY, oZ );
    printf( "%f, %f, %f", oX, oY, oZ );
    break;
}
Dynamic Object Rot? Lol

Do you mean

pawn Код:
GetDynamicObjectPos( OBJ, oX, oY, oZ );
Reply
#4

Quote:
Originally Posted by Raimis_R
Посмотреть сообщение
If you using break; you just will get 1 Object pos with ID: 0




Dynamic Object Rot? Lol

Did you mean

pawn Код:
GetDynamicObjectPos( OBJ, oX, oY, oZ );
I've tried without it as well.
Reply
#5

You using default objects?

I mean "CreateObject"

You can try "debug" objects

pawn Код:
stock CreateObjectEx(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:Distance = 100.0)
{
    printf("Creating New Object: ModelID: %i || X: %f || Y: %f || Z: %f", modelid, X, Y, Z);
    return CreateObject(modelid, X, Y, Z, rX, rY, rZ, Distance);
}

#define CreateObject CreateObjectEx
Reply
#6

Don't object ids start at 1?
Reply
#7

Quote:
Originally Posted by MP2
Посмотреть сообщение
Don't object ids start at 1?
Thanks man

rep++;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)