• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Help with safe box system
#1
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;

  Reply
#2
I think it wouldn't work once you start rotating them.
Check out Desolation Roleplay, where zombie AI and scavenging is bothered by player bandits!


  Reply
#3
(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.
  Reply
#4
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.
  Reply
#5
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]
  Reply
#6
(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!
  Reply
#7
MoveDynamicObject ?
  Reply
#8
I finally found the solution!
  Reply
#9
(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.
  Reply


Forum Jump: