SA-MP Forums Archive
Get dynamic objectid! - 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: Get dynamic objectid! (/showthread.php?tid=512289)



Get dynamic objectid! - Baltazar - 10.05.2014

So,... CreateDynamicObject() uses CreateObjectForPlayer() and it returns objectid, that is never greater than 1000. How do I get a REAL objectid of a dynamic object? Thanks


Re: Get dynamic objectid! - SickAttack - 10.05.2014

If you're going to use it within the script:
pawn Код:
new obj = CreateDynamicObject();



Re: Get dynamic objectid! - Lynn - 10.05.2014

There is no function such as;
GetObjectID so you have to do it yourself.
Such as;
pawn Код:
new ObjectID[10]; // 10 is the number of Objects.
ObjectID[0] = CreateDynamicObject();
ObjectID[1] = CreateDynamicObject();
ObjectID[2] = CreateDynamicObject();
//.......

Then,

CMD:gotoobject(playerid, params[])
{
    new string[128], object, Pos[3];
    if(sscanf(params, "d", object)) return SendClientMessage(playerid, C_WHITE, "USAGE: /gotoobject [ObjectID]");
    if(object == 1) // Object ID you typed.
    {
        GetDynamicObjectPos(Object[0], Pos[0], Pos[1], Pos[2]); // Gets the Objects Position.
        SetPlayerPos(playerid, Pos[0]-2, Pos[1], Pos[2]); // Sets the player away from the object.
    }
    else if(object == 2) // Object ID you typed.
    {
        GetDynamicObjectPos(Object[1], Pos[0], Pos[1], Pos[2]); // Gets the Objects Position.
        SetPlayerPos(playerid, Pos[0]-2, Pos[1], Pos[2]); // Sets the player away from the object.
    }
    //.....................
    return 1;
}



Re: Get dynamic objectid! - Baltazar - 10.05.2014

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
If you're going to use it within the script:
pawn Код:
new obj = CreateDynamicObject();
Nah, this objectid can be as great as you wish. But there is never more than 1000 player objects streamed, so... how do I get REAL objectid, this one is fake.

Quote:
Originally Posted by Lynn
There is no function such as;
GetObjectID