AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ZP 5.0 Countdown Help needed! (https://forums.alliedmods.net/showthread.php?t=300930)

Debrizor 09-03-2017 10:56

ZP 5.0 Countdown Help needed!
 
Hello in this plugin the countdown works fine but i just want to get rid of the "Warning, Biohazard detected" sound when someone gets first zombie... and i cannot change the code because when i do i always get an error.. dont know anything about amx coding or any coding really, so any help would be appreciated.

Heres the code:

PHP Code:

/
#include <amxmodx>
#include <csx>
#include <amxmisc>
#include <zombieplague>

#define PLUGIN "[ZP] Infection Countdown Remix[Martis]"
#define VERSION "1.3"
#define AUTHOR "Dels"

new countdown_timercvar_countdown_sound;
new 
g_msgsync;
const 
TASK_ID 1603;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);    
    
register_event("HLTV""event_round_start""a""1=0""2=0");
    
register_dictionary("zp_countdown_remix.txt");
    
    
//needed for smooth countdown display
    
g_msgsync CreateHudSyncObj();
    
    
//cvars
    
cvar_countdown_sound register_cvar("countdown_sound""1"); //1 to enable, 0 to disable
}
 
public 
plugin_precache()
{
    
precache_sound("fvox/biohazard_detected.wav");
    
precache_sound("fvox/one.wav");
    
precache_sound("fvox/two.wav");
    
precache_sound("fvox/three.wav");
    
precache_sound("fvox/four.wav");
    
precache_sound("fvox/five.wav");
    
precache_sound("fvox/six.wav");
    
precache_sound("fvox/seven.wav");
    
precache_sound("fvox/eight.wav");
    
precache_sound("fvox/nine.wav");
    
precache_sound("fvox/ten.wav");
    
precache_sound("fvox/eleven.wav");
    
precache_sound("fvox/twelve.wav");
    
precache_sound("fvox/thirteen.wav");
    
precache_sound("fvox/fourteen.wav");
    
precache_sound("fvox/fifteen.wav");
}

public 
event_round_start()
{
    
//bugfix
    
remove_task(TASK_ID);
    
    
countdown_timer get_cvar_num("zp_gamemode_delay") - 3;
    
set_task(5.0"countdown"TASK_ID);
}

public 
countdown()
{    
    new 
speak[16][] = { 
        
"fvox/biohazard_detected.wav",
    
"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",
    
"fvox/eleven.wav",
    
"fvox/twelve.wav",
    
"fvox/thirteen.wav",
    
"fvox/fourteen.wav",
    
"fvox/fifteen.wav"
    
}

    if (
countdown_timer 1)
    { 
        
//emit_sound(0, CHAN_VOICE, speak[countdown_timer-1], 1.0, ATTN_NORM, 0, PITCH_NORM);
        
if (cvar_countdown_sound != 0)
            
client_cmd(0"spk %s"speak[countdown_timer-2]);
            
        
set_hudmessage(17900, -1.00.2820.021.00.010.110);    
        if (
countdown_timer != 1)
            
ShowSyncHudMsg(0g_msgsync"%L"LANG_PLAYER"COUNTDOWN_MSG"countdown_timer-2); //the new way
    
}
    --
countdown_timer;
        
    if(
countdown_timer >= 1)
        
set_task(1.0"countdown"TASK_ID);
    else
        
remove_task(TASK_ID);



Natsheh 09-03-2017 13:02

Re: ZP 5.0 Countdown Help needed!
 
PHP Code:

#include <amxmodx> 
#include <csx> 
#include <amxmisc> 
#include <zombieplague> 

#define PLUGIN "[ZP] Infection Countdown Remix[Martis]" 
#define VERSION "1.3" 
#define AUTHOR "Dels" 

new Float:countdown_timercvar_countdown_sound,  zp_gamemode_delay;
new 
g_msgsyncbool:countdownstarted;
const 
TASK_ID 16099

new const 
speak[][] = {  
    
"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"
    
"fvox/eleven.wav"
    
"fvox/twelve.wav"
    
"fvox/thirteen.wav"
    
"fvox/fourteen.wav"
    
"fvox/fifteen.wav" 
    


public 
plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR);     
    
register_event("HLTV""event_round_start""a""1=0""2=0"); 
    
register_dictionary("zp_countdown_remix.txt"); 
     
    
//needed for smooth countdown display 
    
g_msgsync CreateHudSyncObj(); 
     
    
//cvars 
    
cvar_countdown_sound register_cvar("countdown_sound""1"); //1 to enable, 0 to disable 

     
zp_gamemode_delay get_cvar_pointer("zp_gamemode_delay");
}
  
