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

[REQ] Restart Map 24h Cicle


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Accioly04
Junior Member
Join Date: Jan 2014
Old 02-05-2014 , 00:15   [REQ] Restart Map 24h Cicle
Reply With Quote #1

Hello again, I'm sorry for all these requests, but let's go.

My request: Somehow, to restart the map in my server, that doesn't have time left (trade_plaza_2), every day at 5 am. The reason it's for cleaning the unusual effects (this plugin) that lies on the ground around the map.

Thanks!
Accioly04 is offline
Nightshadow999
Member
Join Date: Dec 2012
Old 02-05-2014 , 16:57   Re: [REQ] Restart Map 24h Cicle
Reply With Quote #2

I've made a plugin for my scoutzknivez server a while ago to reload the map every 30 minutes. It forces map reload even when there are no players connected. The only downside for you is that it works with timelimit. But you could set the timelimit to a high value.

Edit: I just noticed that the plugin probably only works on CSS. Sorry.

PHP Code:
#include <sourcemod>
#include <cstrike>

new Handle:g_VoteTimer INVALID_HANDLE;
new 
Handle:g_VoteTimer2 INVALID_HANDLE;
new 
Handle:handle_timer2 INVALID_HANDLE;


public 
Plugin:myinfo =
{
    
name "Map timelimit enforcer",
    
author "i3D Nightshadow",
    
description "",
    
version "1.1",
    
url "http://forum.i3d.net"
};


public 
OnConfigsExecuted()
{   
    
SetupTimeleftTimer();
    
SetNextMap("scoutzknivez");
}

public 
OnMapTimeLeftChanged()
{
    
SetupTimeleftTimer();
}

SetupTimeleftTimer()
{
    new 
time;
    if (
GetMapTimeLeft(time) && time 0)
    {
        new 
startTime 1;
        new 
warningTime 10;
        if (
time startTime 1)
        {
            
PrintToChatAll("[SM] Reloading map immediately..");    
        }
        else
        {
            if (
g_VoteTimer != INVALID_HANDLE)
            {
                
KillTimer(g_VoteTimer);
                
g_VoteTimer INVALID_HANDLE;
            }    
            
g_VoteTimer CreateTimer(float(time startTime), Timer_StartMapVote_TIMER_FLAG_NO_MAPCHANGE);
            
            if (
g_VoteTimer2 != INVALID_HANDLE)
            {
                
KillTimer(g_VoteTimer2);
                
g_VoteTimer2 INVALID_HANDLE;
            }    
            
g_VoteTimer2 CreateTimer(float(time warningTime), Timer_InitiateWarning_TIMER_FLAG_NO_MAPCHANGE);
            
        }        
    }
}

public 
Action:Timer_StartMapVote(Handle:timer)
{
    
g_VoteTimer INVALID_HANDLE;

    
PrintToChatAll("[SM] Restarting map \"scoutzknivez\"..");
    
CS_TerminateRound(5.0CSRoundEnd_Drawfalse);
    
    new 
maxPlayers GetMaxClients();
    for(new 
1<= maxPlayersi++)
    {
        if (
IsClientInGame(i) && IsPlayerAlive(i))
        {
            
SetEntProp(iProp_Data"m_takedamage"01);
            
SetEntityMoveType(iMOVETYPE_LADDER);
        }
    }


    return 
Plugin_Handled;
}

public 
Action:Timer_InitiateWarning(Handle:timer)
{
    
g_VoteTimer2 INVALID_HANDLE;
    
    if(
handle_timer2 != INVALID_HANDLE
    { 
        
KillTimer(handle_timer2); 
        
handle_timer2 INVALID_HANDLE
    } 
    
handle_timer2 CreateTimer(1.0Timer_WarningINVALID_HANDLETIMER_REPEAT);
    return 
Plugin_Handled;
}

public 
Action:Timer_Warning(Handle:timer)    // Repeated timer 


    
// Create a global variable visible only in the local scope (this function).
    
static numPrinted 10;
    
    
PrintHintTextToAll("Warning! The map will reload in %i seconds!"numPrinted);
 
    if (
numPrinted <= 0) {
        
handle_timer2 INVALID_HANDLE;    // Clear Handle before timer end finally! 
        
return Plugin_Stop
    }
 
    
numPrinted--;
    return 
Plugin_Continue;
}  


public 
OnMapEnd()
{
    
g_VoteTimer INVALID_HANDLE;
    
g_VoteTimer2 INVALID_HANDLE;
    
handle_timer2 INVALID_HANDLE;


Last edited by Nightshadow999; 02-05-2014 at 17:00.
Nightshadow999 is offline
Accioly04
Junior Member
Join Date: Jan 2014
Old 02-05-2014 , 18:23   Re: [REQ] Restart Map 24h Cicle
Reply With Quote #3

It's a pitty, that's exactly what I wanted, but instead of 30 minutes, 24 hours. I hope this can be done in TF2 as well.

Last edited by Accioly04; 02-05-2014 at 18:24.
Accioly04 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 02-05-2014 , 18:42   Re: [REQ] Restart Map 24h Cicle
Reply With Quote #4

Quote:
Originally Posted by Accioly04 View Post
Hello again, I'm sorry for all these requests, but let's go.

My request: Somehow, to restart the map in my server, that doesn't have time left (trade_plaza_2), every day at 5 am. The reason it's for cleaning the unusual effects (this plugin) that lies on the ground around the map.

Thanks!
Use the Server Crontab plugin to execute changelevel trade_plaza_2
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 02-05-2014 at 18:44.
Powerlord is offline
Accioly04
Junior Member
Join Date: Jan 2014
Old 02-06-2014 , 17:19   Re: [REQ] Restart Map 24h Cicle
Reply With Quote #5

Oh thanks!

I added the job in the .cfg file, is this correct?

// Reboot the map everyday of the week at 5am
sc_addjob 0 6 5 5 0 0 "sm_map trade_plaza_2"


Edit: I live in Brazil, and the time zone here is 3 hours ahead USA. Is this a problem?

Last edited by Accioly04; 02-06-2014 at 17:24.
Accioly04 is offline
Accioly04
Junior Member
Join Date: Jan 2014
Old 02-07-2014 , 21:46   Re: [REQ] Restart Map 24h Cicle
Reply With Quote #6

Someone?
Accioly04 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 02:07.


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