AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [FIXED][ZP] ScreenShake when the round Ends (https://forums.alliedmods.net/showthread.php?t=317144)

T0pARG 06-29-2019 11:09

[FIXED][ZP] ScreenShake when the round Ends
 
Hi everbody i'm new in this website, i tried add ScreenShake, but the server its down!

Help me please!!

<VeCo> 06-29-2019 12:09

Re: [ZP] ScreenShake when the round Ends
 
what exactly did you try

T0pARG 06-29-2019 14:12

Re: [ZP] ScreenShake when the round Ends
 
PHP Code:

public Sshake(id)
{
    
message_begin(MSG_ONE_UNRELIABLEg_msgScreenShake_id)
    
write_short(UNIT_SECOND*10// amplitude
    
write_short(UNIT_SECOND*6// duration
    
write_short(UNIT_SECOND*10// frequency
    
message_end()


I want to add this, but idk where, I was did it here

PHP Code:

// Show HUD notice, play win sound, update team scores...
    
static sound[64]
    if (!
fnGetZombies())
    {
        
        
// Play win sound and increase score, unless game commencing
        
ArrayGetString(sound_win_humansrandom_num(0ArraySize(sound_win_humans) - 1), soundcharsmax(sound))
        
PlaySound(sound)
        if (!
g_gamecommencingg_scorehumans++
                
        
// Round end forward
        
ExecuteForward(g_fwRoundEndg_fwDummyResultZP_TEAM_HUMAN);
    }
    else if (!
fnGetHumans())
    {
        
        
// Play win sound and increase score, unless game commencing
        
ArrayGetString(sound_win_zombiesrandom_num(0ArraySize(sound_win_zombies) - 1), soundcharsmax(sound))
        
PlaySound(sound)
        if (!
g_gamecommencingg_scorezombies++
        
        
// Round end forward
        
ExecuteForward(g_fwRoundEndg_fwDummyResultZP_TEAM_ZOMBIE);
    }
    else
    {
        
// No one wins
        
set_hudmessage(02000HUD_EVENT_XHUD_EVENT_Y00.03.02.01.0, -1)
        
ShowSyncHudMsg(0g_MsgSync"%L"LANG_PLAYER"WIN_NO_ONE")
        
        
// Play win sound
        
ArrayGetString(sound_win_no_onerandom_num(0ArraySize(sound_win_no_one) - 1), soundcharsmax(sound))
        
PlaySound(sound)
        
        
// Round end forward
        
ExecuteForward(g_fwRoundEndg_fwDummyResultZP_TEAM_NO_ONE);
    } 

But the game doesn't works and closes it

<VeCo> 06-29-2019 15:27

Re: [ZP] ScreenShake when the round Ends
 
There is no player index in the function you provided, use this to send it to all players:
PHP Code:

public Sshake()
{
    
message_begin(MSG_BROADCASTg_msgScreenShake)
    
write_short(UNIT_SECOND*10// amplitude
    
write_short(UNIT_SECOND*6// duration
    
write_short(UNIT_SECOND*10// frequency
    
message_end()



T0pARG 06-29-2019 19:40

Re: [ZP] ScreenShake when the round Ends
 
PHP Code:

// Show HUD notice, play win sound, update team scores...
    
static sound[64]
    if (!
fnGetZombies())
    {
        
        
// Play win sound and increase score, unless game commencing
        
ArrayGetString(sound_win_humansrandom_num(0ArraySize(sound_win_humans) - 1), soundcharsmax(sound))
        
PlaySound(sound)
        if (!
g_gamecommencingg_scorehumans++
                
        
// Round end forward
        
ExecuteForward(g_fwRoundEndg_fwDummyResultZP_TEAM_HUMAN);
    }
    else if (!
fnGetHumans())
    {
        
        
// Play win sound and increase score, unless game commencing
        
ArrayGetString(sound_win_zombiesrandom_num(0ArraySize(sound_win_zombies) - 1), soundcharsmax(sound))
        
PlaySound(sound)
        if (!
g_gamecommencingg_scorezombies++
        
        
// Round end forward
        
ExecuteForward(g_fwRoundEndg_fwDummyResultZP_TEAM_ZOMBIE);
    }
    else
    {
        
// No one wins
        
set_hudmessage(02000HUD_EVENT_XHUD_EVENT_Y00.03.02.01.0, -1)
        
ShowSyncHudMsg(0g_MsgSync"%L"LANG_PLAYER"WIN_NO_ONE")
        
        
// Play win sound
        
ArrayGetString(sound_win_no_onerandom_num(0ArraySize(sound_win_no_one) - 1), soundcharsmax(sound))
        
PlaySound(sound)
        
        
// Round end forward
        
ExecuteForward(g_fwRoundEndg_fwDummyResultZP_TEAM_NO_ONE);
    } 

where i put the
PHP Code:

Sshake 

PHP Code:

if (!fnGetZombies())
    {
        
        
// Play win sound and increase score, unless game commencing
        
ArrayGetString(sound_win_humansrandom_num(0ArraySize(sound_win_humans) - 1), soundcharsmax(sound))
        
PlaySound(sound)
        if (!
g_gamecommencingg_scorehumans++
                
        
// Round end forward
        
ExecuteForward(g_fwRoundEndg_fwDummyResultZP_TEAM_HUMAN);
        
Sshake // Here?
    



<VeCo> 06-30-2019 05:21

Re: [ZP] ScreenShake when the round Ends
 
Use Sshake() to call the function.

if (!fnGetZombies()) is when humans win
else if (!fnGetHumans()) is when zombies win
else is when no one wins

If you want it to be called in all cases, put it under the else closing bracket, or before static sound[64], doesn't matter.. But yes, otherwise that's correct.

T0pARG 06-30-2019 15:03

Re: [ZP] ScreenShake when the round Ends
 
I did it like you said me, but an error appears me "WriteDest_Param: not a client"
Help me please :(

PHP Code:

// Show HUD notice, play win sound, update team scores...
    
static sound[64]
    
Sshake // Idk where i put this!
    
if (!fnGetZombies())
    {
        
        
// Play win sound and increase score, unless game commencing
        
ArrayGetString(sound_win_humansrandom_num(0ArraySize(sound_win_humans) - 1), soundcharsmax(sound))
        
PlaySound(sound)
        if (!
g_gamecommencingg_scorehumans++
        
        
// Round end forward
        
ExecuteForward(g_fwRoundEndg_fwDummyResultZP_TEAM_HUMAN);
    }
    else if (!
fnGetHumans())
    {
        
        
// Play win sound and increase score, unless game commencing
        
ArrayGetString(sound_win_zombiesrandom_num(0ArraySize(sound_win_zombies) - 1), soundcharsmax(sound))
        
PlaySound(sound)
        if (!
g_gamecommencingg_scorezombies++
        
        
// Round end forward
        
ExecuteForward(g_fwRoundEndg_fwDummyResultZP_TEAM_ZOMBIE);
    }
    else
    {
        
// No one wins
        
set_hudmessage(02000HUD_EVENT_XHUD_EVENT_Y00.03.02.01.0, -1)
        
ShowSyncHudMsg(0g_MsgSync"%L"LANG_PLAYER"WIN_NO_ONE")
        
        
// Play win sound
        
ArrayGetString(sound_win_no_onerandom_num(0ArraySize(sound_win_no_one) - 1), soundcharsmax(sound))
        
PlaySound(sound)
        
        
// Round end forward
        
ExecuteForward(g_fwRoundEndg_fwDummyResultZP_TEAM_NO_ONE);
    } 


Natsheh 07-02-2019 02:40

Re: [ZP] ScreenShake when the round Ends
 
OP show all your defines (what is unit_second and g_msgScreenShake are equal to )


Use this to fix the value

PHP Code:

    FixedUnsigned16 ( const Float:Value, const Scale )
    {
        return 
clampfloatroundValue Scale ), 00xFFFF );
    } 


Use this stock instead
PHP Code:

public Sshake(idFloat:AMPFloat:DURFloat:FREQ)
{
    
message_begin(!id MSG_BROADCAST:MSG_ONE_UNRELIABLEg_msgScreenShake_id)
    
write_short(FixedUnsigned16(AMPUNIT_SECOND)) // amplitude
    
write_short(FixedUnsigned16(DURUNIT_SECOND)) // duration
    
write_short(FixedUnsigned16(FREQUNIT_SECOND)) // frequency
    
message_end()



If you have no idea where to put the code then post in the right section


All times are GMT -4. The time now is 12:31.

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