open.mp forum
[Pawn] [Sorted out] Update attached objects - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] [Sorted out] Update attached objects (/showthread.php?tid=2074)



[Sorted out] Update attached objects - Otakeiro - 2021-06-02

Pretendo fazer uma StroboLights para ve?culos, vou usar luzes para o prot?tipo.

?Eu uso o Streamer para criar objetos din?micos e anex?-los, mas ... como atualizar a posi??o dos objetos anexados sem destru?-los e recri?-los?

?por exemplo, haveria alguma maneira de fazer um "UpdateAttachedDynamicObjectPos"?


RE: Update attached objects - Pinch - 2021-06-02

Hi, Otakeiro.

You can try using this :)



E_STREAMER_ATTACH_R_X,

E_STREAMER_ATTACH_R_Y,

E_STREAMER_ATTACH_R_Z,

E_STREAMER_ATTACH_X,

E_STREAMER_ATTACH_Y,

E_STREAMER_ATTACH_Z




native Streamer_SetFloatData(type, STREAMER_ALL_TAGS:id, data, Float:value);.



Example:

Code:
Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_X, 2.0);



RE: Update attached objects - Radical - 2021-06-02

UpdateAttachedDynamicObjectPos(objectid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz);



Code:
UpdateAttachedDynamicObjectPos(objectid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz) {

? ?

? ? Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_X, x);

? ? Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_Y, y);

? ? Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_Z, z);

? ? Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_R_X, rx);

? ? Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_R_Y, ry);

? ? Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_R_Z, rz);

}



RE: Update attached objects - Otakeiro - 2021-06-02

(2021-06-02, 08:58 AM)Radical Wrote: UpdateAttachedDynamicObjectPos(objectid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz);

Code:
UpdateAttachedDynamicObjectPos(objectid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz) {
? ?
? ? Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_X, x);
? ? Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_Y, y);
? ? Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_Z, z);
? ? Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_R_X, rx);
? ? Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_R_Y, ry);
? ? Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_R_Z, rz);
}
You both lighted my way, thank you both!


RE: Update attached objects - Pinch - 2021-06-02

(2021-06-02, 08:58 AM)Radical Wrote: UpdateAttachedDynamicObjectPos(objectid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz);



Code:
UpdateAttachedDynamicObjectPos(objectid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz) {

? ?

? ? Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_X, x);

? ? Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_Y, y);

? ? Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_Z, z);

? ? Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_R_X, rx);

? ? Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_R_Y, ry);

? ? Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_R_Z, rz);

}



No problem, here you can check everything else you can change, pretty cool right?! :D