AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Running functions on mp_timelimit (https://forums.alliedmods.net/showthread.php?t=196690)

Sutar 09-24-2012 10:15

Running functions on mp_timelimit
 
For example, I have a hard mp_timelimit = 20 in server.cfg

ow to make the launch map_times() in plagin After having passed the 19 mint on card?

PHP Code:

#include <amxmodx>

public plugin_init() 
{
    
register_plugin("Test""1.0""Author")
}

public 
map_times()
{
...


So I did so, like running, but as you see failures would not be?

PHP Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
    
register_plugin("Nextmap Chooser""1.5""Sutar")
    
set_task(1.0"time_maps");
}

public 
time_maps()
    
set_task((get_timeleft() - 60.0), "cmd");

public 
cmd()
    
client_print(0print_chat"Vote Change Map - Start."); 

Here's wanted to do so, but did not work ...

PHP Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
    
register_plugin("Nextmap Chooser""1.5""Sutar")
    
set_task((get_pcvar_float(get_cvar_pointer("mp_timelimit")) - 60.0), "cmd");
}

public 
cmd()
    
client_print(0print_chat"Vote Change Map - Start.");



fysiks 09-24-2012 18:42

Re: Running functions on mp_timelimit
 
This is done in mapchooser.sma (It's for 129 seconds remaining; you would use 60). Look there to see how to do it.

Sutar 09-25-2012 10:00

Re: Running functions on mp_timelimit
 
I downloaded on the Internet, and in the script that I have, I can not understand how it works ...
Decided to write))
So I did this:

Quote:

#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
register_plugin("Nextmap Chooser", "1.5", "Sutar")
set_task(1.0, "time_maps");
}

public time_maps()
{
set_task((get_timeleft() - 60.0), "cmd_say_rtvs");
}

public cmd_say_rtvs()
{
if(get_timeleft() <= 60)
client_print(0, print_chat, "Start vote...");
else
set_task(1.0, "time_maps");
}
I want to make just such a work, and if there is a script better - tweak me))

Map lasts 20 minutes.
Players lost her 19 minutes. and start voting.
I have a well as the plug-in, which prolongs the playing time, namely "mp_timelimit".

For example, players played 15 minutes (up to 4 minutes of the vote), I extended the map for 15 minutes. And it must be voted nachel after 19 minutes.
Ie if the card is left to the end of 1 minute.

fysiks 09-25-2012 19:59

Re: Running functions on mp_timelimit
 
Copied directly from mapchooser.sma (literally, hence why it is not spaced correctly, you should fix the spacing yourself).

PHP Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
        
set_task(15.0"voteNextmap"987456""0"b")
}
public 
voteNextmap()
{
        new 
timeleft get_timeleft()
        
        if (
timeleft || timeleft 129)
        {
        }



Sutar 09-26-2012 02:25

Re: Running functions on mp_timelimit
 
Game server I have not one, and each of them, get_timeleft () is a different meaning.

And with such a script as you have, I failed to do so, so that when the end of the card remains 1 minute, start voting.

Offers can be so rude?

Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
        set_task(19.0, "voteNextmap")
}

public voteNextmap()
{
        if (get_timeleft() <= 60) {
                //start vote
        } else {
              set_task((get_timeleft()-60), "voteNextmap") //If the time card has been extended...
        }
}


fysiks 09-26-2012 20:05

Re: Running functions on mp_timelimit
 
  • Please speak in english. Nothing you just said makes any sense.
  • Your code is nothing like what I posted. If you aren't going to take suggestions then don't ask questions. All you have to do is change teh 129 to 60.

Sutar 09-27-2012 02:11

Re: Running functions on mp_timelimit
 
Your code is sent every 15 minutes using a function. This means that the function will start at 15, 30, 45, 60 ... minutes.
And I need the function starts, when the end of the map remains 1 minute.

Quote:

Please speak in english. Nothing you just said makes any sense.
Sorry, I use google to translate. I just live in Europe)

YamiKaitou 09-27-2012 02:14

Re: Running functions on mp_timelimit
 
Quote:

Originally Posted by Sutar (Post 1807333)
Your code is sent every 15 minutes using a function.

Actually, it is every 15 seconds

Sutar 09-27-2012 06:28

Re: Running functions on mp_timelimit
 
Then what is the best script?
It is best to check every 15 seconds? or check once in about 1293 seconds.

YamiKaitou 09-27-2012 06:50

Re: Running functions on mp_timelimit
 
And what if somebody changes the timeleft mid-map? Or if the current map gets extended? How will you account for those situations? While 15 seconds may be a bit frequent, only checking it once opens your script up to errors


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

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