Raised This Month: $ Target: $400
 0% 

How do you force people to duck


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
31m0_owns
Member
Join Date: May 2008
Location: SLH, New Jersey-- U.S.A
Old 05-14-2009 , 08:31   How do you force people to duck
Reply With Quote #1

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...
__________________
Project(s):
Prop-Hunt: 5%
Killcam: NEVER GOING TO HAPPEN!!!
31m0_owns is offline
Emilioneri
Senior Member
Join Date: Feb 2009
Location: Georgia, Tbilisi
Old 05-14-2009 , 11:36   Re: How do you force people to duck
Reply With Quote #2

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

__________________

Last edited by Emilioneri; 05-14-2009 at 11:41.
Emilioneri is offline
Send a message via Skype™ to Emilioneri
ehha
SourceMod Donor
Join Date: Apr 2006
Location: Sibiu
Old 05-14-2009 , 12:00   Re: How do you force people to duck
Reply With Quote #3

You need client_cmd(id, "-duck") under client_cmd(id, "+duck").
ehha is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 05-14-2009 , 12:36   Re: How do you force people to duck
Reply With Quote #4

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.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-14-2009 , 15:18   Re: How do you force people to duck
Reply With Quote #5

Quote:
Originally Posted by Dores View Post
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 ? :}
__________________
Hunter-Digital is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 05-14-2009 , 15:50   Re: How do you force people to duck
Reply With Quote #6

@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);

__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 05-14-2009 , 14:45   Re: How do you force people to duck
Reply With Quote #7

For duck forcing you could use pev_binduck, still I can't remember if it was set off fast.
SnoW is offline
Send a message via MSN to SnoW
31m0_owns
Member
Join Date: May 2008
Location: SLH, New Jersey-- U.S.A
Old 05-14-2009 , 15:01   Re: How do you force people to duck
Reply With Quote #8

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
__________________
Project(s):
Prop-Hunt: 5%
Killcam: NEVER GOING TO HAPPEN!!!
31m0_owns is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 05-14-2009 , 17:25   Re: How do you force people to duck
Reply With Quote #9

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); 

Last edited by hlstriker; 05-14-2009 at 18:13.
hlstriker is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-17-2009 , 10:08   Re: How do you force people to duck
Reply With Quote #10

Quote:
Originally Posted by hlstriker View Post
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); 
awesome, it works ! thanks alot :}
__________________
Hunter-Digital 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 01:30.


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