Jump to content
RAGE Multiplayer Community

Attachments editor 0.1

   (2 reviews)

3 Screenshots

About This File

About This File

You can edit the position of an object what you want attach to a ped. You can remplace or add more objects on server side file and more body parts if you need.

Command

  • /attach [object ID] [body ID]

Notes

Also on GitHub: https://github.com/1PepeCortez/Attachments-editor


What's New in Version 0.1   See changelog

Released

No changelog available for this version.

  • Like 3
 Share


User Feedback

Join the conversation

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

Guest

DevMarvin

· Edited by DevMarvin

  

I have developed it a little further so that you can also change the speed of the position / rotation. Otherwise, very good.

// Edited and added functions:

let positionSpeed = 0.01;
let rotationSpeed = 1.0;

mp.events.add('render', () => {
    if(editObject == null) return;

    let msg = 'Editing: ~y~' +stateName[editState];

    mp.game.graphics.drawText(msg, [0.8, 0.40],
    {
        font: 4,
        color: [255, 255, 255, 255],
        scale: [0.7, 0.7],
        outline: true
    });

    //

    msg = 'UP: ~g~+X~w~ | DOWN: ~g~-X~w~\nRIGHT: ~g~+Y~w~ | LEFT: ~g~-Y~w~\nPAGE UP: ~g~+Z~w~ | PAGE DOWN: ~g~-Z~w~';

    mp.game.graphics.drawText(msg, [0.8, 0.50],
    {
        font: 4,
        color: [255, 255, 255, 255],
        scale: [0.7, 0.7],
        outline: true
    });

    //

    msg = '(Change: K)\nPosition Speed: ' + positionSpeed + '\n' + 'Rotation Speed: ' + rotationSpeed;

    mp.game.graphics.drawText(msg, [0.8, 0.65],
    {
        font: 4,
        color: [255, 255, 255, 255],
        scale: [0.7, 0.7],
        outline: true
    });

    //

    let change = (editState == 0) ? ('rot') : ('pos');
    msg = 'Change to ' +change+ ': ~g~ALT~w~\nFinish: ~r~SPACE BAR';

    mp.game.graphics.drawText(msg, [0.8, 0.80],
    {
        font: 4,
        color: [255, 255, 255, 255],
        scale: [0.7, 0.7],
        outline: true
    });
});

mp.keys.bind(0x4B, true, function() { // K
    // KeyState: 0 (Position) / 1 (Rotation)
    if(editObject == null || keyState == true || mp.gui.cursor.visible) return;

    switch (editState) {
        case 0:
            if (positionSpeed == 0.01) { positionSpeed = 0.10; }
            else if (positionSpeed == 0.10) { positionSpeed = 0.50; }
            else if (positionSpeed == 0.50) { positionSpeed = 0.01; }
            break;
        case 1:
            if (rotationSpeed == 1.0) { rotationSpeed = 1.50; }
            else if (rotationSpeed == 1.50) { rotationSpeed = 2.0; }
            else if (rotationSpeed == 2.0) { rotationSpeed = 1.0; }
            break;
    }
});

function editAttachObject() {

    // POSITION

    if(keyPressed == 0) { objInfo.x += positionSpeed; }
    else if(keyPressed == 1) { objInfo.x -= positionSpeed; }
    else if(keyPressed == 2) { objInfo.y += positionSpeed; }
    else if(keyPressed == 3) { objInfo.y -= positionSpeed; }
    else if(keyPressed == 4) { objInfo.z += positionSpeed; }
    else if(keyPressed == 5) { objInfo.z -= positionSpeed; }

    // ROTATION

    else if(keyPressed == 6) { objInfo.rx += rotationSpeed; }
    else if(keyPressed == 7) { objInfo.rx -= rotationSpeed; }
    else if(keyPressed == 8) { objInfo.ry += rotationSpeed; }
    else if(keyPressed == 9) { objInfo.ry -= rotationSpeed; }
    else if(keyPressed == 10) { objInfo.rz += rotationSpeed; }
    else if(keyPressed == 11) { objInfo.rz -= rotationSpeed; }

    editObject.attachTo(
        player.handle,
        objInfo.body,
        objInfo.x,
        objInfo.y,
        objInfo.z,
        objInfo.rx,
        objInfo.ry,
        objInfo.rz,
        true,
        false,
        false,
        false,
        2,
        true
    );
}

 

Link to review
×
×
  • Create New...