Raised This Month: $ Target: $400
 0% 

Need help with program


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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