AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   TimeLeft Extender (last round mapchange block) (https://forums.alliedmods.net/showthread.php?t=54580)

prodigy 04-29-2007 10:44

TimeLeft Extender (last round mapchange block)
 
3 Attachment(s)
TimeLeft Extender 1.2

Author:
prodigy (
[email protected])

A few words before:
I know there are a few plugins "on the market" which do exactly the same, but I thought I'd write a more flexible plugin. Where you can choose the chattime etc.
I also missed the timeleft announcement since it was only displaying "No Time Limit" when those plugins blocked the map change.
These plugins were also missing the language choosing aspect.
The name for this plugin was created when the first idea came up with increasing the time limit. I dropped that idea and kept the name.

Purpose:
This plugin removes the timelimit amx_tle_catchat seconds before mapchange and makes the round end
after the current round, delaying the change for amx_tle_chattime seconds.
When mapchange is blocked, typing timeleft displays that the current round is the last and prevents
showing "No Time Limit" IF you put the plugin BEFORE timeleft.amxx in plugins.ini!

CVars:
Code:

amx_tle_enabled [1]/0  // Controls wether the plugin is enabled or not. (default 1)
amx_tle_usehud [1]/0    // Controls wether to use HUD message announcement or not. (default 1)
amx_tle_chattime [7]    // Controls the time people have to chat before actual change occurs. (default 7)
amx_tle_catchat [5]    // Controls at which second of timeleft the plugin should
                        //  catch the mapchange and block it. (default 5)
amx_tle_textcolor 0-[2] // Sets the color of the "This is the last round" message.
                        //  0 = Normal chat color
                        //  1 = Team color (CT: blue, T: red)
                        //  2 = Green

Commands:
Code:

amx_changenow // Changes map immediatley to current amx_nextmap
say changenow // Changes map immediatley to current amx_nextmap
say timeleft  // If the plugin blocked the mapchange, saying timeleft will
              //  display "This is the last round." in the users language.

Installation:

Method 1:
  • Download the .rar file and extract it into your amxmodx directory. (Answer 'yes' when asked for replacing)
  • Add TimeLeftExtender.amxx before timeleft.amxx in your plugins.ini
Method 2:
  • Download the .amxx file and put it into your amxmodx/plugins directory.
  • Add TimeLeftExtender.amxx before timeleft.amxx in your plugins.ini
  • Download the .txt file and put it into your amxmodx/data/lang folder.
Your plugins.ini file should look something like this:
Code:

[...]
; Map related
nextmap.amxx          ; displays next map in mapcycle
mapchooser.amxx      ; allows to vote for next map

TimeLeftExtender.amxx ; << needs to be in front of timeleft.amxx to
                      ; block it from displaying "No Time Limit"!!
timeleft.amxx        ; displays time left on map
[...]

I also suggest setting amx_time_display to something like this:
Code:

amx_time_display "ab 1200" "ab 600" "ab 300" "ab 180" "ab 60"
Because announcing the last 10 seconds or so isnt that useful since the round has an undefined ending.

Screenshots:
[IMG]http://img265.**************/img265/5742/deaztec0022px6.th.jpg[/IMG]
The first chat message (the green one) comes from the blocking, the following is the answer to "say timeleft".


Currently there are only [en] and [de] translations in the .txt file.
I welcome any further translations and will add them.
You would need to translate this into your language:
Code:

[en]
ADMIN_CHANGENOW_2 = ADMIN %s: Change to nextmap (%s) now.
ADMIN_CHANGENOW_1 = ADMIN: Change to nextmap (%s) now.
LAST_ROUND = This is the last round

Credits:
Code:

- Johnny got his gun @ http://forums.alliedmods.net/showthread.php?p=67909
  For his code about detecting a round end.. and inspiring me to write this
- The AMXX Team for 2 lines of code from the timeleft.sma
- MaximusBrood @ http://forums.alliedmods.net/showthread.php?p=236886
  For the color-code
- neuromancer: For fixing the bug where the plugin "randomly" changed
  the map for some unknown reason

Changelog:
Timeformats are european (dd.mm.yyyy) and in 24h.

Code:

1.2 (17.07.2007):
  Bug Fix:
    o Fixed the bug where the plugin "randomly" changed
        the map for some unknown reason

1.1a (08.05.2007 - 19:44):
    o changed cvars to pcvars

1.1 (30.04.2007 - 00:14):
    Features:
      o Added amx_tle_textcolor and functionality

1.0 (29.04.2007 - 16:44)
    o initial release

0.1 Alpha (29.04.2007)
    o Added functionality for everything in 1.0,
      basically I just renamed the Version number.

//edit1 (Admin Access Information):
I nearly forgot about it. By default ADMIN_MAP (flag f) access is required for the amx_changenow / say changenow commands.

Alka 04-29-2007 10:50

Re: TimeLeft Extender (TLE)
 
um....nice! Basically this is some kind of "extend_map" plugin?

prodigy 04-29-2007 10:54

Re: TimeLeft Extender (TLE)
 
Uhm, well if I know correctly the meaning of "extend_map" plugin.. yes it is.

It is mainly like those plugins with some extra features:
http://forums.alliedmods.net/showthread.php?p=24826
http://forums.alliedmods.net/showthread.php?t=21870

It sets mp_timelimit to 0 amx_tle_catchat seconds before mapchange and waits for the round to end. But with some more features than just simply that.

Alka 04-29-2007 11:02

Re: TimeLeft Extender (TLE)
 
Gj!This is handy...+k :wink:

datwinkle 04-30-2007 18:17

Re: TimeLeft Extender (TLE)
 
nice its like the regular timelimit but with more features! +Karma!

godlike 05-06-2007 05:10

Re: TimeLeft Extender (TLE)
 
tested and runs great. Just use pcvars and this will be approved by a mod.

prodigy 05-08-2007 13:27

Re: TimeLeft Extender (TLE)
 
Should I use them only on my own cvars or the other cvars too?
Like amx_show_activity or mp_timelimit. Is it even possible to do so?

This is my first plugin, I'm sorry about that. :P

Updated with my own cvars as pcvars.

Mordekay 06-26-2007 12:44

Re: TimeLeft Extender (last round mapchange block)
 
The plugin is running, and works on my regular cs 1.6 server
But it seems that on my wc3ft server the plugin changes the map when somebody revives.
Code:

; Map related
nextmap.amxx                ; displays next map in mapcycle
mapchooser.amxx                ; allows to vote for next map
TimeLeftExtender.amxx
timeleft.amxx                ; displays time left on map

Code:

          [ 13] Nextmap Chooser        1.76d    AMXX Dev Team    mapchooser.amxx  running 
          [ 14] TimeLeft Extender      0.1a    prodigy          TimeLeftExtende  running 
          [ 15] TimeLeft                1.76d    AMXX Dev Team    timeleft.amxx    running


Czarny Iwan 07-07-2007 15:27

Re: TimeLeft Extender (last round mapchange block)
 
The plugin works great, but I wonder if there is a posibility to add function like in Lastround v1.0. I mean play one more round when map time is ove or going to be over.

O! I have even better idea. How about to add sound from vox telling "This is the last round". I've checked and vox has sounds needed to do this.

I have one problem. When the last round is very long then map is changing before round ends. What's wrong?

prodigy 07-11-2007 16:03

Re: TimeLeft Extender (last round mapchange block)
 
Hmm, I'm going to check that some time.
I'm kind of busy right now, but I will check that.

If someone else has any ideas you are welcome in fixing these issues. I will add them to the first post when I check back the next time.

@WC3 Mod:
It changes on any revive or only a specific (Warden, Item, etc.?)

But I really don't know why it should change, if warcraft mod isn't triggering a roundend event it should not change.

//edit: I got no problems running Warcraft 3 revives (Warden) with my addon.
Demo: http://home.arcor.de/ts3k/csserv/no-bug.rar (Includes a good example of a situation that might occur that you can't avoid; Last round announcement / round end in nearly the same moment)
Plugins Running: http://home.arcor.de/ts3k/csserv/plugins.ini

@Long rounds:
I'll set roundtime to 9 and then wait for the round end, checking that now too.

//edit2: Got no problems with long rounds either. What plugins are you guys running, could you give me a full plugins.ini and where you got the plugins from (Which warcraft3 version? I'm running http://war3ft.net/ War3FT Mod 3.0 RC8 )
Demo: http://home.arcor.de/ts3k/csserv/longrounds.rar (nearly 10 minutes, have fun :D)

neuromancer 07-16-2007 19:07

Re: TimeLeft Extender (last round mapchange block)
 
It often changes map in a middle of a round, I don't know why...

I've fixed it :)

Find line starting with "register_event" (should be line 107)
And replace it with this:
Code:

register_event("SendAudio","event_roundEnd","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
And that should do it :)

prodigy 07-17-2007 13:34

Re: TimeLeft Extender (last round mapchange block)
 
Well it's line 110. But thanks.
I'll apply that patch and re-upload all the files.

neuromancer 07-18-2007 09:43

Re: TimeLeft Extender (last round mapchange block)
 
I changed it a little
Now it shows nextmap as well and when the last round ends it shows an info again and I set a 5.5 second stop to make players able to see the last man die.

Here's the updated code:
Code:

/*
 *
 *  This program is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU General Public License as published by the
 *  Free Software Foundation; either version 2 of the License, or (at
 *  your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *  General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software Foundation,
 *  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 *  All date formats are in european format (dd.mm.yyyy)
 *
 *                                  _
 *                                | | _
 *              _ __  _ ______  ___| |(_) __ ___  __
 *            | '_ \| '_/  _ \/  _  || |/ _' | \/ /
 *            | |_) | | \ (_) \ (_| || | (_| |\  /
 *            | .__/|_|  \____/\____||_|\__. |/ /
 *            |_|                      |___//_/
 *     
 *  File:    TimeLeftExtender.sma
 *
 *  Title:  TimeLeft Extender
 *
 *  Version: 1.1
 *
 *  Feel free to redistribute and modify this file,
 *  But please give me some credits.
 *
 *  Author:  prodigy
 *          [email protected]
 *
 *  Last Changes:    30.04.2007 (dd.mm.yyyy)
 *
 *  Credits: - Johnny got his gun @ http://forums.alliedmods.net/showthread.php?p=67909
 *            For his code about detecting a round end.. and inspiring me to write this
 *          - The AMXX Team for some code from the timeleft.sma
 *          - MaximusBrood @ http://forums.alliedmods.net/showthread.php?p=236886
 *            For the color-code
 *
 *  Purpose: This plugin removes the timelimit CATCH_MAPCHANGE_AT seconds before mapchange
 *          and makes the round end after the current round delaying the change for
 *          amx_tle_chattime seconds.
 *          When mapchange is blocked typing timeleft displays that the current round is the last.
 *
 *
 *  CVars:
 *          amx_tle_enabled [1]/0  - Controls wether the plugin is enabled or not. (default 1)
 *          amx_tle_usehud [1]/0    - Controls wether to use HUD message announcement or not. (default 1)
 *          amx_tle_chattime [7]    - Controls the time people have to chat before actual change occurs. (default 7)
 *          amx_tle_catchat [5]    - Controls at which second of timeleft the plugin should
 *                                      catch the mapchange and block it. (default 5)
 *          amx_tle_textcolor 0-[2] // Sets the color of the "This is the last round" message.
 *                                  //  0 = Normal chat color
 *                                  //  1 = Team color (CT: blue, T: red)
 *                                  //  2 = Green
 *
 *  Commands:
 *          amx_changenow          - Changes map immediatley to current amx_nextmap
 *          say changenow          - Changes map immediatley to current amx_nextmap
 *          say timeleft          - If the plugin blocked the mapchange, saying timeleft will
 *                                      display "This is the last round." in the users language.
 *
 *  Copyright (c) 2007 by Sebastian G. alias prodigy
 *
 *  Change-Log:
 *    1.1 (30.04.2007):
 *      Features:
 *        o Added amx_tle_textcolor and functionality
 *   
 *    1.0 (29.04.2007):
 *      o initial release
 *
 *    0.1 Alpha (29.04.2007):
 *      o Added functionality for everything in 1.0,
 *        basically I just renamed the Version number.
 */

#include <amxmodx>
#include <amxmisc>

#define TLE_ENABLED "1"
#define DEFAULT_CHATTIME "7"
#define DEFAULT_USEHUD "1"
#define CATCH_MAPCHANGE_AT "5" // seconds left when mapchange should be catched and blocked
#define DEFAULT_TEXTCOLOR "2"
#define CHANGE_ACCESS ADMIN_MAP

new bool:g_mrset
new g_timelimit
new cvar_tle_enabled, cvar_tle_chattime, cvar_tle_catchat, cvar_tle_usehud, cvar_tle_textcol

public plugin_init() {
  register_plugin("TimeLeft Extender", "0.1a", "prodigy")
  register_dictionary("TimeLeftExtender.txt")
  cvar_tle_enabled  = register_cvar("amx_tle_enabled", TLE_ENABLED)
  cvar_tle_chattime = register_cvar("amx_tle_chattime", DEFAULT_CHATTIME)
  cvar_tle_catchat  = register_cvar("amx_tle_catchat", CATCH_MAPCHANGE_AT) // changes are only registered after a map change
  cvar_tle_usehud  = register_cvar("amx_tle_usehud", DEFAULT_USEHUD) // use hud message?
  cvar_tle_textcol  = register_cvar("amx_tle_textcolor", DEFAULT_TEXTCOLOR) // text color to use
  register_event("SendAudio","event_roundEnd","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
  register_clcmd("amx_changenow", "changeNow", CHANGE_ACCESS, "- changes map immediately to current amx_nextmap")
  register_clcmd("say changenow", "changeNow", CHANGE_ACCESS, "- changes map immediately to current amx_nextmap")
  register_clcmd("say timeleft", "timeleftInfo", 0, "- when timelimit is 0 displays last round")

  g_mrset = false
  set_task(get_pcvar_float(cvar_tle_catchat), "initMapchangeEvent", 901337, "", 0, "d", 1) // Catch mapchange amx_tle_catchat seconds before change
}

public timeleftInfo(id)
{
  if(g_mrset == true)
  {
    new nextmap[32]
    get_cvar_string("amx_nextmap", nextmap, 31)
    client_print(0, print_chat, "%L", LANG_PLAYER, "LAST_ROUND", nextmap)
    return PLUGIN_HANDLED
  }
  return PLUGIN_CONTINUE
}

public changeNow(id)
{
  if(get_pcvar_num(cvar_tle_enabled))
  {
    if(access(id, ADMIN_MAP))
    {
      new name[64], nextmap[32]
      get_user_name(id, name, 63)
      get_cvar_string("amx_nextmap", nextmap, 31)
      switch(get_cvar_num("amx_show_activity"))
      {
        case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_CHANGENOW_2", name, nextmap)
        case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_CHANGENOW_1", nextmap)
      }
      initMapChange()
      return PLUGIN_HANDLED
    }
    return PLUGIN_CONTINUE
  }
  return PLUGIN_CONTINUE
}

public event_roundEnd() // roundend hook
{
  if(g_mrset == true)
  {
    g_mrset = false

    new colorstring[5]
    switch(get_pcvar_num(cvar_tle_textcol))
      {
        case 2: copy(colorstring, 4, "^x04")
        case 1: copy(colorstring, 4, "^x03")
        case 0: copy(colorstring, 4, "^x01")
      }
      new nextmap[32]
      get_cvar_string("amx_nextmap", nextmap, 31)
      new message[64]
      format(message, 61, "%s%L", colorstring, LANG_PLAYER, "ROUND_END", nextmap)
      remove_task(901337)

      new plist[32], playernum, player;
      get_players(plist, playernum, "c");
      for(new i = 0; i < playernum; i++)
      {
        player = plist[i];
        message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, player);
        write_byte(player);
        write_string(message);
        message_end();
      }
      if(get_pcvar_num(cvar_tle_usehud))
      {
        set_hudmessage(0, 255, 0, -1.0, 0.1)
        show_hudmessage(0, "%L", LANG_PLAYER, "ROUND_END", nextmap)
      }
    set_task(5.5, "resetTimeLimit")
    set_task(5.5, "initMapChange")
  }
  return PLUGIN_CONTINUE
}

public initMapchangeEvent() // initiate the main event, setting timelimit to 0 etc..
{
  if(get_pcvar_num(cvar_tle_enabled))
  {
    new nextmap[32]
    get_cvar_string("amx_nextmap", nextmap, 31)
    new m_timeleft = get_timeleft()
    new colorstring[5]
    if(m_timeleft <= get_pcvar_num(cvar_tle_catchat) && g_mrset == false)
    {
      switch(get_pcvar_num(cvar_tle_textcol))
      {
        case 2: copy(colorstring, 4, "^x04")
        case 1: copy(colorstring, 4, "^x03")
        case 0: copy(colorstring, 4, "^x01")
      }
      new message[64]
      format(message, 61, "%s%L", colorstring, LANG_PLAYER, "LAST_ROUND", nextmap)
      remove_task(901337)

      new plist[32], playernum, player;
      get_players(plist, playernum, "c");
      for(new i = 0; i < playernum; i++)
      {
        player = plist[i];
        message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, player);
        write_byte(player);
        write_string(message);
        message_end();
      }

      if(get_pcvar_num(cvar_tle_usehud))
      {
        set_hudmessage(0, 255, 0, -1.0, 0.1)
        show_hudmessage(0, "%L", LANG_PLAYER, "LAST_ROUND", nextmap)
      }
      g_mrset = true
      g_timelimit = get_cvar_num("mp_timelimit")
      set_cvar_num("mp_timelimit", 0)
    }
  }
}

