rootcause 491 Posted April 22, 2018 Share 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 15 3 Link to post Share on other sites
Renae 0 Posted February 5, 2019 Share Posted February 5, 2019 yooo literally a life saver Link to post Share on other sites
Mentanding 0 Posted March 28, 2019 Share Posted March 28, 2019 thanks 👌 Link to post Share on other sites
jezd0000 0 Posted Wednesday at 08:53 AM Share Posted Wednesday at 08:53 AM where to put this command, whether it should be in pawno? Link to post Share on other sites
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