rootcause Posted April 22, 2018 Posted April 22, 2018 /save [name (optional)] command to save your/your vehicle's position and heading/rotation to a file just like in SA-MP. You can find the saved positions inside savedpos.txt on the server folder. Code: const fs = require("fs"); const saveFile = "savedpos.txt"; mp.events.addCommand("save", (player, name = "No name") => { let pos = (player.vehicle) ? player.vehicle.position : player.position; let rot = (player.vehicle) ? player.vehicle.rotation : player.heading; fs.appendFile(saveFile, `Position: ${pos.x}, ${pos.y}, ${pos.z} | ${(player.vehicle) ? `Rotation: ${rot.x}, ${rot.y}, ${rot.z}` : `Heading: ${rot}`} | ${(player.vehicle) ? "InCar" : "OnFoot"} - ${name}\r\n`, (err) => { if (err) { player.notify(`~r~SavePos Error: ~w~${err.message}`); } else { player.notify(`~g~Position saved. ~w~(${name})`); } }); }); What the output looks like: Position: -422.9187316894531, 1133.0765380859375, 325.8547058105469 | Heading: 344.207763671875 | OnFoot - No name Position: -411.07977294921875, 1180.73681640625, 325.0368957519531 | Rotation: 1.4606590270996094, 0.7490195631980896, 75.47509765625 | InCar - No name Position: -1087.9407958984375, 4912.0634765625, 214.6710968017578 | Heading: 222.96522521972656 | OnFoot - Altruist Camp 17 3
jezd0000 Posted April 7, 2021 Posted April 7, 2021 where to put this command, whether it should be in pawno?
JamesBeast Posted June 8, 2021 Posted June 8, 2021 On 4/7/2021 at 9:53 AM, jezd0000 said: where to put this command, whether it should be in pawno? yep 1
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