Raised This Month: $51 Target: $400
 12% 

Bug - TR can move on freezetime fix


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 10-28-2018 , 14:31   Bug - TR can move on freezetime fix
Reply With Quote #1

hey guys, i think you all know this bug, we play a lot of PUB 5 x 5 on my community, and there is one bug that is annoying, when a terrorist spawn on the ramp on tr spawn, we have 15 secs of freezetime, he can move to get a better spawn position to the end of the ramp ducking/scrolling so he will get on long A so fast that the ct will be killed most of times by surprise, how can i stop this? player cannot move from his position until the freezetime is over? thanks guys
tarsisd2 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-28-2018 , 14:52   Re: Bug - TR can move on freezetime fix
Reply With Quote #2

You need to remove what allowing this in the first place.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 10-28-2018 at 14:53.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 10-28-2018 , 18:22   Re: Bug - TR can move on freezetime fix
Reply With Quote #3

Quote:
Originally Posted by Natsheh View Post
You need to remove what allowing this in the first place.
you mean anti double duck plugin? is there another way to fix this without blocking double ducking?
tarsisd2 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-28-2018 , 18:27   Re: Bug - TR can move on freezetime fix
Reply With Quote #4

Idk try disabling and see if it works!
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
marcelowzd
Senior Member
Join Date: Feb 2011
Location: São Paulo, Brazil
Old 10-29-2018 , 01:45   Re: Bug - TR can move on freezetime fix
Reply With Quote #5

The first one blocks duck only during freezetime

PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >

new const g_szPlugin[ ] = "Block Duck On Freezetime";
new const 
g_szVersion[ ] = "0.0.1";
new const 
g_szAuthor[ ] = "wizard";

new 
HamHook:g_hDuck;

public 
plugin_init( )
{
    
register_pluging_szPluging_szVersiong_szAuthor );

    
register_event"HLTV""OnFreezetimeStart""a""1=0""2=0" );
    
register_logevent"OnRoundStart"2"1=Round_Start" );

    
DisableHamForwardg_hDuck RegisterHamHam_Player_Duck"player""OnPlayerDuckPre") );
}

public 
OnFreezetimeStart( )
{
    
EnableHamForwardg_hDuck );
}

public 
OnRoundStart( )
{
    
DisableHamForwardg_hDuck );
}

public 
OnPlayerDuckPreiClient )
{
    if( !
is_user_aliveiClient ) )
        return 
HAM_IGNORED;

    static 
biOldButtonsbiOldButtons peviClientpev_oldbuttons );

    
biOldButtons |= IN_DUCK;

    
set_peviClientpev_oldbuttonsbiOldButtons );

    return 
HAM_SUPERCEDE;

The second one i was trying to do without blocking duck, instead it would set your spawn position if you moved. The problem is that you can't jump nor duck because PreThink is a function executed every frame. I'm posting this anyway if anyone wants to modify and test. It also works but can be really anoying.

PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >

new const g_szPlugin[ ] = "Block Duck On Freezetime";
new const 
g_szVersion[ ] = "0.0.1";
new const 
g_szAuthor[ ] = "wizard";

new 
HamHook:g_hPreThink;

new 
Float:g_fPlayerPos33 ][ ];

public 
plugin_init( )
{
    
register_pluging_szPluging_szVersiong_szAuthor );

    
register_event"HLTV""OnFreezetimeStart""a""1=0""2=0" );
    
register_logevent"OnRoundStart"2"1=Round_Start" );

    
DisableHamForwardg_hPreThink RegisterHamHam_Player_PreThink"player""OnPlayerPreThink") );
    
    
RegisterHamHam_Spawn"player""OnPlayerSpawn");
}

public 
OnFreezetimeStart( )
{
    if( 
get_cvar_num"mp_freezetime" ) > // Security check, if there is no freezetime then we shouldn't enable ham
        
set_task1.0"LetPlayerSpawn" ); // Cooldown so players can spawn and 'OnPlayerSpawn' can save their positions
}

public 
LetPlayerSpawn( )
{
    
EnableHamForwardg_hPreThink );
}

public 
OnRoundStart( )
{
    
DisableHamForwardg_hPreThink );
}

public 
OnPlayerSpawniClient )
{
    if( !
is_user_aliveiClient ) )
        return 
HAM_IGNORED;

    
set_task0.5"SavePlayerPos"iClient ); // This was needed, otherwise the plugin would save the player while in the air

    
peviClientpev_origing_fPlayerPosiClient ] );

    return 
HAM_IGNORED;
}

public 
SavePlayerPosiClient )
{
    if( !
is_user_aliveiClient ) )
        return;

    
peviClientpev_origing_fPlayerPosiClient ] );
}

public 
OnPlayerPreThinkiClient )
{
    if( !
is_user_aliveiClient ) )
        return 
HAM_IGNORED;

    static 
Float:fPos]; peviClientpev_originfPos );

    if( 
xs_vec_equalfPosg_fPlayerPosiClient ] ) )
        return 
HAM_IGNORED;

    
engfuncEngFunc_SetOriginiClientg_fPlayerPosiClient ] );

    return 
HAM_IGNORED;
}

bool:xs_vec_equal(const Float:vec1[], const Float:vec2[]) // Stolen from XS library
{
    return (
vec1[0] == vec2[0]) && (vec1[1] == vec2[1]) && (vec1[2] == vec2[2]);

You're probably going to use this plugin in dust2 so if you want you can add this in plugin_init()

PHP Code:
new szMapName32 ];

if( !
equalszMapName"de_dust2" ) )
    
set_fail_state"Plugin only for dust2" ); 
There is also an orpheu version, but it always block duck --> https://forums.alliedmods.net/showthread.php?t=118476

Cheers!
__________________

Last edited by marcelowzd; 10-29-2018 at 01:54. Reason: Added an orpheu version
marcelowzd is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:22.


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