AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How do you force people to duck (https://forums.alliedmods.net/showthread.php?t=92357)

31m0_owns 05-14-2009 08:31

How do you force people to duck
 
Hi can i get the code that forces people to duck in game and also players can't jump at all i have tried many things...

Emilioneri 05-14-2009 11:36

Re: How do you force people to duck
 
PHP Code:

/* Plugin generated by Emilioneri */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Force Duck"
#define VERSION "1.0"
#define AUTHOR "Emilioneri"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
    
register_concmd("amx_duck""cmd_duck"ADMIN_SLAY"< name | #userid >")
}

public 
cmd_duck(idlevelcid)
{
    if (!
cmd_access(idlevelcid2))
       return 
PLUGIN_HANDLED
       
    
new Argument[32]
    
    
read_argv(1Argument31)
    
    new 
Target cmd_target(idArgumentCMDTARGET_OBEY_IMMUNITY)
    
    if (
Target)
    {
        
client_cmd(id"+duck")
    }
    return 
PLUGIN_HANDLED


if you want to disable jump on your server:

PHP Code:

/* Plugin generated by Emilioneri */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Disable Jump"
#define VERSION "1.0"
#define AUTHOR "Emilioneri"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
    
register_clcmd("+jump""BlockJump")
}

public 
BlockJump(id)
{
    return 
PLUGIN_HANDLED


:mrgreen::mrgreen:

ehha 05-14-2009 12:00

Re: How do you force people to duck
 
You need client_cmd(id, "-duck") under client_cmd(id, "+duck").

Dores 05-14-2009 12:36

Re: How do you force people to duck
 
should be: engclient_cmd(id, "+duck;wait;-duck").
you can also try hamsandwich's Ham_Player_Duck.

and you can't hook buttons(+/-) with register_clcmd, you need to hook CmdStart and receive buttons from UC_Buttons.

SnoW 05-14-2009 14:45

Re: How do you force people to duck
 
For duck forcing you could use pev_binduck, still I can't remember if it was set off fast.

31m0_owns 05-14-2009 15:01

Re: How do you force people to duck
 
Thnx for replying and for the plugins but for the force duck can you make it so that it makes them ground strafe kinda of like in hns and what people do and stuff... cause i have map ideas for this Basically like bhop but g-strafe

Hunter-Digital 05-14-2009 15:18

Re: How do you force people to duck
 
Quote:

Originally Posted by Dores (Post 827385)
should be: engclient_cmd(id, "+duck;wait;-duck").
you can also try hamsandwich's Ham_Player_Duck.

and you can't hook buttons(+/-) with register_clcmd, you need to hook CmdStart and receive buttons from UC_Buttons.

I tried to block duck and jump using that with returning handled, supercede, ignored, but still nothing, can you give me an example working code of blocking duck and jump ? :}

Dores 05-14-2009 15:50

Re: How do you force people to duck
 
@Hunter-Digital:
i never said that it would work, i just said that you should try using it.

to block jump and duck you need to hook CmdStart:

PHP Code:

#include <amxmodx>
#include <fakemeta>


public plugin_init()
{
    
register_plugin("No Jump & Duck""1.0""Dores");
    
    
register_forward(FM_CmdStart"CmdStart");
}

public 
CmdStart(iduc_handle)
{
    static 
button;
    
button get_uc(uc_handleUC_Buttons);
    
    if (
button IN_JUMP)
        
button &= ~IN_JUMP;
    
    if (
button IN_DUCK)
        
button &= ~IN_DUCK;
    
    
set_uc(uc_handleUC_Buttonsbutton);



hlstriker 05-14-2009 17:25

Re: How do you force people to duck
 
EDIT: While reading through this thread I forgot the main topic was how to force them to duck, not how to block duck ;D!

Using CmdStart won't work because jumping/ducking is handled client side.

The best solution I've come across is to trick the server into thinking you are already jumping/ducking. The only problem with this is the client will start to do the jump/duck on their screen until the server tells the client they are not (so the player will start their jump/duck but won't get far). Other players will not see the jumping/ducking player doing the jump/duck however.

PHP Code:

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
RegisterHam(Ham_Player_PreThink"player""fwd_Player_PreThink");
}

public 
fwd_Player_PreThink(iClient)
    
set_pev(iClientpev_oldbuttonspev(iClientpev_oldbuttons)|IN_JUMP|IN_DUCK); 


SchlumPF* 05-14-2009 17:57

Re: How do you force people to duck
 
PHP Code:

// global vars
new const Float:VEC_DUCK_HULL_MIN[3] = { -16.0, -16.0, -18.0 };
new const 
Float:VEC_DUCK_HULL_MAX[3] = { 16.016.018.0 };

// put this in prethink
set_pevplrpev_flagspevplrpev_flags ) | FL_DUCKING );
engfuncEngFunc_SetSizeplrVEC_DUCK_HULL_MINVEC_DUCK_HULL_MAX ); // maybe even setting pev_flags is enough, you should test 



All times are GMT -4. The time now is 01:30.

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