Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] Help with safe box system

 
  • 0 Vote(s) - 0 Average
Pawn Help with safe box system
JR_Junior
Offline

Burgershot Member
Posts: 20
Threads: 7
Joined: Oct 2020
Reputation: 0
Location: Brasil
#1
2021-06-16, 09:49 PM (This post was last modified: 2021-06-17, 08:26 PM by JR_Junior.)
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(19618, 414.47070, 2537.35913, 9.45900,  0.00000, 0.00000, 90.00000);
new 
door = CreateDynamicObject(19619, 414.70401, 2536.93848, 9.45800,  0.00000, 0.00000, 90.00000); 

The function I intend to use:
PHP Code:
stock CreateSafeBox(Float:px,Float:py,Float:pz,Float:rz)
{
CreateDynamicObject(px, py, pz  0.0, 0.0, rz);//Safe
CreateDynamicObject(px, py, pz  0.0, 0.0, rz);//Door
return 1;
} 
Awide
Offline

Burgershot Member
Posts: 62
Threads: 5
Joined: Sep 2019
Reputation: 5
#2
2021-06-17, 07:52 PM
I think it wouldn't work once you start rotating them.
Desolation Roleplay has closed. You can download the gamemode here: https://www.burgershot.gg/showthread.php?tid=2272
JR_Junior
Offline

Burgershot Member
Posts: 20
Threads: 7
Joined: Oct 2020
Reputation: 0
Location: Brasil
#3
2021-06-17, 08:21 PM
(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.
Kwarde
Offline

Burgershot Member
Posts: 99
Threads: 2
Joined: Sep 2020
Reputation: 8
Location: The Netherlands
#4
2021-06-17, 09:48 PM
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.
Radical
Offline

Burgershot Member
Posts: 148
Threads: 21
Joined: Dec 2020
Reputation: 16
#5
2021-06-18, 01:11 AM (This post was last modified: 2021-06-18, 01:16 AM by Radical.)
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]
JR_Junior
Offline

Burgershot Member
Posts: 20
Threads: 7
Joined: Oct 2020
Reputation: 0
Location: Brasil
#6
2021-06-18, 03:22 PM
(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!
PutuSuhartawan
Offline

Burgershot Member
Posts: 120
Threads: 52
Joined: Nov 2020
Reputation: 1
Location: Indonesia
#7
2021-06-19, 01:08 AM
MoveDynamicObject ?
JR_Junior
Offline

Burgershot Member
Posts: 20
Threads: 7
Joined: Oct 2020
Reputation: 0
Location: Brasil
#8
2021-06-19, 11:52 PM
I finally found the solution!
Kwarde
Offline

Burgershot Member
Posts: 99
Threads: 2
Joined: Sep 2020
Reputation: 8
Location: The Netherlands
#9
2021-06-20, 08:57 PM
(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.
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode