PDA

View Full Version : Get dynamic objectid!


Baltazar
10/05/2014, 03:59 AM
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

SickAttack
10/05/2014, 04:08 AM
If you're going to use it within the script:
new obj = CreateDynamicObject();

Lynn
10/05/2014, 04:10 AM
There is no function such as;
GetObjectID so you have to do it yourself.
Such as;

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

Baltazar
10/05/2014, 04:10 AM
If you're going to use it within the script:
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.

There is no function such as;
GetObjectID http://img2.wikia.nocookie.net/__cb20120316183401/glee/images/5/55/Okay-meme_reasonably_small-1-.jpg