public 
plugin_precache() 

    for(new 
isizeof speak;i++)
    {
             
precache_sound(speak[i]);
    }
}

public 
zp_round_ended()
{
    
remove_task(TASK_ID);
    
countdownstarted false;
}

public 
event_round_start() 

     if(!
get_pcvar_num(cvar_countdown_sound) ||   countdownstarted  ) return
    
//bugfix
    
countdownstarted true;
    
remove_task(TASK_ID); 
     
    
countdown_timer float((get_pcvar_num(zp_gamemode_delay) - sizeof speak)); 
    if(
countdown_timer 0.0set_task(countdown_timer"precountdown"TASK_ID);
    else 
precountdown()
}
public 
precountdown()
{
           
countdown_timer floatclamp(get_pcvar_float(zp_gamemode_delay), 0.0float(sizeof speak)); 
           
countdown()
           if(
countdown_timer 0.0set_task(1.0"precountdown"TASK_ID__"b");
}
public 
countdown() 
{
    
countdown_timer-= 1.0;
    if (
countdown_timer >= 0.0
    {
        
client_cmd(0"spk %s"speak[floatround(countdown_timer)]); 
             
        
set_hudmessage(17900, -1.00.2820.021.00.010.110);
            
ShowSyncHudMsg(0g_msgsync"%L"LANG_PLAYER"COUNTDOWN_MSG"floatround(countdown_timer)+1);
    }
    else
    {
            
remove_task(TASK_ID);
            
countdownstarted false;
        }



Next time post in the right section

Debrizor 09-03-2017 15:27

Re: ZP 5.0 Countdown Help needed!
 
Quote:

Originally Posted by Natsheh (Post 2546269)
PHP Code:

#include <amxmodx> 
#include <csx> 
#include <amxmisc> 
#include <zombieplague> 

#define PLUGIN "[ZP] Infection Countdown Remix[Martis]" 
#define VERSION "1.3" 
#define AUTHOR "Dels" 

new Float:countdown_timercvar_countdown_sound,  zp_gamemode_delay;
new 
g_msgsync;
const 
TASK_ID 16099

new const 
speak[][] = {  
    
"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"
    
"fvox/eleven.wav"
    
"fvox/twelve.wav"
    
"fvox/thirteen.wav"
    
"fvox/fourteen.wav"
    
"fvox/fifteen.wav" 
    


public 
plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR);     
    
register_event("HLTV""event_round_start""a""1=0""2=0"); 
    
register_dictionary("zp_countdown_remix.txt"); 
     
    
//needed for smooth countdown display 
    
g_msgsync CreateHudSyncObj(); 
     
    
//cvars 
    
cvar_countdown_sound register_cvar("countdown_sound""1"); //1 to enable, 0 to disable 

     
zp_gamemode_delay get_cvar_pointer("zp_gamemode_delay");
}
  
public 
plugin_precache() 

    for(new 
isizeof speak;i++)
    {
             
precache_sound(speak[i]);
    }


public 
event_round_start() 

    
//bugfix 
    
remove_task(TASK_ID); 
     
    
countdown_timer = (get_pcvar_num(zp_gamemode_delay) - sizeof speak); 
    if(
countdown_timer 0.0set_task(countdown_timer"precountdown"TASK_ID);
    else 
precountdown()
}
public 
precountdown()
{
           
countdown_timer floatcamp(get_pcvar_num(zp_gamemode_delay), 0.0float(sizeof speak)); 
           
countdown()
           if(
countdown_timer 0.0set_task(1.0"precountdown"TASK_ID__"a"floatround(countdown_timer));
}
public 
countdown() 
{
    
countdown_timer--;
    if (
countdown_timer >= 0.0
    {
        
client_cmd(0"spk %s"speak[floatround(countdown_timer)]); 
             
        
set_hudmessage(17900, -1.00.2820.021.00.010.110);
            
ShowSyncHudMsg(0g_msgsync"%L"LANG_PLAYER"COUNTDOWN_MSG"floatround(countdown_timer)+1);
    }
    else 
remove_task(TASK_ID);



Next time post in the right section

I'm sorry thats my very first post here...

I tried to compile that code but i got some error. How do i copy the logs from the compiler so that i can show here?

Natsheh 09-03-2017 16:07

Re: ZP 5.0 Countdown Help needed!
 
Post the error log using print screen and attach the img in a link or using the attachments

Its probably from semicolons...

Natsheh 09-03-2017 20:17

Re: ZP 5.0 Countdown Help needed!
 
@kristi It will compile fine but it wont work correctly.

Here i edited the code fixed.

kristi 09-03-2017 20:23

Re: ZP 5.0 Countdown Help needed!
 
https://image.prntscr.com/image/3pre...T67oxe6jgw.png

Natsheh 09-04-2017 08:53

Re: ZP 5.0 Countdown Help needed!
 
Quote:

Originally Posted by kristi (Post 2546341)

Okay thx for the error log now its fixed i fixed the code on the phone....

Debrizor 09-04-2017 09:02

Re: ZP 5.0 Countdown Help needed!
 
Quote:

Originally Posted by Natsheh (Post 2546421)
Okay thx for the error log now its fixed i fixed the code on the phone....


haha, it works... kinda. When you spawn in it counts down from 15 and says 15 over and over again so it loops... then crash (reliable channel overflowed)

Natsheh 09-04-2017 09:08

Re: ZP 5.0 Countdown Help needed!
 
Quote:

Originally Posted by Debrizor (Post 2546429)
haha, it works... kinda. When you spawn in it counts down from 15 and says 15 over and over again so it loops... then crash (reliable channel overflowed)

Which code you have tested mine or his?


Im sure there is nothing wrong with the code...

Debrizor 09-04-2017 09:12

Re: ZP 5.0 Countdown Help needed!
 
Quote:

Originally Posted by Natsheh (Post 2546431)
Which code you have tested mine or his?


Im sure there is nothing wrong with the code...


i tested your fixed code

PHP Code:

#include <amxmodx> 
#include <csx> 
#include <amxmisc> 
#include <zombieplague> 

#define PLUGIN "[ZP] Infection Countdown Remix[Martis]" 
#define VERSION "1.3" 
#define AUTHOR "Dels" 

new Float:countdown_timercvar_countdown_sound,  zp_gamemode_delay;
new 
g_msgsync;
const 
TASK_ID 16099

new const 
speak[][] = {  
    
"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"
    
"fvox/eleven.wav"
    
"fvox/twelve.wav"
    
"fvox/thirteen.wav"
    
"fvox/fourteen.wav"
    
"fvox/fifteen.wav" 
    


public 
plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR);     
    
register_event("HLTV""event_round_start""a""1=0""2=0"); 
    
register_dictionary("zp_countdown_remix.txt"); 
     
    
//needed for smooth countdown display 
    
g_msgsync CreateHudSyncObj(); 
     
    
//cvars 
    
cvar_countdown_sound register_cvar("countdown_sound""1"); //1 to enable, 0 to disable 

     
zp_gamemode_delay get_cvar_pointer("zp_gamemode_delay");
}
  
public 
plugin_precache() 

    for(new 
isizeof speak;i++)
    {
             
precache_sound(speak[i]);
    }


public 
event_round_start() 

     if(!
get_pcvar_num(cvar_countdown_sound)) return
    
//bugfix 
    
remove_task(TASK_ID); 
     
    
countdown_timer float((get_pcvar_num(zp_gamemode_delay) - sizeof speak)); 
    if(
countdown_timer 0.0set_task(countdown_timer"precountdown"TASK_ID);
    else 
precountdown()
}
public 
precountdown()
{
           
countdown_timer floatclamp(get_pcvar_float(zp_gamemode_delay), 0.0float(sizeof speak)); 
           
countdown()
           if(
countdown_timer 0.0set_task(1.0"precountdown"TASK_ID__"a"floatround(countdown_timer));
}
public 
countdown() 
{
    
countdown_timer-= 1.0;
    if (
countdown_timer >= 0.0
    {
        
client_cmd(0"spk %s"speak[floatround(countdown_timer)]); 
             
        
set_hudmessage(17900, -1.00.2820.021.00.010.110);
            
ShowSyncHudMsg(0g_msgsync"%L"LANG_PLAYER"COUNTDOWN_MSG"floatround(countdown_timer)+1);
    }
    else 
remove_task(TASK_ID);




All times are GMT -4. The time now is 09:56.

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