Raised This Month: $ Target: $400
 0% 

Plugin Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
asdfdsdf
AlliedModders Donor
Join Date: Aug 2010
Location: Belgium
Old 11-15-2011 , 12:41   Plugin Help
Reply With Quote #1

hello i have a zombie mod server and on that is a countdown remix from here on allied the coders name i forgot but the problem with plugin is when it counts it counts from 10 zp delay on my server is 10 but it counts 10 and on hudmessage its a 9, 9 is 8 etc and on last 1 it again says 10 here is the code whats wrong with sry for bad englisch

PHP Code:
/*********************************************
==============================================
* Infection Countdown For Zombie Plague 4.3+ *
==============================================
Description:
Remake version of zp_server_addon_countdown
by Mr. Apple, borrowed some code from
bcdhud_timer by SAMURAI

Modules:
- csx (for Countdown HUD Message)

Changelog:
1.0 Initial release

 Credits:
 - AMXModx Team (AMXModX 1.8.1)
 - Mercylezz (Zombie Plague 4.3)
 - SAMURAI (bcdhud_timer)
 - Mr. Apple (zp_server_addon_countdown)
********************************************/

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

#define PLUGIN "[ZP] Infection Countdown"
#define VERSION "1.0"
#define AUTHOR "Dels"

new countdown_timer;
new 
g_msgsync;
const 
TASK_ID 1603;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);    
    
register_event("HLTV""event_round_start""a""1=0""2=0");
    
    
//needed for smooth countdown display
    
g_msgsync CreateHudSyncObj();
}
 
public 
plugin_precache()
{
    
precache_sound("fvox/ten.wav");
    
precache_sound("fvox/nine.wav");
    
precache_sound("fvox/eight.wav");
    
precache_sound("fvox/seven.wav");
    
precache_sound("fvox/six.wav");
    
precache_sound("fvox/five.wav");
    
precache_sound("fvox/four.wav");
    
precache_sound("fvox/three.wav");
    
precache_sound("fvox/two.wav");
    
precache_sound("fvox/one.wav");
}

public 
event_round_start()
{
    
//bugfix
    
remove_task(TASK_ID);
    
    
countdown_timer get_cvar_num("zp_delay") - 0;
    
set_task(4.0"countdown"TASK_ID);
}

