open.mp forum
[Pawn] Help with safe box system - 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] Help with safe box system (/showthread.php?tid=2115)



Help with safe box system - JR_Junior - 2021-06-16

I'm trying to create a closed and open door safe box?system.

I would like to be able to create a safe box anywhere and automatically have the door positioned correctly.

Does anyone know the correct calculation for this?


PHP Code:
new safe =?CreateDynamicObject(19618414.470702537.359139.45900,? 0.000000.0000090.00000);
new 
door =?CreateDynamicObject(19619414.704012536.938489.45800,? 0.000000.0000090.00000); 

The function I intend to use:
PHP Code:
stock CreateSafeBox(Float:px,Float:py,Float:pz,Float:rz)
{
CreateDynamicObject(pxpypz0.00.0rz);//Safe
CreateDynamicObject(pxpypz0.00.0rz);//Door
return 1;




RE: Help with safe box system - Awide - 2021-06-17

I think it wouldn't work once you start rotating them.


RE: Help with safe box system - JR_Junior - 2021-06-17

(2021-06-17, 07:52 PM)Awide Wrote: I think it wouldn't work once you start rotating them.

it's not about rotation, it's about position.


RE: Help with safe box system - Kwarde - 2021-06-17

Quote:I would like to be able to create a safe box anywhere and automatically have the door positioned correctly.



Does anyone know the correct calculation for this?

I think the easiest way to do that is to create the safe at position 0,0,0 and then use the position of the door (once placed correctly) as your offset.

And check those offsets off course when the safe is rotated differently. Apart from that I wouldn't know a `correct calculation` for that.


RE: Help with safe box system - Radical - 2021-06-18

You can't calculate the position of the door correctly.

But instead you can use the object model 2332.

You can also change the object model to 1829 when the player opens safe box.



2332 -?[Image: 2332_b.jpg]



1829 -?[Image: 1829_b.jpg]


RE: Help with safe box system - JR_Junior - 2021-06-18

(2021-06-18, 01:11 AM)Radical Wrote: You can't calculate the position of the door correctly.

But instead you can use the object model 2332.

You can also change the object model to 1829 when the player opens safe box.



2332 -?[Image: 2332_b.jpg]



1829 -?[Image: 1829_b.jpg]



I can't read what you wrote after You can't. You are saying this is impossible and not true!


RE: Help with safe box system - PutuSuhartawan - 2021-06-19

MoveDynamicObject ?


RE: Help with safe box system - JR_Junior - 2021-06-19

I finally found the solution!


RE: Help with safe box system - Kwarde - 2021-06-20

(2021-06-19, 11:52 PM)JR_Junior Wrote: I finally found the solution!

You should share the solution so that if anyone faces the same thing one day they won't have to re-ask.