AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   No knife footsteps (https://forums.alliedmods.net/showthread.php?t=133277)

Gadzislaw007 07-23-2010 16:37

No knife footsteps
 
Hi. I wonder how could i make that if user holds knife he does not make footsteps.
I don't really understand CurrentWeapon event and functions about it, so please?

PattyBiena 07-23-2010 17:10

Re: No knife footsteps
 
PHP Code:

#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink")
}

public 
fw_PlayerPreThink(id)
{
    if (
is_user_alive(id) && get_user_weapon(id) == CSW_KNIFE)
        
set_pev(idpev_flTimeStepSound999)



Gadzislaw007 07-23-2010 18:19

Re: No knife footsteps
 
Thanks! But doesn't playerprethink 'eat' some more memory than CurWeap?

drekes 07-23-2010 19:22

Re: No knife footsteps
 
PHP Code:

#include <amxmodx>
#include <fun>

public plugin_init()
{
    
register_plugin("No footsteps with knife""1.0""Drekes");
    
    
register_event("CurWeapon""Event_CurWeapon""be");
}

public 
Event_CurWeapon(id)
{
    new 
weapon get_user_weapon(id);
    
    if(!
is_user_alive(id))
        return 
PLUGIN_CONTINUE;
        
    if(
weapon == CSW_KNIFE)
    {
        
set_user_footsteps(id1);
        return 
PLUGIN_CONTINUE;
    }    

    
set_user_footsteps(id0);

    return 
PLUGIN_CONTINUE;



Peoples Army 07-23-2010 19:24

Re: No knife footsteps
 
Yes running a think command to get weapon events is extremely cpu intensive.

Gadzislaw007 07-23-2010 19:41

Re: No knife footsteps
 
Thanks for the help.
Now, because of you, I'm little smarter in AMXX :D.


All times are GMT -4. The time now is 00:09.

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