Member
|
09-25-2020
, 17:57
Re: help register_event
|
#24
|
Quote:
Originally Posted by AnimalMonster
ok let me test by myself then imma see what s the problem and fix that.
w8, what amxx do you have?? i use 1.9.0 and it's already included in the amxmodx include. if you don't use atleast 1.8.3 get the dhudmessage include then try again
|
i add it
still dose not work
and i am using 1.8.2
Quote:
Originally Posted by Supremache
I made this plugin yesterday, for coutdown timer, follow steps and you will know how to do that !!
P.s: Use "show_hudmessage" not "SyncObj hud"
Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Countdown"
#define VERSION "1.0"
#define AUTHOR "Supremache"
new PrecacheSoundList[10][] =
{
"fvox/one.wav", "fvox/two.wav", "fvox/three.wav", "fvox/four.wav", "fvox/five.wav",
"fvox/six.wav", "fvox/seven.wav", "fvox/eight.wav", "fvox/nine.wav", "fvox/ten.wav"
};
new iCountdown
new iTime
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("HLTV", "EventRoundStart", "a", "1=0", "2=0")
}
public plugin_precache()
{
for(new i = 0; i <= charsmax(PrecacheSoundList); i++)
{
precache_sound( PrecacheSoundList[i] )
}
}
public EventRoundStart()
{
set_task(4.0, "ZombieCountdown")
iTime = 10
iCountdown = 10
}
public ZombieCountdown()
{
iCountdown--
emit_sound( 0, CHAN_VOICE, PrecacheSoundList[ iCountdown ], 1.0, ATTN_NORM, 0, PITCH_NORM )
set_hudmessage(179, 0, 0, -1.0, 0.28, 2, 0.02, 1.0, 0.01, 0.1, 10);
show_hudmessage(0, "Infection in %i", iTime);
--iTime;
if(iTime >= 1)
{
set_task(1.0, "ZombieCountdown")
}
}
|
i will try it
Quote:
Originally Posted by Bugsy
There are a few issues in your code
Spoiler
PHP Code:
#include <amxmodx>
#define PLUGIN "Countdown" #define VERSION "1.0" #define AUTHOR "Supremache"
const TaskStartCountdown = 34234243; const TaskCountdown = 34234244;
new const PrecacheSoundList[ 11 ][] = { "", "fvox/one.wav", "fvox/two.wav", "fvox/three.wav", "fvox/four.wav", "fvox/five.wav", "fvox/six.wav", "fvox/seven.wav", "fvox/eight.wav", "fvox/nine.wav", "fvox/ten.wav" };
new g_iCountdown
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) //This is new round,. not round start //register_event("HLTV", "EventRoundStart", "a", "1=0", "2=0") //This is round start register_logevent( "EventRoundStart" , 2 , "1=Round_Start" ) }
public plugin_precache() { //This should be < not <= //You need to use sizeof() not charsmax() when working with arrays. Charsmax is only used //when working with a string. This here is an array of strings, so you should treat it as an //array in this context. for ( new i = 0 ; i < sizeof( PrecacheSoundList ); i++ ) { if ( PrecacheSoundList[ i ][ 0 ] != EOS ) precache_sound( PrecacheSoundList[ i ] ) } }
public EventRoundStart() { //It's not ideal to repeatedly call set_task(), so you should call it once with flag a and set the //repeat parameter to the appropriate number of times. if ( !task_exists( TaskStartCountdown ) && !task_exists( TaskCountdown ) ) set_task( 4.0 , "StartCountdown" , TaskStartCountdown ); }
public StartCountdown() { set_task( 1.0 , "ZombieCountdown" , TaskCountdown , .flags="a" , .repeat= ( g_iCountdown = 10 ) ) }
public ZombieCountdown() { emit_sound( 0 , CHAN_VOICE , PrecacheSoundList[ g_iCountdown ] , 1.0 , ATTN_NORM , 0 , PITCH_NORM ) set_hudmessage(179, 0, 0, -1.0, 0.28, 2, 0.02, 1.0, 0.01, 0.1, 10); show_hudmessage(0, "Infection in %i", g_iCountdown-- ); //It's not ideal to call set_task(), so you should call it once with flag a and set the //repeat parameter to the appropriate number of times. //if(iTime >= 1) //{ // set_task(1.0, "ZombieCountdown") //} }
|
thx for update @Bugsy
Last edited by 1M1e; 09-25-2020 at 17:58.
|
|