Raised This Month: $ Target: $400
 0% 

where is the problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RuRuRu612754
Senior Member
Join Date: Sep 2011
Old 07-04-2012 , 20:03   where is the problem
Reply With Quote #1

Hello

my code is compile miss

compile.exe :
PHP Code:
warning 203symbol is never used"sound_damege" 
sound.sma :
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>

new const sound_damage[] =
{
    
"player/damage_1.wav",
    
"player/damage_2.wav",
    
"player/damage_3.wav"
}

public 
plugin_init() 

    
register_plugin("PLUGIN""VERSION""AUTHOR")

    
register_forward(FM_EmitSound"forward_fm_emitsound")
}

public 
plugin_precache()
{
    new 
new_sound random_num(0sizeof(sound_damage))
    
precache_model(new_sound)
}

public 
forward_fm_emitsound(idiChannelsample[], Float:fVolumeFloat:fAttenuationiFlagsiPitch)
{
    if(
is_user_alive(id))
    {
        if(
cs_get_user_team(id) == CS_TEAM_CT)
        {
            if(
equali(sample"weapons/bhit_flesh-1.wav") || equali(sample"weapons/bhit_flesh-2.wav") || equali(sample"weapons/bhit_flesh-3.wav"))
            {
                new 
new_sound random_num(0sizeof(sound_damage))
                
engfunc(EngFunc_EmitSoundidCHAN_STATICnew_sound1.0ATTN_NORM0PITCH_NORM)
            }
        }
    }

Best Regards,
RuRuRu612754 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-04-2012 , 20:37   Re: where is the problem
Reply With Quote #2

As the warning says, you're never actually using the sound_damage string array. You need to precache sound not model. Use random( sizeof(var) ) since that returns a value ranging from 0 to max-1 instead of random_num(0,max) which would error if the max value is returned since the array is indexed from 0 to size-1. There may be other things wrong, I didn't look closely.
PHP Code:
public plugin_precache()
{
    new 
new_sound random_num(0sizeof(sound_damage))
    
precache_model(new_sound)
}

..

new 
new_sound random_num(0sizeof(sound_damage))
engfunc(EngFunc_EmitSoundidCHAN_STATICnew_sound1.0ATTN_NORM0PITCH_NORM

PHP Code:
public plugin_precache()
{
    
precache_soundsound_damagerandomsizeofsound_damage ) ) ] )


..

engfunc(EngFunc_EmitSoundidCHAN_STATICsound_damagerandomsizeofsound_damage ) ) ], 1.0ATTN_NORM0PITCH_NORM
__________________

Last edited by Bugsy; 07-04-2012 at 20:41.
Bugsy is offline
RuRuRu612754
Senior Member
Join Date: Sep 2011
Old 07-04-2012 , 20:53   Re: where is the problem
Reply With Quote #3

@Bugsy

oh. i easy miss...
PHP Code:
new new_sound random_num(0sizeof(sound_damage))
precache_model(new_sound
thanks!!
RuRuRu612754 is offline
RuRuRu612754
Senior Member
Join Date: Sep 2011
Old 07-04-2012 , 22:16   Re: where is the problem
Reply With Quote #4

@Bugsy

sorry
error...

Warning: Unable to open sound/3.wav for transfer

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

new const sound_damage[] =
{
    
"player/damage_1.wav",
    
"player/damage_2.wav",
    
"player/damage_3.wav"
}

public 
plugin_init() 

    
register_plugin("PLUGIN""VERSION""AUTHOR")

    
register_forward(FM_EmitSound"forward_fm_emitsound")
}

public 
plugin_precache()
{
    
precache_sound(sound_damage[random(sizeof(sound_damage))])
}

public 
forward_fm_emitsound(idiChannelsample[], Float:fVolumeFloat:fAttenuationiFlagsiPitch)
{
    if(
is_user_alive(id))
    {
        if(
cs_get_user_team(id) == CS_TEAM_CT)
        {
            if(
equali(sample"weapons/bhit_flesh-1.wav") || equali(sample"weapons/bhit_flesh-2.wav") || equali(sample"weapons/bhit_flesh-3.wav"))
            {
                
engfunc(EngFunc_EmitSoundidCHAN_STATICsound_damage[random(sizeof(sound_damage))], 1.0ATTN_NORM0PITCH_NORM)
            }
        }
    }

RuRuRu612754 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-05-2012 , 03:03   Re: where is the problem
Reply With Quote #5

Make sure the file exists in the correct folder on the server-side.
__________________

Last edited by Bugsy; 07-05-2012 at 03:34.
Bugsy is offline
RuRuRu612754
Senior Member
Join Date: Sep 2011
Old 07-05-2012 , 06:25   Re: where is the problem
Reply With Quote #6

@Bugsy

yes

Warning: Unable to open //sound/damage_3.wav for transfer
RuRuRu612754 is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 07-05-2012 , 06:29   Re: where is the problem
Reply With Quote #7

Show the code you are using, because in code you posted here damage_3 is in player folder.
Code:
new const sound_damage[] =
{
    "player/damage_1.wav",
    "player/damage_2.wav",
    "player/damage_3.wav"
}
OvidiuS is offline
Send a message via Skype™ to OvidiuS
RuRuRu612754
Senior Member
Join Date: Sep 2011
Old 07-05-2012 , 06:39   Re: where is the problem
Reply With Quote #8

@OvidiuS
I have put in a folder to certainty
"sound/player/damage_*.wav"
RuRuRu612754 is offline
RuRuRu612754
Senior Member
Join Date: Sep 2011
Old 07-05-2012 , 08:05   Re: where is the problem
Reply With Quote #9

has been resolve
thanks

how to precache all the sound_damage?

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

new const sound_damage[][] =
{
    
"player/damage_1.wav",
    
"player/damage_2.wav",
    
"player/damage_3.wav"
}

public 
plugin_init()

    
register_plugin("PLUGIN""VERSION""AUTHOR")

    
register_forward(FM_EmitSound"forward_fm_emitsound")
}

public 
plugin_precache()
{
    
precache_sound(sound_damage[random(sizeof(sound_damage))])
}

public 
forward_fm_emitsound(idiChannelsample[], Float:fVolumeFloat:fAttenuationiFlagsiPitch)
{
    if(
is_user_alive(id))
    {
        if(
cs_get_user_team(id) == CS_TEAM_CT)
        {
            if(
equali(sample"weapons/bhit_flesh-1.wav") || equali(sample"weapons/bhit_flesh-2.wav") || equali(sample"weapons/bhit_flesh-3.wav"))
            {
                
engfunc(EngFunc_EmitSoundidCHAN_STATICsound_damage[random(sizeof(sound_damage))], 1.0ATTN_NORM0PITCH_NORM)
            }
        }
    }

RuRuRu612754 is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 07-05-2012 , 08:20   Re: where is the problem
Reply With Quote #10

Code:
public plugin_precache() {     for (new i = 0; i < sizeof(sound_damage); i++)     {         precache_sound(sound_damage[i])     } }
jimaway 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 15:15.


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