HankSteiner

How do i properly access all colshapes serverside?

Recommended Posts

Hii,

How do i properly access all colshapes serverside so i can access there attributes? I mean i could port the data to a db on create and work with sql😬..? or ad SetValue commands? Is there a true way?

 i tryed:

1.

let colshapeMarkers = [];
let colshapecolor = [133,30,62,200]
let ChatColorR = "!{"+[255, 0, 0]+"}";
let ChatColorW = "!{"+[255, 255, 255]+"}";
let ServerChatM = '['+ChatColorR+'SERVER'+ChatColorW+'] ';

mp.events.addCommand("setv", (player) => {
    //colshapeMarkers = null;
    //reseting

    let colshapesArr = mp.colshapes.toArray();

    player.outputChatBox('['+ChatColorR+'SERVER'+ChatColorW+'] '+colshapesArr)

    colshapesArr.every((colshape) => { 
    player.outputChatBox(ServerChatM+' id of colshape:'+colshape.id);
    marker =  mp.markers.new(1, new mp.Vector3(colshape.x, colshape.y, colshape.z), colshape.range,
    {
        direction: new mp.Vector3(colshape.x, colshape.y, colshape.z),
        rotation: new mp.Vector3(0, 0, 0),
        color: [133,30,62,200],
        visible: true,
        dimension: player.dimension
    }); 

});

and:

let colshapeMarkers = [];
let colshapecolor = [133,30,62,200]
let ChatColorR = "!{"+[255, 0, 0]+"}";
let ChatColorW = "!{"+[255, 255, 255]+"}";
let ServerChatM = '['+ChatColorR+'SERVER'+ChatColorW+'] ';

mp.events.addCommand("setv", (player) => {
    //colshapeMarkers = null;
    //reseting

    // let colshapesArr = mp.colshapes.toArray();

    // player.outputChatBox('['+ChatColorR+'SERVER'+ChatColorW+'] '+colshapesArr)

    // colshapesArr.every((colshape) => { 
    // player.outputChatBox(ServerChatM+' id of colshape:'+colshape.id);
    // marker =  mp.markers.new(1, new mp.Vector3(colshape.x, colshape.y, colshape.z), colshape.range,
    // {
    //     direction: new mp.Vector3(colshape.x, colshape.y, colshape.z),
    //     rotation: new mp.Vector3(0, 0, 0),
    //     color: [133,30,62,200],
    //     visible: true,
    //     dimension: player.dimension
    // }); 

    mp.colshapes.forEach((colshape) =>  {
        // Create Markers

        player.outputChatBox(ServerChatM +colshape.id)

        marker =  mp.markers.new(1, new mp.Vector3(colshape.x, colshape.y, colshape.z), colshape.range,
        {
            direction: new mp.Vector3(colshape.x, colshape.y, colshape.z),
            rotation: new mp.Vector3(0, 0, 0),
            color: [133,30,62,200],
            visible: true,
            dimension: player.dimension
        });
        colshapeMarkers[colshape.id] = marker.id;
    });

});

-> https://wiki.rage.mp/index.php?title=Pool::toArray

Share this post


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.