Raised This Month: $ Target: $400
 0% 

Problem with Silencing Footsteps with FM


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mlk27
Veteran Member
Join Date: May 2008
Old 01-13-2009 , 23:22   Problem with Silencing Footsteps with FM
Reply With Quote #1

i dont know what is wrong. when players join they can't hear their footsteps when they are walking until they make a jump.

Code:
#include <amxmodx>
#include <fakemeta>

new bool:g_footstep_set[33] = false;
new g_MaxPlayers

public plugin_init()
{
	register_clcmd("say /off_footsteps", "footsteps")

	register_event("DeathMsg", "eDeathMsg", "a")
	register_event("HLTV", "eNewRound", "a", "1=0", "2=0");
	
	register_forward(FM_PlayerPreThink, "fw_prethink")

	g_MaxPlayers = get_maxplayers()
}

public client_putinserver(id)
{
	g_footstep_set[id] = false;
	fm_set_user_footsteps(id, false)
}

public client_disconnect(id)
{
	g_footstep_set[id] = false;
	fm_set_user_footsteps(id, false)
}

public eDeathMsg()
{
	new id = read_data(2)

	fm_set_user_footsteps(id, false)
}

public eNewRound()
{
	for(new id; id <= g_MaxPlayers; id++)
	{
		g_footstep_set[id] = false;
		fm_set_user_footsteps(id, false)
	}
}

public fw_prethink(id) 
{
    if(g_footstep_set[id])
        set_pev(id, pev_flTimeStepSound, 999);
}

public footsteps(id)
{
	fm_set_user_footsteps(id, true)
	client_print(id, print_chat, "Your footsteps are silenced.")
}

stock fm_set_user_footsteps(id, bool:set = true)
{
	set_pev(id, pev_flTimeStepSound, set ? 999.0 : 400.0)
	g_footstep_set[id] = set;
	
	return 1;
}
Mlk27 is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-14-2009 , 00:00   Re: Problem with Silencing Footsteps with FM
Reply With Quote #2

Code:
#include <amxmodx> #include <fakemeta> #define VERSION "1.0" public plugin_init() {     register_plugin("No Footsteps", VERSION, "Dores");         register_forward(FM_PlayerPreThink, "Forward_PreThink"); } public Forward_PreThink(id) {     if(is_user_alive(id))     {         set_pev(id, pev_flTimeStepSound, 999999.0);     }         return FMRES_HANDLED; }
Dores is offline
Mlk27
Veteran Member
Join Date: May 2008
Old 01-14-2009 , 00:20   Re: Problem with Silencing Footsteps with FM
Reply With Quote #3

so to enable footsteps back, use pev_flTimeStepSound 400.0 ?

aah never mind. i've just figured out that i need to make a boolean cvar in prethink to enable/disable that set_pev

thanks anyway!

+k

Last edited by Mlk27; 01-14-2009 at 00:37.
Mlk27 is offline
zwfgdlc
Senior Member
Join Date: May 2006
Old 01-14-2009 , 00:55   Re: Problem with Silencing Footsteps with FM
Reply With Quote #4

try this.not tested.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN_NAME    "No Footsteps"
#define PLUGIN_VERSION    "1.0"
#define PLUGIN_AUTHOR    "zwfgdlc"

public plugin_init()
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR);
    
registerham(Ham_Spawn,"player","fw_PlayerSpanw",1);
}

public 
fw_PlayerSpanw_Spanw(id)
{
    if(!
is_user_alive(id)) return HAM_IGNORED;
    
    
set_pev(id,pev_flags,pev(id,pev_flags)|FL_DUCKING);
    
    return 
HAM_HANDLED;

zwfgdlc is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-14-2009 , 01:00   Re: Problem with Silencing Footsteps with FM
Reply With Quote #5

Quote:
Originally Posted by zwfgdlc View Post
try this.not tested.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN_NAME    "No Footsteps"
#define PLUGIN_VERSION    "1.0"
#define PLUGIN_AUTHOR    "zwfgdlc"

public plugin_init()
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR);
    
registerham(Ham_Spawn,"player","fw_PlayerSpanw",1);
}

