Retrieve position of an object
#1

Hello,

I created a small function that creates an object, I would like to retrieve the position of the object for a command to see if the player is ready or not this object.

pawn Код:
if(strcmp(subcmd, "haha", true) == 0)
{
    if(IsPlayerInRangeOfPoint(playerid, 8.0, info[playerid][bObjet1], info[playerid][bObjet2], adavre_info[playerid][bObjet3]))
    {
        ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.1,0,1,1,1,1);
        FreezePlayer(playerid,"Freeze");
    }
    else
    {
        SendClientMessage(playerid, COLOR_JOB, "no position object");
    }
}
Here by the creation of the object

pawn Код:
o1[playerid] = CreateDynamicObject(2900,posX-0.16,posY+0.49,posZ-0.95,0.0,0.0,0.0,-1,-1,-1,250);
    o2[playerid] = CreateDynamicObject(2900,posX+0.29,posY+0.31,posZ-0.95,0.0,180.0,330.68,-1,-1,-1,250);
    o3[playerid] = CreateDynamicObject(2900,posX-0.05,posY-0.36,posZ-0.95,0.0,0.0,0.0,-1,-1,-1,250);

    info[playerid][bObjet1] = o1[playerid];
    info[playerid][bObjet2] = o2[playerid];
    info[playerid][bObjet3] = o3[playerid];

thank you for aid future
Cordialement,
Drek.
Reply
#2

If you mean what I think you mean:

Use GetObjectPos, GetDynamicObjectPos in your case.

pawn Код:
new Float:objectx, Float:objecty, Float:objectz;
GetDynamicObjectPos( /* Objectid goes here, lets say*/ o1[playerid],  objectx, objecty, objectz );

// So you can do this
if(IsPlayerInRangeOfPoint(playerid, 8.0, objectx, objecty, objectz))
Reply
#3

Thank you for the quick response.

but instead of / * ObjectID goes here, lets say * /
Sence I put what.
Sorry I'm not English: s
Reply
#4

That's the parameter where you put the object id, like for example o1[playerid].

GetDynamicObjectPos( o1[playerid], objectx, objecty, objectz );
Reply
#5

+1 reput.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)