public resetTimeLimit() // reset timelimit to value used before setting it to 0
{
  set_cvar_num("mp_timelimit", g_timelimit)
}

public initMapChange() // initiate the change
{
  message_begin(MSG_ALL, SVC_INTERMISSION) /* Taken from timeleft.sma */ // initiates a mapchange viewing the scores screen
  message_end()                                /*                        */
  set_task(get_pcvar_float(cvar_tle_chattime), "doMapChange", 901338, "", 0, "")
}

public doMapChange() // do the actual change
{
  if(task_exists(901338, 0))
  {
    remove_task(901338);
  }
  new nextmap[32]
  get_cvar_string("amx_nextmap", nextmap, 31)
  server_cmd("changelevel %s", nextmap)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1031\\ f0\\ fs16 \n\\ par }
*/

and updated language file:
Code:

[en]
ADMIN_CHANGENOW_2 = ADMIN %s: Change to the nextmap (%s) now.
ADMIN_CHANGENOW_1 = ADMIN: Change to the nextmap (%s) now.
LAST_ROUND = Last round, the nextmap is %s
ROUND_END = Round is over, changing to %s...

[pl]
ADMIN_CHANGENOW_2 = ADMIN %s: Zmiana na nastepna mape (%s)
ADMIN_CHANGENOW_1 = ADMIN: Zmiana na nastepna mape (%s)
LAST_ROUND = Ostatnia runda, nastepna mapa to %s
ROUND_END = Runda zakonczona, zmiana mapy na %s...


