Raised This Month: $32 Target: $400
 8% 

[REQ] 1v1 countdown before kill


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lolkie02
Junior Member
Join Date: Aug 2018
Old 09-16-2020 , 05:20   [REQ] 1v1 countdown before kill
Reply With Quote #1

Hello Alliedmodders!

I can't find a plugin like this...

If 1v1 (one CT and one T) are left, a countdown of 30 seconds should start.
If they don't kill each other before the 30 seconds, both will be killed.

Anyone know how or where to find this?
lolkie02 is offline
drakunovu6
Member
Join Date: Sep 2017
Old 09-16-2020 , 14:17   Re: [REQ] 1v1 countdown before kill
Reply With Quote #2

Here it is:

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

new cvar_countdowng_countdowng_countdown_hud;

enum (+= 100)
{
    
TASK_COUNTDOWN
}

public 
plugin_init()
{
    
register_plugin("Countdown when 1v1""1.0""Drakunovu");
    
register_event("HLTV""event_new_round""a""1=0""2=0")
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled");
    
    
cvar_countdown register_cvar("countdown_time""30");
    
    
g_countdown_hud CreateHudSyncObj();
}

public 
event_new_round()
    
remove_task(TASK_COUNTDOWN);

public 
fw_PlayerKilled(victimattackershouldgib)
{
    new 
num;
    static 
players[32];
    
get_players(playersnum"ah");

    switch(
num)
    {
        case 
1remove_task(TASK_COUNTDOWN);
        case 
2:
        {
            if (
cs_get_user_team(players[0]) == cs_get_user_team(players[1])) return HAM_IGNORED;

            
g_countdown get_pcvar_num(cvar_countdown);
            
set_task(1.0"countdown"TASK_COUNTDOWN__"b");
        }
    }

    return 
HAM_IGNORED;
}

public 
countdown()
{
    
set_hudmessage(02550, -1.00.2820.021.00.010.110);
    
ShowSyncHudMsg(0g_countdown_hud"Kill each other in %d or slay!"g_countdown);

    new 
number[20];
    
num_to_word(g_countdownnumbercharsmax(number));
    
client_cmd(0"spk ^"fvox/%s^""number); // you can change the sound right here.

    
g_countdown--;

    if (
g_countdown 0)
    {
        
remove_task(TASK_COUNTDOWN);

        new 
num;
        static 
players[32];
        
get_players(playersnum"ah");

        if (
num == 2)
        {
            
user_kill(players[0]);
            
user_kill(players[1]);
        }

        return;
    }

drakunovu6 is offline
lolkie02
Junior Member
Join Date: Aug 2018
Old 09-18-2020 , 04:27   Re: [REQ] 1v1 countdown before kill
Reply With Quote #3

Thank you, it works!
lolkie02 is offline
HaXX0r
Junior Member
Join Date: Apr 2017
Old 09-21-2020 , 14:41   Re: [REQ] 1v1 countdown before kill
Reply With Quote #4

How to change this code so it works with 2 Terrorist only instead of 1 T and 1 CT?
HaXX0r is offline
Reply


Thread Tools
Display Modes

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


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