Jump to content

Recommended Posts

Posted


Hi , in this video I am going to show a simple way how to make a marker on your new server.
I will assume that you followed all the steps on how to get your server to work and that you installed Node.js and so on.
This is not the best way of doing this but I find it the most simple way.
I am also a beginner and I would love to help myself and others who are trying to build their own and unique servers.
If you need any other help, please leave a comment. 
Hope you enjoyed.

{ To all experts out there, I am sorry, I am just trying to help out the community. }

  • Like 2
Posted

Good day mupp3t,
Tryout this command serverside to save positions so you don't have to write them yourself. just keep the file "savedpos.txt" open on your side Screen :) or rewrite it to do what you are doing by hand in this Video! Keep it up. 

const fs = require("fs");
const path = require("path");
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})`);
        }
    });
});

have a good one!

Net

 

 

  • 2 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...