SA-MP Forums Archive
GetObjectPos returns 0.000.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: GetObjectPos returns 0.000.. (/showthread.php?tid=285978)



GetObjectPos returns 0.000.. - Lorenc_ - 26.09.2011

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;'


Re: GetObjectPos returns 0.000.. - aRoach - 26.09.2011

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;
}



Re: GetObjectPos returns 0.000.. - Raimis_R - 26.09.2011

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 );



Re: GetObjectPos returns 0.000.. - Lorenc_ - 26.09.2011

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.


Re: GetObjectPos returns 0.000.. - Raimis_R - 26.09.2011

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



Re: GetObjectPos returns 0.000.. - MP2 - 26.09.2011

Don't object ids start at 1?


Re: GetObjectPos returns 0.000.. - Lorenc_ - 26.09.2011

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

rep++;