Raised This Month: $ Target: $400
 0% 

Need help with program


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BuNdEvA
New Member
Join Date: Jan 2014
Old 01-11-2014 , 08:53   Need help with program
Reply With Quote #1

I am trying to make a plugin that plays a sound when you press a key, and a looping sound in the back

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

#define PLUGIN "Key sounds"
#define VERSION "1.0"
#define AUTHOR "BuNdEvA"
#define time 0.75 //how often the sound repeats

public plugin_precache()
{
precache_sound("Zvukovi/kick")	
//add custom sounds here
//precache_sound(sound directory here)

}

public pluginInit() 
{
new sound[81]; 								//repeating sound
new sound1[81];								//duck sound
new sound2[81]; 								//jump sound
new sound3[81];								//a sound
new sound4[81]; 								//d sound
new sound5[81];								//w sound
new sound6[81];								//s sound

sound[] = {"Zvukovi/kick"};
sound1[] = {" "};
sound2[] = {" "};
sound3[] = {" "};
sound4[] = {" "};
sound5[] = {" "};
sound6[] = {" "};

register_plugin(PLUGIN,VERSION,AUTHOR)
register_clcmd("+duck", "playSound1;+duck")
register_clcmd("+jump", "playSound2;+jump")
register_clcmd("+moveleft", "playSound3;+moveleft")
register_clcmd("+moveright", "playSound4;+moveright")
register_clcmd("+forward", "playSound5;+forward")
register_clcmd("+backward", "playSound6;+backward")
}

public soundRepeat()
{
set_task(time, "playRepeatSound", _, _, _, "b")
}

public playRepeatSound()
{
client_cmd(0, "spk ^"%s^"", sound)
}

public playSound1() 
{ 
client_cmd(0, "spk ^"%s^"", sound1)

return PLUGIN_HANDLED
} 

public playSound2() 
{ 
client_cmd(0, "spk ^"%s^"", sound2)

return PLUGIN_HANDLED
} 

public playSound3() 
{ 
client_cmd(0, "spk ^"%s^"", sound3)

return PLUGIN_HANDLED
} 

public playSound4() 
{ 
client_cmd(0, "spk ^"%s^"", sound4)

return PLUGIN_HANDLED
} 

public playSound5() 
{ 
client_cmd(0, "spk ^"%s^"", sound5)

return PLUGIN_HANDLED
} 

public playSound6() 
{ 
	
client_cmd(0, "spk ^"%s^"", sound6)

return PLUGIN_HANDLED
}



I'm used to programming in c++ so I wanted to give Pawn a try, it seamed fairly easy, but I clearly don't know how to work it...

Last edited by BuNdEvA; 01-13-2014 at 09:47.
BuNdEvA is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 01-11-2014 , 09:00   Re: Need help with program
Reply With Quote #2

1.Post your code in [PHP] or [CODE] tags.
2.Explain what you are try to do.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Zerk0o0o0
Member
Join Date: Feb 2010
Old 01-12-2014 , 10:12   Re: Need help with program
Reply With Quote #3

Nice idea man, i now see what you doing. Very nice.
Zerk0o0o0 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-13-2014 , 00:59   Re: Need help with program
Reply With Quote #4

Looping sounds are wav sounds with a special marker at the end of the sound, they are automatically looping with the hl player (speak or spk commands), you can add such markers with some sounds editors, there are (only few) threads where the subject has already been discussed, one is pretty ancient in a ambient sound plugin released by 'Simon Logic', the other one i have in mind should date from 2013 second half.
__________________
- 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 10:07.


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