AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need help with program (https://forums.alliedmods.net/showthread.php?t=233201)

BuNdEvA 01-11-2014 08:53

Need help with program
 
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...

wickedd 01-11-2014 09:00

Re: Need help with program
 
1.Post your code in [PHP] or [CODE] tags.
2.Explain what you are try to do.

Zerk0o0o0 01-12-2014 10:12

Re: Need help with program
 
Nice idea man, i now see what you doing. Very nice.

ConnorMcLeod 01-13-2014 00:59

Re: Need help with program
 
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.


All times are GMT -4. The time now is 10:07.

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