Hello, Guest

By registering with us, you'll be able to discuss, share and private message with other members of our community.
What's new

Fixing bug with RedAge v3 crease

Alexalsaud

Administrative
Staff member
Admin
Joined
Aug 5, 2024
Messages
337
ICoins
1,301
Fixing bug with RedAge v3 crease

Guide on how to remove the ability to knock down the animation of the crease (crawling, etc.) on RedAge v3

Go here (src_client\shamancode)
Delete (snake.js)
Throw the downloaded (snake.js) here (src_client\shamancode)

JavaScript:
let crawlplayer = mp.players.local;
crawlplayer.crawl = false;
let timesatm = new Date().getTime();
let SATM = false;


//global.binderFunctions.snake = () => {
global.binderFunctions.Snake = () => {
    if (crawlplayer.vehicle || crawlplayer.isTypingInTextChat || global.cuffed) {
        return;
    }

    if(crawlplayer.crawl){
        if (new Date().getTime() - timesatm > 2000) {
            timesatm = new Date().getTime();
            SATM = !SATM;
            crawlplayer.crawl = false;
            clearInterval(crawlInterval);
            crawlplayer.clearTasks();
            crawlplayer.clearSecondaryTask()
        }
    }
    else{
        if (!global.loggedin || global.chatActive || global.menuCheck() || global.isDeath == true || global.isDemorgan == true || global.attachedtotrunk || global.localplayer.isInAnyVehicle(false) || global.localplayer.isFalling() || global.localplayer.isCuffed() || global.localplayer.isFatallyInjured() || global.localplayer.isShooting() || global.localplayer.isSwimming() || global.localplayer.isClimbing()) return;
        else{
            if (new Date().getTime() - timesatm > 3000) {
                timesatm = new Date().getTime();
                SATM = !SATM;         
                crawlInterval = setInterval(handleControls, 0);
                crawlplayer.crawl = true;
                mp.game.streaming.requestAnimDict('move_crawlprone2crawlfront');
                mp.events.callRemote('Snake', SATM);
                crawlplayer.taskPlayAnim(
                    'move_crawlprone2crawlfront',
                    'front',
                    8.0,
                    1000,
                    -1,
                    2,
                    0,
                    false,
                    false,
                    false
                );
            }
        }
    }
};

let anim;
let timeoutAnim;

function handleControls() {
    if (!crawlplayer.crawl || crawlplayer.isCuffed()) return; // Добавлено условие проверки на наручники
    let dict = 'move_crawl';
    let rotation = crawlplayer.getRotation(2);
    mp.game.controls.disableControlAction(0, 32, true);
    mp.game.controls.disableControlAction(0, 33, true);
    mp.game.controls.disableControlAction(0, 34, true);
    mp.game.controls.disableControlAction(0, 35, true);
    if(mp.game.controls.isDisabledControlPressed(0, 34))
    {
        crawlplayer.setRotation(rotation.x, rotation.y, rotation.z + 0.2, 2, true);
    }
    if(mp.game.controls.isDisabledControlPressed(0, 35))
    {
        crawlplayer.setRotation(rotation.x, rotation.y, rotation.z - 0.2, 2, true);
    }
    if(mp.game.controls.isDisabledControlPressed(0, 32))
    {
        if (anim === ('onfront_fwd' || 'onfront_bwd') || timeoutAnim) return;
        anim = 'onfront_fwd';
        let timer = mp.game.entity.getEntityAnimDuration('move_crawl', anim);
        mp.game.streaming.requestAnimDict(dict);
        crawlplayer.taskPlayAnim(dict, anim, 8.0, 1000, -1, 2, 0, false, false, false);
        timeoutAnim = setTimeout(() => {
            anim = undefined;
            timeoutAnim = undefined;
        }, (timer - 0.1) * 1000);
    }
    if(mp.game.controls.isDisabledControlPressed(0, 33))
    {
        if (anim === ('onfront_fwd' || 'onfront_bwd') || timeoutAnim) return;
        anim = 'onfront_bwd';
        let timer = mp.game.entity.getEntityAnimDuration('move_crawl', anim);
        mp.game.streaming.requestAnimDict(dict);
        crawlplayer.taskPlayAnim(dict, anim, 8.0, 1000, -1, 2, 0, false, false, false);
        timeoutAnim = setTimeout(() => {
            anim = undefined;
            timeoutAnim = undefined;
        }, (timer - 0.1) * 1000);
    }
}

 
Back
Top