Raised This Month: $222 Target: $400
 55% 

ThunderClap


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rrduna
Member
Join Date: Nov 2010
Location: Brazil
Old 11-26-2010 , 21:17   ThunderClap
Reply With Quote #1

Want to know how a public event to random sounds of thunder,
event like the thunderclap of the Zombie Plague Mod
If unable to understand perfectly, I want a plugin that performs random sounds of thunder during the game.

I tried writing it did not get more, it is very difficult.
Look, what I did was more or less this:



PHP Code:
public thunderclap(){
    
ArrayGetString(sound_thunderrandom_num(0ArraySize(sound_thunder) - 1), soundcharsmax(sound))
    
PlaySound(sound)


Last edited by rrduna; 11-26-2010 at 21:36.
rrduna is offline
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 11-26-2010 , 22:34   Re: ThunderClap
Reply With Quote #2

PHP Code:
public Thunderclap(id)
{
    
ArrayGetString(sound_thunderrandom_num(0ArraySize(sound_thunder) - 1), soundcharsmax(sound))
    
PlaySound(sound);

    
set_taskrandom_float30.0,  90.0 ), "Thunderclap");

That might work. The fact that set_task is in the function kinda scares me, but you said public event, not sure if you wanted it to be one function.
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME
r4ndomz is offline
Send a message via Skype™ to r4ndomz
rrduna
Member
Join Date: Nov 2010
Location: Brazil
Old 11-27-2010 , 07:36   Re: ThunderClap
Reply With Quote #3

It did not work. Now what do I do?

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Plugin Name"
#define VERSION "1.0"
#define AUTHOR "AMXX-Studio"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
Thunderclap(id){
    
ArrayGetString(sound_thunderrandom_num(0ArraySize(sound_thunder) - 1), soundcharsmax(sound))
    
PlaySound(sound);
    
    
set_taskrandom_float30.0,  90.0 ), "Thunderclap");

rrduna is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 11-27-2010 , 08:55   Re: ThunderClap
Reply With Quote #4

Quote:
Originally Posted by rrduna View Post
It did not work. Now what do I do?

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Plugin Name"
#define VERSION "1.0"
#define AUTHOR "AMXX-Studio"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
Thunderclap(id){
    
ArrayGetString(sound_thunderrandom_num(0ArraySize(sound_thunder) - 1), soundcharsmax(sound))
    
PlaySound(sound);
    
    
set_taskrandom_float30.0,  90.0 ), "Thunderclap");


Code:
#include <amxmodx> new const sound_thunder[] = "the_thunder_clap_sound.wav" public plugin_init() register_plugin("What", "0.0000.0.1", "No oNe :P")     set_task( random_float( 30.060.0 ), "Thunderclap") public plugin_precache() precache_sound( sound_thunder ) public Thunderclap() client_cmd(0, "spk ^"%s^"", sound_thunder)     set_task( random_float( 30.060.0 ), "Thunderclap")
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
rrduna
Member
Join Date: Nov 2010
Location: Brazil
Old 11-27-2010 , 09:37   Re: ThunderClap
Reply With Quote #5

thanks!

how do I add a cvar to set the run time of sound?
rrduna is offline
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 11-27-2010 , 10:40   Re: ThunderClap
Reply With Quote #6

Quote:
Originally Posted by rrduna View Post
thanks!

how do I add a cvar to set the run time of sound?
PHP Code:
#include <amxmodx>

new pcvar_thundertime1
new pcvar_thungertime2
new const sound_thunder[] = "the_thunder_clap_sound.wav"

public plugin_init()
{
    
register_plugin("What""0.0000.0.1""No oNe :P")
    
set_taskrandom_float30.0,  60.0 ), "Thunderclap")
    
pcvar_thundertime1 register_cvar("amx_thundertime1""30.0")
    
pcvar_thundertime2 register_cvar("amx_thundertime2""60.0")
}

public 
plugin_precache()
{
    
precache_soundsound_thunder )
}

public 
Thunderclap() client_cmd(0"spk ^"%s^""sound_thunder)
{
    
set_taskrandom_floatget_pcvar_num(pcvar_thundertime1), get_pcvar_num(pcvar_thundertime2), "Thunderclap")


EDIT: Fixed a mistake in code that i just noticed
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME

Last edited by r4ndomz; 11-27-2010 at 18:28. Reason: fix
r4ndomz is offline
Send a message via Skype™ to r4ndomz
rrduna
Member
Join Date: Nov 2010
Location: Brazil
Old 11-27-2010 , 11:35   Re: ThunderClap
Reply With Quote #7

because two cvars?
rrduna is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 11-27-2010 , 12:32   Re: ThunderClap
Reply With Quote #8

Because if you look at ThunderClap(), the set task is called with a random float between the two cvars, so it actually seems random. You can change them to be the same if you want, which will force it to happen at exact intervals.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
rrduna
Member
Join Date: Nov 2010
Location: Brazil
Old 11-27-2010 , 12:37   Re: ThunderClap
Reply With Quote #9

thanks!
rrduna is offline
rrduna
Member
Join Date: Nov 2010
Location: Brazil
Old 11-27-2010 , 13:24   Re: ThunderClap
Reply With Quote #10

how can I add the sky "space" in scripting?
is there any way to increase the time of light?
the time of light emitted is minimal, very little, one second I think.

help me please!


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

new const PLUGIN   [] = "Thunderclap"
new const VERSION  [] = "1.0"
new const AUTHOR   [] = "Duna"

#define TASKID1 1324687358 

new thunder_sounds[][] = 
{
    
"thunderclap/thunder_clap1",
    
"thunderclap/thunder_clap2"
}

public 
plugin_init() {
    
register_plugin(PLUGIN,VERSION,AUTHOR)
    
set_taskrandom_float30.0,  60.0 ), "thunderclap")
    return 
PLUGIN_CONTINUE;
}

public 
client_putinserver(id){ 
    if(
is_user_bot(id)) 
    return
    
    if(!
task_exists(TASKID1))
    { 
    
Restore_LightStyle() 

}

public 
thunderclap() { 
    
client_cmd(0,"spk %s",thunder_sounds[random(sizeof thunder_sounds)]);
    
set_taskrandom_float30.0,  60.0 ), "thunderclap")
    
    
engfunc(EngFunc_LightStyle0"z")
    if(
task_exists(TASKID1))
    {
    
remove_task(TASKID1
    }
    
set_task(0.4"Restore_LightStyle"TASKID1
    return 
FMRES_HANDLED
}

public 
Restore_LightStyle() {
    
engfunc(EngFunc_LightStyle0"m")
}

public 
plugin_precache() {
    
precache_sound("thunderclap/thunder_clap1.wav");
    
precache_sound("thunderclap/thunder_clap2.wav");

rrduna is offline
Reply


Thread Tools
Display Modes

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 14:58.


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