AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Forcing a zombie to duck and may not jump (https://forums.alliedmods.net/showthread.php?t=94283)

ƒa†es™ 06-09-2009 09:45

Forcing a zombie to duck and may not jump
 
I trying to force a zombie to duck and may not jump

PHP Code:

#include <hamsandwich> 

PHP Code:

RegisterHam(Ham_Player_PreThink"player""fwd_Player_PreThink"

PHP Code:

public fwd_Player_PreThink(id)
{
    if (!
zp_get_user_zombie(id) || zp_get_user_nemesis(id))
   
HAM_IGNORED
    
if (zp_get_user_zombie_class(id) != g_zclass_hczombie)
  
HAM_IGNORED
    set_pev
(idpev_oldbuttonspev(idpev_oldbuttons)|IN_JUMP|IN_DUCK)
    {
        return 
HAM_SUPERCEDE 
    

    return 
HAM_IGNORED 


but it didn't work.

Sn!ff3r 06-09-2009 11:01

Re: Forcing a zombie to duck and may not jump
 
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <zombieplague>

#define PLUGIN "Nowy Plugin"
#define VERSION "1.0"
#define AUTHOR "Sn!ff3r"

/*new g_zclass_hczombie = 0;*/

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_forward(FM_CmdStart"FwdCmdStart")
    
register_forward(FM_PlayerPreThink"FwdClientPreThink")
    
}

public 
FwdClientPreThink(id)
{
    if(!
zp_get_user_zombie(id) || zp_get_user_nemesis(id) || !is_user_alive(id) || zp_get_user_zombie_class(id) != g_zclass_hczombie
        return 
FMRES_IGNORED
    
    set_pev
(idpev_buttonpev(idpev_button) & IN_DUCK)    
    
    return 
FMRES_IGNORED
}


public 
FwdCmdStart(iduc_handleseed)
{
    if(!
is_user_alive(id) || !zp_get_user_zombie(id))
        return 
FMRES_IGNORED
    
    
new button get_uc(uc_handleUC_Buttons)
    if(
button IN_JUMP)
    {
        
set_uc(uc_handleUC_Buttons, (button & ~IN_JUMP))
        
        return 
FMRES_SUPERCEDE
    
}    
    return 
FMRES_IGNORED


try this.

SnoW 06-09-2009 12:58

Re: Forcing a zombie to duck and may not jump
 
pev_bInDuck?

ƒa†es™ 06-09-2009 13:07

Re: Forcing a zombie to duck and may not jump
 
Quote:

Originally Posted by Sn!ff3r (Post 844904)
PHP Code:

/* Plugin generated by AMXX-Studio */
 
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <zombieplague>
 
#define PLUGIN "Nowy Plugin"
#define VERSION "1.0"
#define AUTHOR "Sn!ff3r"
 
/*new g_zclass_hczombie = 0;*/
 
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_forward(FM_CmdStart"FwdCmdStart")
    
register_forward(FM_PlayerPreThink"FwdClientPreThink")
 
}
 
public 
FwdClientPreThink(id)
{
    if(!
zp_get_user_zombie(id) || zp_get_user_nemesis(id) || !is_user_alive(id) || zp_get_user_zombie_class(id) != g_zclass_hczombie
        return 
FMRES_IGNORED
 
    set_pev
(idpev_buttonpev(idpev_button) & IN_DUCK)    
 
    return 
FMRES_IGNORED
}
 
 
public 
FwdCmdStart(iduc_handleseed)
{
    if(!
is_user_alive(id) || !zp_get_user_zombie(id))
        return 
FMRES_IGNORED
 
    
new button get_uc(uc_handleUC_Buttons)
    if(
button IN_JUMP)
    {
        
set_uc(uc_handleUC_Buttons, (button & ~IN_JUMP))
 
        return 
FMRES_SUPERCEDE
    
}    
    return 
FMRES_IGNORED


try this.

Didn't work.

Quote:

Originally Posted by SnoW (Post 844962)
pev_bInDuck?

How ?

hleV 06-09-2009 15:34

Re: Forcing a zombie to duck and may not jump
 
I'm not sure what you want. You want zombie to duck and disallow him to jump? If so, you can try this (not tested and I doubt that it will work flawlessly).
Code:
public FwdCmdStart(id, uc_handle, seed) {         if(!is_user_alive(id) || !zp_get_user_zombie(id))                 return FMRES_IGNORED           static Buttons, DoAction;         Buttons = get_uc(uc_handle, UC_Buttons);           if (!(Buttons & IN_DUCK))         {                 DoAction = true;                 Buttons |= IN_DUCK;         }           if (Buttons & IN_JUMP)         {                 DoAction = true;                 Buttons |= ~IN_JUMP;         }           if (DoAction)         {                 set_uc(uc_handle, UC_Buttons, Buttons);                   return FMRES_SUPERCEDE;         }           return FMRES_IGNORED; }

ƒa†es™ 06-10-2009 02:02

Re: Forcing a zombie to duck and may not jump
 
Quote:

Originally Posted by hleV (Post 845053)
I'm not sure what you want. You want zombie to duck and disallow him to jump? If so, you can try this (not tested and I doubt that it will work flawlessly).

Code:
public FwdCmdStart(id, uc_handle, seed)</p><p>{</p><p> if(!is_user_alive(id) || !zp_get_user_zombie(id))</p><p> return FMRES_IGNORED</p><p>&nbsp;</p><p> static Buttons, DoAction;</p><p> Buttons = get_uc(uc_handle, UC_Buttons);</p><p>&nbsp;</p><p> if (!(Buttons & IN_DUCK))</p><p> {</p><p> DoAction = true;</p><p> Buttons |= IN_DUCK;</p><p> }</p><p>&nbsp;</p><p> if (Buttons & IN_JUMP)</p><p> {</p><p> DoAction = true;</p><p> Buttons |= ~IN_JUMP;</p><p> }</p><p>&nbsp;</p><p> if (DoAction)</p><p> {</p><p> set_uc(uc_handle, UC_Buttons, Buttons);</p><p>&nbsp;</p><p> return FMRES_SUPERCEDE;</p><p> }</p><p>&nbsp;</p><p> return FMRES_IGNORED;</p><p>}


Didn't work

When i jump it auto attack


All times are GMT -4. The time now is 13:51.

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