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

Plugin that activates only on Sunday and Tuesday


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
N0th
Junior Member
Join Date: Sep 2017
Old 09-04-2017 , 14:23   Plugin that activates only on Sunday and Tuesday
Reply With Quote #1

Hey guys, here I am again.
I have a plugin that s part of an event, and that i put on every Tuesday and Sunday between the hours 20:00 - 22:00 on Tuesday and 18:00 - 20:00 on Sunday.
But here I ask for your knowledge. Is it possible to make this plugin activates automatically in those days, at those hours? Like setting the plugin a time to start and a time to end?
I ask if is something that I can just add at the plugin, if not, tell me and I leave you the code.
N0th is offline
D3XT3R
AlliedModders Donor
Join Date: Nov 2016
Location: Lithuania, Bomb A (Kauna
Old 09-04-2017 , 15:57   Re: Plugin that activates only on Sunday and Tuesday
Reply With Quote #2

its possible
__________________
D3XT3R is offline
Send a message via Skype™ to D3XT3R
N0th
Junior Member
Join Date: Sep 2017
Old 09-04-2017 , 17:47   Re: Plugin that activates only on Sunday and Tuesday
Reply With Quote #3

Can you guys please help me make this then?
N0th is offline
Rohanlogs
Senior Member
Join Date: Nov 2015
Old 09-04-2017 , 19:34   Re: Plugin that activates only on Sunday and Tuesday
Reply With Quote #4

Quote:
Originally Posted by N0th View Post
Can you guys please help me make this then?
Yes we can indeed. But where's the source code of your plugin? lol
Also do you want the start / end times to be controlled by cvars or should it be hardcoded?
__________________
Rohanlogs is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-04-2017 , 20:44   Re: Plugin that activates only on Sunday and Tuesday
Reply With Quote #5

Look into "Task Manager".
__________________
fysiks is offline
N0th
Junior Member
Join Date: Sep 2017
Old 09-05-2017 , 03:16   Re: Plugin that activates only on Sunday and Tuesday
Reply With Quote #6

This is the code:
Code:
#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < dhudmessage >

#pragma tabsize 0

#define PLUGIN          "LLG Gather N"
#define VERSION         "1.2"
#define AUTHOR          "Team LLG & AZzeL"

#define	iNameRed	0
#define	iNameGreen	255
#define	iNameBlue	255

#define	iScoreRed	255
#define	iScoreGreen	0
#define	iScoreBlue	0

#define GAME_NAME         "LLG Gather"

new const gTagNameTE[ ] = "[LLG]";
new const gTagNameCT[ ] = "[LLG]";

new const gTag[ ]       = "LaLeagane.Ro";
new const gTagMesaj[ ]  = "Gather-ul a pornit";
new const gTagMesaj2[ ] = "Bafta la fraguri"; 

new bool:WarmUp;
new Seconds = 60;

new cvar_hud_msj, cvar_msj, cvar_msj_chat;

public plugin_init()
{	
   register_plugin(PLUGIN, VERSION, AUTHOR);

   cvar_hud_msj  = register_cvar("llg_hud_msj","1")
   cvar_msj      = register_cvar("llg_msj","1")
   cvar_msj_chat = register_cvar("llg_msj_chat","1")

   register_clcmd("say /llg","ShowMotd")

   register_forward( FM_GetGameDescription, "GameDesc" );

   register_event("TeamInfo", "Hook_TeamInfo", "a");
   register_event("CurWeapon", "Current_Weapon", "be", "1=1", "2!29");

   WarmUp = true;

   set_task(120.0, "RemoveWarmUp", 123);
   set_task(1.0, "ShowCountDown", 1234,_,_,"b",_);
      
}

public plugin_cfg()
{
   new cfgdir[32]
   get_configsdir(cfgdir, charsmax(cfgdir))
   server_cmd("exec %s/Gather/Gather.cfg", cfgdir)
}

public Hook_TeamInfo()
{
	new id = read_data(1);
		
	new szTeam[2];
	read_data(2, szTeam, charsmax(szTeam)); 
	
	new szName[32];
	get_user_name(id, szName, charsmax(szName));
	new szFormatName[50];

	switch( szTeam[0])
	{	
		case 'T':
		{
			if( equal(szName, gTagNameTE, charsmax(gTagNameTE)))
			{
				return;
			}
			
			if( !replace(szName, charsmax(szName), gTagNameCT, gTagNameTE))
			{
				formatex(szFormatName, charsmax(szFormatName), "%s %s", gTagNameTE, szName);
			}

			set_user_info(id, "name", szFormatName);
		}

		case 'C':
		{
			if( equal(szName, gTagNameCT, charsmax(gTagNameCT)))
			{
				return;
			}
			
			if( !replace( szName, charsmax(szName), gTagNameTE, gTagNameCT))
			{
				formatex(szFormatName, charsmax(szFormatName), "%s %s", gTagNameCT, szName);
			}
			
			set_user_info(id, "name", szFormatName);
		}
	}
	
    set_task(5.0, "welcome", id)
    return;
}

public welcome(id)
{
	new azlName[32]
	get_user_name(id, azlName, 31)

	set_hudmessage(iNameRed, iNameGreen, iNameBlue, -1.0, 0.10, 2, 0.05, 6.0, 0.01, 0.1, 2);
	show_hudmessage(id, "Salut %s^n Bun venit la Gather!^n Multumim pentru participare !", azlName)
}

public client_authorized(id)
{
        if(get_pcvar_num(cvar_msj_chat) == 1)
        {
              set_task(100.0, "PrintText" ,id)
        }
}

public PrintText(id)
{
     LLG_Color(id, ".g-=-=-= [ .vGather Nights .g] =-= [ .eLaLeagane.ro .g] =-=-=-")
     LLG_Color(id, ".g[.vGather-N.g] Pentru a vedea de ce aveti .v[LLG] .gla nume, scrieti in chat .e/llg.g.")
     LLG_Color(id, ".g-=-=-= [ .vGather Nights .g] =-= [ .eLaLeagane.ro .g] =-=-=-")
}

public Current_Weapon(id)
{
    if(WarmUp)
    {
        engclient_cmd(id, "weapon_knife");
    }
}

public ShowCountDown()
{
    set_hudmessage( iNameRed, iNameGreen, iNameBlue, -1.0, is_user_alive( 0 ) ? 0.03 : 0.03 , 0,_, 1.0, _, _ );
    show_hudmessage( 0, "<< [ Timp de incalzire ] >>^n<< [ %d ] >>", Seconds );

    Seconds--;

    if(Seconds <= 0)
    {
        if(task_exists(1234))
            remove_task(1234);
       
        WarmUp = false;

 	      set_task(1.0,"Restart");

        return;
    }
}

public Restart(id) 
{
	client_cmd(0,"spk ^"life in three seconds^"")

        server_cmd("sv_restart 3")

        if(get_pcvar_num(cvar_msj) != 0)
        {
            if( get_pcvar_num(cvar_msj) == 1 )
            {
	        LLG_Color(id, ".g[.v%s.g] |----------[.v%s !.g]--[.e%s !.g]--------|", gTag, gTagMesaj, gTagMesaj2 )
	        LLG_Color(id, ".g[.v%s.g] |----------[.v%s !.g]--[.e%s !.g]--------|", gTag, gTagMesaj, gTagMesaj2 )
	        LLG_Color(id, ".g[.v%s.g] |----------[.v%s !.g]--[.e%s !.g]--------|", gTag, gTagMesaj, gTagMesaj2 )
	        LLG_Color(id, ".g[.v%s.g] |----------[.v%s !.g]--[.e%s !.g]--------|", gTag, gTagMesaj, gTagMesaj2 )
            }

	    if( get_pcvar_num(cvar_msj) == 2 )
            {
               set_task(4.0, "MsjHUD")
            }
        }

        if(get_pcvar_num(cvar_hud_msj) == 1)
        {
              set_task(1.0, "MesajPermanent",0,"",0,"b")
        }
}

public MsjHUD()
{
    set_dhudmessage(iScoreRed, iScoreGreen, iScoreBlue, 0.04, 0.47, 0, 6.0, 7.0) 
    show_dhudmessage(0, "Gatherul a inceput^nDistractie placuta!" )
}

public MesajPermanent()
{
    set_dhudmessage( iScoreRed, iScoreGreen, iScoreBlue, -1.0, is_user_alive( 0 ) ? 0.06 : 0.00 , 0, _, 1.0, _, _ );
    show_dhudmessage( 0, "Gather-ul este pornit !" );
}

public RemoveWarmUp()

    WarmUp = false;

public GameDesc( ) { 
	forward_return( FMV_STRING, GAME_NAME ); 
	return FMRES_SUPERCEDE; 
}

public ShowMotd(id)
{
     show_motd(id, "addons/amxmodx/configs/Gather/llg.html")
}


stock LLG_Color( const id, const input[ ], any:... )
{
   new count = 1, players[ 32 ];

   static msg[ 191 ];
   vformat( msg, 190, input, 3 );

   replace_all( msg, 190, ".v", "^4" ); /* verde */
   replace_all( msg, 190, ".g", "^1" ); /* galben */
   replace_all( msg, 190, ".e", "^3" ); /* ct=albastru | t=rosu */
   replace_all( msg, 190, ".x", "^0" ); /* normal-echipa */
   
   if( id ) players[ 0 ] = id; 
   else get_players( players, count, "ch" );
   {
      for( new i = 0; i < count; i++ )
      {
         if( is_user_connected( players[ i ] ) )
         {
            message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] );
            write_byte( players[ i ] );
            write_string( msg );
            message_end( );
         }
      }
   }
}
Ok, so this plugin gives a [TAG] to the players, a message when entering the server, a new kniferounds and a command /llg.
this plugin is part of an event, every Tuesday between the hours 20:00 - 22:00 and and 18:00 - 20:00 on Sunday. I want him to activate itself at that time , without me starting it at 20:00 and stopping it at 22:00, like..let's say my internet goes down without any reason or cause for 7 days, I want the plugin to do his work and start the event at those hours on sunday and tuesday without my intervention.
If somebody can make this, It would be incredible, thanks.