public 
fw_PlayerSpanw_Spanw(id)
{
    if(!
is_user_alive(id)) return HAM_IGNORED;
    
    
set_pev(id,pev_flags,pev(id,pev_flags)|FL_DUCKING);
    
    return 
HAM_HANDLED;

Hum, this will have effects during 1 frame...
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Mlk27
Veteran Member
Join Date: May 2008
Old 01-14-2009 , 01:04   Re: Problem with Silencing Footsteps with FM
Reply With Quote #6

actually i figured this..

Code:
#include <amxmodx>
#include <fakemeta>

new bool:g_footstep_set[33]
new g_MaxPlayers

public plugin_init()
{
	register_clcmd("say /off_footsteps", "Cmd_OffFootSteps")
	register_clcmd("say /on_footsteps", "Cmd_OnFootSteps")

	register_event("DeathMsg", "eDeathMsg", "a")
	register_event("HLTV", "eNewRound", "a", "1=0", "2=0");
	
	register_forward(FM_PlayerPreThink, "FM_PlayerPreThink")

	g_MaxPlayers = get_maxplayers()
}

public client_putinserver(id)
{
	g_footstep_set[id] = false;
}

public client_disconnect(id)
{
	g_footstep_set[id] = false
}

public eDeathMsg()
{
	new id = read_data(2)
	
	g_footstep_set[id] = false
}

public eNewRound()
{
	for(new id; id <= g_MaxPlayers; id++)
	{
		g_footstep_set[id] = false
	}
}

public FM_PlayerPreThink(id) 
{
    if(g_footstep_set[id])
        set_pev(id, pev_flTimeStepSound, 999);
}

public Cmd_OffFootSteps(id)
{
	g_footstep_set[id] = true
	client_print(id, print_chat, "Your footsteps are silenced.")
}

public Cmd_OnFootSteps(id)
{
	g_footstep_set[id] = false
	client_print(id, print_chat, "Your footsteps are not silenced.")
}
Mlk27 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-14-2009 , 01:18   Re: Problem with Silencing Footsteps with FM
Reply With Quote #7

I think you're wrong here :

Code:
public FM_PlayerPreThink(id) 
{
    if(g_footstep_set[id])
        set_pev(id, pev_flTimeStepSound, 999);
}
Should be 999.0 or 999.9 whatever but a float.

I would do :

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define MAX_PLAYERS    32

new bool:g_bNoFootSteps[MAX_PLAYERS+1]
new 
bool:g_bAlive[MAX_PLAYERS+1]

public 
plugin_init()
{
    
RegisterHam(Ham_Spawn"player""Player_Spawn"1)
    
RegisterHam(Ham_Killed"player""Player_Killed"1)
    
RegisterHam(Ham_Player_PreThink"player""Player_PreThink")

    
register_clcmd("say /footsteps""Cmd_FootSteps")
}

public 
client_putinserver(id)
{
    
g_bNoFootSteps[id] = false
}

public 
Player_Spawn(id)
{
    
g_bAlive[id] = bool:is_user_alive[id]
    
//g_bNoFootSteps[id] = false
}

public 
Player_Killed(id)
{
    
g_bAlive[id] = bool:is_user_alive[id]
}

public 
Player_PreThink(id
{
    if(
g_bAlive[id] && g_bNoFootSteps[id])
        
set_pev(idpev_flTimeStepSound999.0)
}

public 
Cmd_FootSteps(id)
{
    
g_bNoFootSteps[id] = !g_bNoFootSteps[id]
    
client_print(idprint_chat"Your footsteps are %ssilenced."g_bNoFootSteps[id] ? "" "not ")

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 01-14-2009 at 01:28.
ConnorMcLeod is offline
Mlk27
Veteran Member
Join Date: May 2008
Old 01-14-2009 , 01:59   Re: Problem with Silencing Footsteps with FM
Reply With Quote #8

oh nice..

what's the different with FM prethink with ham prethink?
Mlk27 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-14-2009 , 06:32   Re: Problem with Silencing Footsteps with FM
Reply With Quote #9

Quote:
Originally Posted by Mlk27 View Post
what's the different with FM prethink with ham prethink?
I think no differences, as with engine forward client_PreThink
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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:45.


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