AlliedModders

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

sooN 07-03-2009 12:40

Duck
 
Hello,

I search just one function that block a crouch.

Thanks ;)

TheRadiance 07-03-2009 13:00

Re: Duck
 
this should work, don't forget register_plugin
PHP Code:

#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
    
register_forward(FM_CmdStart"fw_cmdstart_pre");
}

public 
fw_cmdstart_pre(iduc_handle)
{
    if(!
is_user_alive(id))
    {
        return 
FMRES_IGNORED;
    }

    static 
b;
    
get_uc(uc_handleUC_Buttons);

    if (
IN_DUCK)
    {
        
&= ~IN_DUCK;
        
set_uc(uc_handleUC_Buttonsb);
    }
    return 
FMRES_IGNORED;



Arkshine 07-03-2009 13:05

Re: Duck
 
It won't work since it's something client-side. You have to use an alternative way, I think there are some posts about that.

sooN 07-03-2009 13:15

Re: Duck
 
Thanks but this plugin don't run, when i crouch it's not blocked.

TheRadiance 07-03-2009 13:25

Re: Duck
 
sorry.
arkshine said that it won't work via duck it's client-side feature.

but anyway, i hope my code is correct.

ConnorMcLeod 07-03-2009 13:27

Re: Duck
 
Player speed is still decreased, but he can't duck.
La vitesse du joueur est toujours diminiuée mais il ne peut pas s'accroupir.

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define VERSION "0.0.1"

public plugin_init()
{
    
register_plugin("No Duck"VERSION"ConnorMcLeod")
    
RegisterHam(Ham_Player_Duck"player""Player_Duck")
}

public 
Player_Duckid )
{
//    set_pev(id, pev_button, pev(id, pev_button) & ~IN_DUCK)
    
set_pev(idpev_oldbuttonspev(idpev_oldbuttons) | IN_DUCK)



Quote:

Originally Posted by TheRadiance (Post 863324)
sorry.
arkshine said that it won't work via duck it's client-side feature.

but anyway, i hope my code is correct.

It's not really that, players movements are not done from CmdStart.

sooN 07-03-2009 14:02

Re: Duck
 
Tranks Connor now it's okay ^^

ConnorMcLeod 07-03-2009 14:49

Re: Duck
 
Updated, only oldbuttons is needed.

TheVaskov 11-22-2022 12:24

Re: Duck
 
Why it didn't work in Day Of Defeat today ? Please help . I'm searching how to block crouch\duck and jump

Nutu_ 11-22-2022 14:28

Re: Duck
 
the fact that this topic is almost 14 years old make me believe he really searched before creating a new one! xd

-> https://forums.alliedmods.net/showthread.php?t=66500


All times are GMT -4. The time now is 15:26.

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