AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [REQ] 1v1 countdown before kill (https://forums.alliedmods.net/showthread.php?t=327391)

lolkie02 09-16-2020 05:20

[REQ] 1v1 countdown before kill
 
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?

drakunovu6 09-16-2020 14:17

Re: [REQ] 1v1 countdown before kill
 
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;
    }



lolkie02 09-18-2020 04:27

Re: [REQ] 1v1 countdown before kill
 
Thank you, it works! :)

HaXX0r 09-21-2020 14:41

Re: [REQ] 1v1 countdown before kill
 
How to change this code so it works with 2 Terrorist only instead of 1 T and 1 CT? :)


All times are GMT -4. The time now is 15:10.

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