rootcause 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 16 3 Link to comment Share on other sites More sharing options...
Renae Posted February 5, 2019 Share Posted February 5, 2019 yooo literally a life saver Link to comment Share on other sites More sharing options...
Mentanding Posted March 28, 2019 Share Posted March 28, 2019 thanks 👌 Link to comment Share on other sites More sharing options...
jezd0000 Posted April 7, 2021 Share Posted April 7, 2021 where to put this command, whether it should be in pawno? Link to comment Share on other sites More sharing options...
JamesBeast Posted June 8, 2021 Share 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 Link to comment Share on other sites More sharing options...
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