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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.