Raised This Month: $ Target: $400
 0% 

How to force players to squat down? Is there a better way?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Leech_v2
Senior Member
Join Date: Mar 2011
Location: Chinese GuangDong
Old 12-04-2023 , 02:13   How to force players to squat down? Is there a better way?
Reply With Quote #1

I created this plugin, but players can still briefly stand up by sending a "-duck" on the console.

I tried EngFunc_SetSize pev_mins pev_maxs pev_size pev_flags pev_button pev_oldbuttons UC_Buttons to change the entity size, but it didn't work.

I also tried hooking the "-duck" command to stop it, but it didn't work either.

Another issue is that in version 182, the bot did not squat down.

PHP Code:
/* UTF-8 func by www.DT-Club.net */

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

static const m_isCrouching;
static const 
m_jumpTimestamp;

public 
plugin_init()
{
    
register_plugin("Testing""1.0.0""偶萤蛉(Oinling)");
    
    
RegisterHam(Ham_Spawn"player""Player_Spawn_Post"1);
    
register_forward(FM_PlayerPreThink"Player_PreThink_Pre");
    
    
#if AMXX_VERSION_NUM < 183
    
SetContantValue(m_isCrouching2513);
    
SetContantValue(m_jumpTimestamp2532);
    
#else
    
SetContantValue(m_isCrouchingfind_ent_data_info("CBot""m_isCrouching"));
    
SetContantValue(m_jumpTimestampfind_ent_data_info("CBot""m_jumpTimestamp"));
    
#endif
}

public 
Player_Spawn_Post(playerEntId)
{
    if (!
is_user_alive(playerEntId)) return;
    if (
is_user_bot(playerEntId)) return;
    
client_cmd(playerEntId"-duck");
}

public 
Player_PreThink_Pre(playerEntId)
{
    if (!
is_user_alive(playerEntId)) return;
    if (
is_user_bot(playerEntId))
    {
        
set_pdata_bool(playerEntIdm_isCrouchingtrue);
        
set_pdata_float(playerEntIdm_jumpTimestampget_gametime());
    }
    else if (!
pev(playerEntIdpev_bInDuck) && !(pev(playerEntIdpev_flags) & FL_DUCKING))
    {
        
client_cmd(playerEntId"+duck");
    }
}

static 
SetContantValue(const &fakeConstantnewValue)
{
    
setarg(0, .value newValue);
}

#if AMXX_VERSION_NUM < 183
static set_pdata_bool(entcharBasedOffset, {_bool}:valueintBaseLinuxDiff 5)
{
    
value &= 0xFF;
    new 
intOffsetValue get_pdata_int(entcharBasedOffset 4intBaseLinuxDiff);
    new 
bitDecal = (charBasedOffset 4) * 8;
    
intOffsetValue &= ~(0xFF << bitDecal); // clear byte
    
intOffsetValue |= value << bitDecal;
    
set_pdata_int(entcharBasedOffset 4intOffsetValueintBaseLinuxDiff);
}
#endif 

Last edited by Leech_v2; 12-04-2023 at 02:18.
Leech_v2 is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 12-05-2023 , 07:54   Re: How to force players to squat down? Is there a better way?
Reply With Quote #2

See my Spawn at last place plugin: https://forums.alliedmods.net/showthread.php?t=276502
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
Leech_v2
Senior Member
Join Date: Mar 2011
Location: Chinese GuangDong
Old 12-06-2023 , 12:37   Re: How to force players to squat down? Is there a better way?
Reply With Quote #3

Quote:
Originally Posted by georgik57 View Post
As I said, I have tried the fakemeta versions of these methods.

That code cannot even make the player truly squat. It can only automatically squat when the player teleports to a narrow area, so as not to get stuck. Once in an open area, players will maintain an upright posture.
Leech_v2 is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 12-07-2023 , 06:37   Re: How to force players to squat down? Is there a better way?
Reply With Quote #4

If it works once it should work while spamming it too
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
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 20:20.


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