MxPrime Posted June 30, 2021 Posted June 30, 2021 The title pretty much sums it up. There are Flecca banks all over the map. In the back of them, there are big vault doors. How might I, programmatically, allow a player to open them. Some sample code would be appreciated. Here is some scratch code I have tried. A command on the server calls this on the client // https://cdn.rage.mp/public/odb/index.html#v_ilev_gb_vauldr mp.events.add('door', player => { const key = 'v_ilev_gb_vauldr' const modelHash = mp.game.joaat(key) // const woodDoorKey = 'v_ilev_gb_teldr' // const woodDoorModelHash = mp.game.joaat(woodDoorKey); const vector = new mp.Vector3(player.position.x, player.position.y, player.position.z); const obj = mp.game.object.getClosestObjectOfType(vector.x, vector.y, vector.z, 10.0, modelHash, false, true, true) //mp.game.object.addDoorToSystem(modelHash, modelHash, vector.x, vector.y, vector.z, true, true, true); mp.game.object.doorControl(modelHash, vector.x, vector.y, vector.z, false, 0.0, 50.0, 0.0); mp.game.object.doorControl(woodDoorModelHash, vector.x, vector.y, vector.z, false, 0.0, 50.0, 0.0); //mp.game.object.setDoorAjarAngle(modelHash, true, true, true); mp.gui.chat.push(`model hash: ${modelHash}`) // obj.playAnimation('anim@heists@fleeca_bank@bank_vault_door', 'bank_vault_door_opens', 8, 0) })
Grintch. Posted July 1, 2021 Posted July 1, 2021 You can use disableInteriorProp and simply put the name of the door mp.game.interior.getInteriorAtCoords(x, y, z); // Get the interiorID or Hash for Fleeca mp.game.interior.disableInteriorProp(interiorID, propName); // Change the interiorID with the ID. The prop name with "v_ilev_gb_vauldr" (your door) [WIKI] Get Interior At Coords [WIKI] Disable Interior Prop
MxPrime Posted July 2, 2021 Author Posted July 2, 2021 I tried this. Did not work. I think the prop name might be incorrect. I'm pretty sure this (https://cdn.rage.mp/public/odb/index.html#v_ilev_gb_vauldr) is it mp.events.add('door', player => { const key = 'v_ilev_gb_vauldr' const modelHash = mp.game.joaat(key) const vector = new mp.Vector3(player.position.x, player.position.y, player.position.z); const interiorID = mp.game.interior.getInteriorAtCoords(vector.x, vector.y, vector.z); mp.game.interior.disableInteriorProp(interiorID, key); mp.game.interior.refreshInterior(interiorID); mp.gui.chat.push(`int id : ${interiorID}`) })
MxPrime Posted July 18, 2021 Author Posted July 18, 2021 Just following up here for anyone who finds this discussion. The method `createHideModel` seems to do the trick. Although this just gets rid of the door completely. That would not very RP if a player was say hacking the door. I haven't tried yet, but rotating the door might be better // https://cdn.rage.mp/public/odb/index.html#v_ilev_gb_vauldr mp.events.add('door', player => { const key = 'v_ilev_gb_vauldr' const woodDoorName = 'v_ilev_gb_teldr' const modelHash = mp.game.joaat(key) const modelHashDoor = mp.game.joaat(woodDoorName) const vector = new mp.Vector3(144.15286254882812,-1041.8626708984375,29.367929458618164); const interiorID = mp.game.interior.getInteriorAtCoords(vector.x, vector.y, vector.z); // mp.game.interior.disableInteriorProp(interiorID, key); // mp.game.interior.disableInteriorProp(interiorID, woodDoorName); // mp.game.interior.refreshInterior(interiorID); mp.game.entity.createModelHide(vector.x, vector.y, vector.z, 100, modelHash, true); mp.game.entity.createModelHide(vector.x, vector.y, vector.z, 100, modelHashDoor, true); if (mp.game.interior.isInteriorPropEnabled(interiorID, key)) { mp.gui.chat.push('true'); } else { mp.gui.chat.push('false'); } mp.gui.chat.push(`int id : ${interiorID}`) })
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now