Raised This Month: $ Target: $400
 0% 

Walk triggers sound?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 10-04-2007 , 10:26   Re: Walk triggers sound?
Reply With Quote #7

Hum, i've maded something...maybe is not the best way but shold work

Code:
#include <amxmodx>
#include <fakemeta>
 
#define PLUGIN "Custom FootSteps Sound"
#define VERSION "1.0"
#define AUTHOR "Alka"
 
new Float:NextCheck[33];
new const FootStepSound[] = "misc/whatever.wav";
 
public plugin_init() {
     register_plugin(PLUGIN, VERSION, AUTHOR);
 
     register_forward(FM_PlayerPostThink, "Fwd_PlayerPostThink");
}
 
public Fwd_PlayerPostThink(id)
{
     if(!is_user_alive(id))
           return;
 
     static Float:gametime;
     gametime = get_gametime();
 
     if(NextCheck[id] < gametime)
     {
          static Float:Velocity[3], Button;
 
          pev(id, pev_velocity, Velocity);
          pev(id, pev_button, Button);
 
          if((Button & IN_FORWARD) || (Button & IN_BACK) || (Button & IN_LEFT) || (Button & IN_RIGHT))
          {
               if(pev(id, pev_flFallVelocity) == 0.0 && floatround(vector_length(Velocity)) != 0.0)
               {
                     emit_sound(id, CHAN_VOICE, FootStepSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
               }
          }
          NextCheck[id] = gametime + 3.0;
     }
}
Is for a sound with 3 sec len. ;)
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 10-04-2007 at 10:33.
Alka is offline
 



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 16:09.


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