Raised This Month: $ Target: $400
 0% 

how i can get sound with command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Leon_12
Senior Member
Join Date: Jul 2010
Location: Bulgaria
Old 11-11-2010 , 13:22   how i can get sound with command
Reply With Quote #1

i try many times to get sound with command but i can't hear this is my code:

Code:
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <hamsandwich>
//Admin Access level
#define ACCESS ADMIN_LEVEL_A
//Plugin Version and Author
#define PLUGIN "Iron Man"
#define VERSION "1.6"
#define AUTHOR "Leon"
new g_health;
new g_gravity;
new g_armor;
new bool:IronMan[33]
public plugin_init() {
 g_health = register_cvar("ironman_health", "1000")
 g_gravity = register_cvar("ironman_gravity", "0.5")
 g_armor = register_cvar("ironman_graviry", "0.5")
 
 register_clcmd("say /ironman", "steroids")
 RegisterHam(Ham_Spawn, "player", "FwdHamSpawn_Post", 1)
}
//Iron Man Model and Sound
public plugin_precache()
{
 precache_model("models/player/ironman/ironman.mdl")
 precache_sound("ironman.wav")
}
public steroids(id)
{
 if((is_user_alive(id) && !IronMan[id]) && (get_user_flags(id) & ACCESS))
 {
  IronMan[id] = true;
  set_user_armor(id, get_pcvar_num(g_armor))
  set_user_health(id, get_pcvar_num(g_health))
  cs_set_user_model( id, "ironman" )
  set_user_gravity(id, float(get_pcvar_num(g_gravity)))
  client_cmd(id,"spk ^"ironman.wav^"") 
 }
 else
 {
  client_printc(id,  "!g[IR]!tYou cant use ironman twice a round");
 }
}
public FwdHamSpawn_Post(id)
{
 if(is_user_alive(id))
 {
  IronMan[id] = false
 }
}
// Colour Chat
stock client_printc(const id, const input[], any:...)
{
 new count = 1, players[32]
 static msg[191]
 vformat(msg, 190, input, 3)
 
 replace_all(msg, 190, "!g", "^x04")
 replace_all(msg, 190, "!n", "^x01")
 replace_all(msg, 190, "!t", "^x03")
 
 if (id) players[0] = id; else get_players(players, count, "ch");
 {
  for (new i = 0; i < count; i++)
  {
   if (is_user_connected(players[i]))
   {
    message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
    write_byte(players[i]);
    write_string(msg);
    message_end();
   }
  }
     }
 }
Leon_12 is offline
Send a message via Skype™ to Leon_12
fearAR
Veteran Member
Join Date: Oct 2010
Old 11-11-2010 , 14:26   Re: how i can get sound with command
Reply With Quote #2

to play a sound .wav try with this:
1st put the sound ironman in the folder "sound"
PHP Code:
new const ironman [] = "sound/ironman.wav"

//in precache
         
precache_sound(ironman)
//finish precache

//and then in the case of the menu put this
    
client_cmd(id"spk ^"%s^""ironman
And that will work, but if the sound cant be hear equalize the sound to:

Mono
Frequency: 8000Hz
bits: 8 bits

at least for me it worked
fearAR is offline
Send a message via MSN to fearAR
Leon_12
Senior Member
Join Date: Jul 2010
Location: Bulgaria
Old 11-12-2010 , 13:37   Re: how i can get sound with command
Reply With Quote #3

lol i can't hear the sound when i say /ironman is this from me or something wrong with the code
Leon_12 is offline
Send a message via Skype™ to Leon_12
TheKidz
Senior Member
Join Date: May 2009
Old 11-12-2010 , 14:11   Re: how i can get sound with command
Reply With Quote #4

when you precache sound or try to reproduce it, u cant put sound/ bcoz its automatic... remove those "sound/" and it should work fine
__________________
TheKidz is offline
Leon_12
Senior Member
Join Date: Jul 2010
Location: Bulgaria
Old 11-12-2010 , 16:13   Re: how i can get sound with command
Reply With Quote #5

i try but i can't hear.
Leon_12 is offline
Send a message via Skype™ to Leon_12
TheKidz
Senior Member
Join Date: May 2009
Old 11-12-2010 , 16:51   Re: how i can get sound with command
Reply With Quote #6

try with client_cmd( id, "speak sound/iroman.wav" )
i was wrong with the reproduced sound sry
__________________
TheKidz 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 13:27.


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