jakubs777 06-24-2010 08:36

Re: TimeLeft Extender (last round mapchange block)
 
slovak

Code:

[sk]
ADMIN_CHANGENOW_2 = ADMIN %s: meni mapu na (%s)
ADMIN_CHANGENOW_1 = ADMIN: Zmenit mapu na (%s)
LAST_ROUND = Toto je posledne kolo!


xD_1991 06-24-2010 09:22

Re: TimeLeft Extender (last round mapchange block)
 
Turkish

Code:

[tr]
ADMIN_CHANGENOW_2 = ADMIN %s: Haritayi (%s) olarak degistirdi.
ADMIN_CHANGENOW_1 = ADMIN: Haritayi (%s) olarak degistirdi.
LAST_ROUND = Bu son tur
ROUND_END = Tur bitti, %s olarak degisiyor...


jingojang 06-24-2013 14:55

Re: TimeLeft Extender (last round mapchange block)
 
If the round passes 0.00 on my server, people respawn when they join. This is a major glitch for jailbreak servers that can go on for more than 10min.

EpsiloN 03-06-2014 15:48

Re: TimeLeft Extender (last round mapchange block)
 
Romanian translation:
Code:

[ro]
ADMIN_CHANGENOW_2 = ADMIN %s: Schimba harta (%s) acum.
ADMIN_CHANGENOW_1 = ADMIN: Schimba harta (%s) acum.
LAST_ROUND = Aceasta este ultima runda.


npax 04-03-2020 17:20

Re: TimeLeft Extender (last round mapchange block)
 
Guys, sorry that I am posting this 13 years later, I am new in the plugins world and I have a problem with this one. Almost every map change when the last round is a bit longer (roundtime is set to 2 minutes) the server stucks and restarts itself and the voice that counts the last 10 secs is there as well.
Please help :)


All times are GMT -4. The time now is 08:25.

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