AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help shake (https://forums.alliedmods.net/showthread.php?t=313078)

tolpecek 12-27-2018 11:12

help shake
 
Hello, need help again :(
it should be black and shake but i do nothing. thanks a lot again
Code:

#define SHAKE_AMPLITUDE    16.0    // max = 16.0
#define SHAKE_DURATION    6.0        // max = 16.0
#define SHAKE_FREQUENCY    100.0    // max = 256.0

Code:

if (equali(arg1, "/zariche") == 1)
    {
        ScreenFade_Zariche(id)
        return PLUGIN_HANDLED
}

Code:

public ScreenFade_Zariche(id)
{
        print_color(id, "Napisal si zariche") // jsut check if function was called
        new players[32], num
        //get_players(players, num, "ace", "CT")
        get_players(players, num);

        new shakeAmplitude = __FixedUnsigned16(SHAKE_AMPLITUDE, 1<<12)
        new shakeDuration  = __FixedUnsigned16(SHAKE_DURATION, 1<<12)
        new shakeFrequency = __FixedUnsigned16(SHAKE_FREQUENCY, 1<<9)

        for(--num; num>=0; num--)
        {
                message_begin(MSG_ONE, gmsgShake, .player = players[num])
                {
                write_short( shakeAmplitude )  // shake amount.
                write_short( shakeDuration )  // shake lasts this long.
                write_short( shakeFrequency )  // shake noise frequency.
        }
        message_end()


        message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, players[num]);
        {
        write_short(4096*10);    // Duration
        write_short(4);    // Hold time 4096*2
        write_short(4096);    // Fade type
        write_byte(0);        // Red
        write_byte(0);        // Green
        write_byte(0);        // Blue
        write_byte(255);    // Alpha
        }
        message_end();
        }       
return PLUGIN_HANDLED
}

Code:

__FixedUnsigned16(Float:flValue, iScale)
{
        new iOutput;

        iOutput = floatround(flValue * iScale)

        if ( iOutput < 0 )
                iOutput = 0

        if ( iOutput > 0xFFFF )
                iOutput = 0xFFFF
       
        return iOutput
}


LondoN 12-27-2018 17:32

Re: help shake
 
Code:

                message_begin ( MSG_ONE_UNRELIABLE, ScreenShake, {0,0,0}, Players [ i ] );
                write_short ( 1<<14 );
                write_short ( 1<<14 );
                write_short ( 1<<14 );
                message_end ( );

it's works fine this part of code for me.


All times are GMT -4. The time now is 07:29.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.