Raised This Month: $ Target: $400
 0% 

optimize script


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
JusTGo
Veteran Member
Join Date: Mar 2013
Old 10-17-2015 , 16:02   optimize script
Reply With Quote #1

Hello, i have this script and i want to use varaible speak[16][] in plugin_precache() but i kind bugged it here unedited script:
PHP Code:
#include <amxmodx>
#include <csx>
#include <amxmisc>
//#include <zombieplague>

#define PLUGIN "[ZP] Infection Countdown Remix"
#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") - 1;
    
set_task(2.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-1]);
            
        
set_hudmessage(17900, -1.00.2820.021.00.010.110);    
        if (
countdown_timer != 1)
            
ShowSyncHudMsg(0g_msgsync"%L"LANG_PLAYER"COUNTDOWN_MSG"countdown_timer-1); //the new way
    
}
    --
countdown_timer;
        
    if(
countdown_timer >= 1)
        
set_task(1.0"countdown"TASK_ID);
    else
        
remove_task(TASK_ID);
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
*/ 
__________________

Last edited by JusTGo; 10-17-2015 at 16:04.
JusTGo 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 22:18.


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