Jump to content
RAGE Multiplayer Community

[Help] Single file for multiple locations


Recommended Posts

Hello, can someone help me to make one single file this type of script?

Now i use fixcar1.js, fixcar2.js, fixcar3.js for each location with coordonates, can you help me making just a single file and single function instead of new on each file...

For example:

location1 {x: 100, y:100, z:100},

location2 {x: 100, y:100, z:100}, etc.

And working with my script here:

const database = require("../database");

let ArmyColShape = mp.colshapes.newSphere(-338.3977966308594, -136.02488708496094, 38.00962448120117, 5);
mp.events.addCommand('fix', (player) => {
 if (player.isLoggedIn) {
    if(!ArmyColShape.isPointWithin(player.position)) {
        player.outputChatBox("You're not in a car-repair marker.");
        return;
    }  
    if (player.money < 200) {
        player.outputChatBox("You don't have enough money.");
        return;
    }
		player.vehicle.repair();
 }
})
mp.markers.new(1, new mp.Vector3(-338.3977966308594, -136.02488708496094, 38.00962448120117),2.0,{
    "color": [234, 0, 255, 150],
	"direction": 0,
    "dimension": 0,
    "visible": true
});
mp.labels.new(`Type /fix to repair`,new mp.Vector3(-338.3977966308594, -136.02488708496094, 39.00962448120117+1),{
    "color": [234,0,255,255],
    "dimension": 0,
    "drawDistance": 100.0,
	"font": 4
});

Thanks :)

Link to post
Share on other sites

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...