Last edited by N0th; 09-05-2017 at 03:33.
N0th is offline
Rohanlogs
Senior Member
Join Date: Nov 2015
Old 09-05-2017 , 14:06   Re: Plugin that activates only on Sunday and Tuesday
Reply With Quote #7

So if I understood right, you want the plugin to be only enabled during this time and disabled on other days.

Try this.
Spoiler


Note that this is working with the time that's running on your server depending on where your server is being hosted from.

The changes will take place after a map change, so I made it enable hour earlier.
After map changes, if its between 19-22 on Tuesday or 17-20 on Sunday the plugin should start doing stuff.

If you want to change the start and end hours, edit this:
PHP Code:
    // start      end
    
if( 19 <= iTime <= 22 && equal(cdayg_szDays[0]) // Tuesday
    
|| 17 <= iTime <= 20 && equal(cdayg_szDays[1]) ) // Sunday 
Attached Files
File Type: sma Get Plugin or Get Source (llgather_days.sma - 273 views - 6.5 KB)
__________________
Rohanlogs is offline
N0th
Junior Member
Join Date: Sep 2017
Old 09-05-2017 , 14:15   Re: Plugin that activates only on Sunday and Tuesday
Reply With Quote #8

I will try and come back with an edit.
So, i don t have to do any other thing, just put the plugin in and then he will stay on just in those days at those hours? No more commands or ads?
N0th is offline
Rohanlogs
Senior Member
Join Date: Nov 2015
Old 09-05-2017 , 14:22   Re: Plugin that activates only on Sunday and Tuesday
Reply With Quote #9

Ye just throw the plugin in server and it should automatically activate / close during those times.
__________________
Rohanlogs is offline
N0th
Junior Member
Join Date: Sep 2017
Old 09-05-2017 , 14:38   Re: Plugin that activates only on Sunday and Tuesday
Reply With Quote #10

Thanks a lot, you' slay it ))
I will come back with an edit and a PM if it works properly.
N0th 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 22:08.


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