public 
countdown()
{    
    new 
speak[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" 
    
}

    if (
countdown_timer 1)
    {         
        
emit_sound(0CHAN_VOICEspeak[countdown_timer-1], 1.0ATTN_NORM0PITCH_NORM);
        
set_hudmessage(17900, -1.00.2820.021.00.010.110);    
        
//show_hudmessage(0, "Infection on %i", countdown_timer-1); //old way to display message, little flicker
        
ShowSyncHudMsg(0g_msgsync"Infection on %i"countdown_timer-1); //the new way
    
}
    --
countdown_timer;
        
    if(
countdown_timer >= 1)
    {
        
set_task(1.0"countdown"TASK_ID);
    }
    else
    {
        
emit_sound(0CHAN_VOICEspeak[9], 1.0ATTN_NORM0PITCH_NORM);
        
remove_task(TASK_ID);
    }
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 
asdfdsdf is offline
Dark Style
BANNED
Join Date: Feb 2011
Location: Brazil
Old 11-15-2011 , 14:16   Re: Plugin Help
Reply With Quote #2

Code:
ShowSyncHudMsg(0, g_msgsync, "Infection on %i", countdown_timer-1); //the new way
//--->
ShowSyncHudMsg(0, g_msgsync, "Infection on %i", countdown_timer);
countdown_timer-1;
(For what i understood)
Dark Style is offline
Korxu
Senior Member
Join Date: Sep 2010
Old 11-15-2011 , 14:20   Re: Plugin Help
Reply With Quote #3

Quote:
Originally Posted by Dark Style View Post
Code:
ShowSyncHudMsg(0, g_msgsync, "Infection on %i", countdown_timer-1); //the new way
//--->
ShowSyncHudMsg(0, g_msgsync, "Infection on %i", countdown_timer);
countdown_timer-1;
(For what i understood)
Well, on the first use you show the value of "countdown_timer" less one, but the value don't change never. With the second use, you show the value of "countdown_timer" and later you remove one from this value.

asdfdsdf, you understand it?

Last edited by Korxu; 11-15-2011 at 14:23.
Korxu is offline
asdfdsdf
AlliedModders Donor
Join Date: Aug 2010
Location: Belgium
Old 11-16-2011 , 09:45   Re: Plugin Help
Reply With Quote #4

ye i will try it now thx for the help
asdfdsdf is offline
asdfdsdf
AlliedModders Donor
Join Date: Aug 2010
Location: Belgium
Old 11-16-2011 , 09:56   Re: Plugin Help
Reply With Quote #5

i just tried it but it wont work now it counts right but on 2 i get infected en then it says 10 again weird before i never had this problem heres the code

PHP Code:
/*********************************************
==============================================
* Infection Countdown For Zombie Plague 4.3+ *
==============================================
Description:
Remake version of zp_server_addon_countdown
by Mr. Apple, borrowed some code from
bcdhud_timer by SAMURAI

Modules:
- csx (for Countdown HUD Message)

Changelog:
1.0 Initial release

 Credits:
 - AMXModx Team (AMXModX 1.8.1)
 - Mercylezz (Zombie Plague 4.3)
 - SAMURAI (bcdhud_timer)
 - Mr. Apple (zp_server_addon_countdown)
********************************************/

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

#define PLUGIN "[ZP] Infection Countdown"
#define VERSION "1.0"
#define AUTHOR "Dels"

new countdown_timer;
new 
g_msgsync;
const 
TASK_ID 1603;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);    
    
register_event("HLTV""event_round_start""a""1=0""2=0");
    
    
//needed for smooth countdown display
    
g_msgsync CreateHudSyncObj();
}
 
public 
plugin_precache()
{
    
precache_sound("fvox/ten.wav");
    
precache_sound("fvox/nine.wav");
    
precache_sound("fvox/eight.wav");
    
precache_sound("fvox/seven.wav");
    
precache_sound("fvox/six.wav");
    
precache_sound("fvox/five.wav");
    
precache_sound("fvox/four.wav");
    
precache_sound("fvox/three.wav");
    
precache_sound("fvox/two.wav");
    
precache_sound("fvox/one.wav");
}

public 
event_round_start()
{
    
//bugfix
    
remove_task(TASK_ID);
    
    
countdown_timer get_cvar_num("zp_delay") - 1;
    
set_task(4.0"countdown"TASK_ID);
}

public 
countdown()
{    
    new 
speak[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" 
    
}

    if (
countdown_timer 1)
    {         
        
emit_sound(0CHAN_VOICEspeak[countdown_timer-1], 1.0ATTN_NORM0PITCH_NORM);
        
set_hudmessage(17900, -1.00.2820.021.00.010.110);    
        
//show_hudmessage(0, "Infection on %i", countdown_timer-1); //old way to display message, little flicker
        
ShowSyncHudMsg(0g_msgsync"Infection on %i"countdown_timer-1); //the new way
//--->
ShowSyncHudMsg(0g_msgsync"Infection on %i"countdown_timer);
countdown_timer-1;
    }
    --
countdown_timer;
        
    if(
countdown_timer >= 1)
    {
        
set_task(1.0"countdown"TASK_ID);
    }
    else
    {
        
emit_sound(0CHAN_VOICEspeak[9], 1.0ATTN_NORM0PITCH_NORM);
        
remove_task(TASK_ID);
    }
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 
asdfdsdf is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 11-16-2011 , 10:56   Re: Plugin Help
Reply With Quote #6

This should help you understand how a countdown works.

Also you don't have to precache the number sounds, they are default sounds so everybody has them.

And instead of having a const with the sounds, check the num_to_word native.
You can see how that works in my countdown plugin here
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Reply



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:29.


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