Raised This Month: $51 Target: $400
 12% 

Countdown


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RiiCe
Junior Member
Join Date: Jan 2010
Old 01-19-2010 , 03:30   Countdown
Reply With Quote #1

Hi, I want to know how I can make a HUD message that counts down from 10.

I've searched all around the forums and i couldnt find any.

Like the HideNSeek Mod when CTs begin the round they have to count.

What I want is that Ts would have to countdown from 10, whilet the coutndown, they cannot move and has godmode activated so they cant be attacked. Once the countdown is over their movements will be back to normal.

so basicly I want to make a Timer that prevents The Ts from moving during the HUD count down.

Help is much appreiciated.
RiiCe is offline
Dygear
SourceMod Donor
Join Date: Apr 2004
Location: Levittown, NY
Old 01-19-2010 , 03:58   Re: Countdown
Reply With Quote #2

I have no idea how to get when the round starts, and I have no idea how to give players god mode, but this should get you started.

Code:
#include <amxmodx> new iCountDown; plugin_init() {     register_plugin("CountDown", "0.1", "Dygear");     get_count_down(); } public fwSetTask() {     set_task(1.0, "fwCountDown", 30000, "", 0, "a", get_count_down()); } public fwCountDown () {     client_print(0, print_center, iCountDown--);     if (iCountDown == 0) {         remove_task(30000);         iCountDown = get_count_down();     } } get_count_down() {     if (cvar_exists("cvar_countdown") == 1)         iCountDown = get_cvar_num("cvar_countdown");     else         iCountDown = 10;     return iCountDown; }
__________________
Dygear is offline
Send a message via AIM to Dygear Send a message via MSN to Dygear Send a message via Skype™ to Dygear
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 01-19-2010 , 04:04   Re: Countdown
Reply With Quote #3

There is a Whole section in the tut thread about getting round start

and

set_user_godmode(id, 1);

Works just fine make sure you set it to 0 .. I believe it stays till map changes.
Doc-Holiday is offline
RiiCe
Junior Member
Join Date: Jan 2010
Old 01-19-2010 , 04:08   Re: Countdown
Reply With Quote #4

ok, got link?

Last edited by RiiCe; 01-19-2010 at 04:10.
RiiCe is offline
Dygear
SourceMod Donor
Join Date: Apr 2004
Location: Levittown, NY
Old 01-19-2010 , 04:20   Re: Countdown
Reply With Quote #5

Quote:
Originally Posted by RiiCe View Post
ok, got link?
http://forums.alliedmods.net/showthread.php?t=42159
http://www.amxmodx.org/funcwiki.php?go=func&id=114
__________________

Last edited by Dygear; 01-19-2010 at 04:22.
Dygear is offline
Send a message via AIM to Dygear Send a message via MSN to Dygear Send a message via Skype™ to Dygear
RiiCe
Junior Member
Join Date: Jan 2010
Old 01-19-2010 , 04:26   Re: Countdown
Reply With Quote #6

Can someone just code it all out for me? Like combine the Godmode+Countdown
RiiCe is offline
Dygear
SourceMod Donor
Join Date: Apr 2004
Location: Levittown, NY
Old 01-19-2010 , 05:14   Re: Countdown
Reply With Quote #7

So, its more of a plugin request thread then a scripting help thread.
__________________
Dygear is offline
Send a message via AIM to Dygear Send a message via MSN to Dygear Send a message via Skype™ to Dygear
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 01-19-2010 , 12:00   Re: Countdown
Reply With Quote #8

Quote:
Originally Posted by Dygear View Post
I have no idea how to get when the round starts, and I have no idea how to give players god mode, but this should get you started.

Code:
#include <amxmodx> new iCountDown; plugin_init() {     register_plugin("CountDown", "0.1", "Dygear");     get_count_down(); } public fwSetTask() {     set_task(1.0, "fwCountDown", 30000, "", 0, "a", get_count_down()); } public fwCountDown () {     client_print(0, print_center, iCountDown--);     if (iCountDown == 0) {         remove_task(30000);         iCountDown = get_count_down();     } } get_count_down() {     if (cvar_exists("cvar_countdown") == 1)         iCountDown = get_cvar_num("cvar_countdown");     else         iCountDown = 10;     return iCountDown; }
Just to inform you all; this code will not work. You see, for an instance; the plugin_init is not public, get_count_down() in plugin_init does nothing, the "cvar_countdown" doesn't even exist, fwSetTask is not a part of anything.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
Dygear
SourceMod Donor
Join Date: Apr 2004
Location: Levittown, NY
Old 01-19-2010 , 12:51   Re: Countdown
Reply With Quote #9

It was just to get them started, I typed that into notepad ... pseudo code ...
__________________
Dygear is offline
Send a message via AIM to Dygear Send a message via MSN to Dygear Send a message via Skype™ to Dygear
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 01-19-2010 , 14:22   Re: Countdown
Reply With Quote #10

Honestly if i was you. Since im a complete noob at coding and im not trying to give you the wrong idea on code.

But, How is it you want it done with out the count down

For x amount of seconds every one or just certain people have god mode?

Then set it up with a set task say like this

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fun>

#define TASK_TIME 10.0

new g_Switch;

public 
plugin_init() {
    
register_plugin("God Mode Tester""1.0""ME!!!!")
    
    
RegisterHam(Ham_Spawn"player""FwdPlayerSpawn"1);
}

public 
FwdPlayerSpawn(id)
{
    if(
is_user_alive(id))
    {
        
set_user_godmode(id1);
        
set_task(TASK_TIME"RemGmode"id+257);
    }
}

public 
RemGmode(taskid)
{
    new 
id taskid-257;
    
    
set_user_godmode(id0);

Once you have the shell done. Add in the count down. that part i dont know how to do. but player spawn post works just fine for setting god mode.
Doc-Holiday is offline
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 00:21.


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