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

auto mode changer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
thx_you
Senior Member
Join Date: Feb 2009
Old 04-17-2011 , 14:55   auto mode changer
Reply With Quote #1

hi people i need plugin to change the mod to zombie auto in this time 00:00
and in this time 08:00 he change the mode to normal mod ct vs t

if its inmposible give me idea to auto change this comond
"zombie_mode 0" to "zombie_mode 1" in my server.cfg in this time 00:00

i know ther is Engineers in this forum can do it for me




i dont have mony to buy 2 server i need just one server run 2mode
thx_you is offline
LambdaLambda
AlliedModders Donor
Join Date: Oct 2010
Location: London
Old 04-17-2011 , 17:14   Re: auto mode changer
Reply With Quote #2

Code:
#include <sourcemod>

public Plugin:myinfo = 
{
    name = "-",
    author = "-",
    description = "-",
    version = "-",
    url = "-"
}

public OnPluginStart()
{
    MapCycle();
}

public OnMapStart()
{    
    MapCycle();
}

public MapCycle()
{

    new String:x[4];     
    FormatTime(x,sizeof(x),"%H",GetTime());
    new time;
    time = StringToInt(x);
    
    if ( time >= 0 || time < 8 )
    {
        ServerCommand("zombie_mode 1");
    }
    else if ( time >= 8 || time < 0 )
    {
        ServerCommand("zombie_mode 0");
    }
    
}
It gonna works better with the timer, but i've got problems with it after lasted update so i not gonna do it. ;d

Last edited by LambdaLambda; 04-17-2011 at 17:26. Reason: spell errors ^^
LambdaLambda is offline
thx_you
Senior Member
Join Date: Feb 2009
Old 04-17-2011 , 17:28   Re: auto mode changer
Reply With Quote #3

thak you LambdaLambda for your replay but sorry iam noob if i compile this cod is work ?
thx_you is offline
LambdaLambda
AlliedModders Donor
Join Date: Oct 2010
Location: London
Old 04-17-2011 , 17:34   Re: auto mode changer
Reply With Quote #4

Yea, it gonna work, when you'll compile it. But after mapchange it will load. So if time is 23:50, and you'll change map, you'll have to change at 00:00 again to plugin load the cvar. So if you don't like this idea, wait for someone who is better in SourcePawn's coding, and will do for you timer for this plugin. ;p

For the next time, use the compiler on www.SourceMod.com. ;) Click! Click!
Attached Files
File Type: sp Get Plugin or Get Source (zombie-ffa.sp - 404 views - 586 Bytes)

Last edited by LambdaLambda; 04-17-2011 at 17:41.
LambdaLambda is offline
thx_you
Senior Member
Join Date: Feb 2009
Old 04-17-2011 , 18:11   Re: auto mode changer
Reply With Quote #5

i see you type this on your code

if ( time >= 0 || time < 8 )
{
ServerCommand("zombie_mode 1");
}
else if ( time >= 8 || time < 0 )
{
ServerCommand("zombie_mode 0");

if i want change the time example i want 00:25

if ( time >= 00:25 || time < 8 )
{
ServerCommand("zombie_mode 1");
}
else if ( time >= 8 || time < 00:25 )
{
ServerCommand("zombie_mode 0");
thx_you is offline
LambdaLambda
AlliedModders Donor
Join Date: Oct 2010
Location: London
Old 04-17-2011 , 18:16   Re: auto mode changer
Reply With Quote #6

No, if you need to put time in minutes, you've to put new string firstly for it.

Change
Code:
    new String:x[4];     
    FormatTime(x,sizeof(x),"%H",GetTime());
    new time;
    time = StringToInt(x);
to
Code:
    decl String:x[4], String:y[4];
    FormatTime(x,sizeof(x),"%H",GetTime());
    FormatTime(y,sizeof(y),"%M",GetTime());
    new time, time2;
    time = StringToInt(x);
    time2 = StringToInt(y);
and
Code:
if ( time >= 0 || time < 8 )
    {
        ServerCommand("zombie_mode 1");
    }
    else if ( time >= 8 || time < 0 )
    {
        ServerCommand("zombie_mode 0");
to
Code:
if ( time >= 0 && time2 >= 25 || time < 8 )
    {
        ServerCommand("zombie_mode 1");
    }
    else if ( time >= 8 || time < 0 && time2 < 25 )
    {
        ServerCommand("zombie_mode 0");
Where time is hours, and time2 is minutes.

Last edited by LambdaLambda; 04-17-2011 at 18:20.
LambdaLambda is offline
thx_you
Senior Member
Join Date: Feb 2009
Old 04-17-2011 , 19:16   Re: auto mode changer
Reply With Quote #7

hey LambdaLambda
i test him and not work
ok my time now is 01:12
i edit the code to test him

if ( time >= 1 && time2 >= 25 || time < 8 )
{
ServerCommand("zombie_mode 1");
}
else if ( time >= 8 || time < 1 && time2 < 25 )
{
ServerCommand("zombie_mode 0");

and i compile him and past him in the plugins folder

and i start the server and i join and i type in chat "thetime"
i see this
[SM] The current server time is 04/18/2011 -
01:14:21
and the zombie mode is on "zombie_mode 1" befor the exct time 01:25 in the code
i try many time change the time in the code but is evry time "zombie_mode 1"
thx_you is offline
LambdaLambda
AlliedModders Donor
Join Date: Oct 2010
Location: London
Old 04-17-2011 , 19:18   Re: auto mode changer
Reply With Quote #8

Did you delete cvar "zombie_mode 1" in cfg file?

#Edit
Please, paste the code in [code ][ /code] tags.
LambdaLambda is offline
thx_you
Senior Member
Join Date: Feb 2009
Old 04-18-2011 , 02:06   Re: auto mode changer
Reply With Quote #9

i dont have zombie_mode 1 in my server.cfg

Last edited by thx_you; 04-18-2011 at 02:09.
thx_you is offline
LambdaLambda
AlliedModders Donor
Join Date: Oct 2010
Location: London
Old 04-18-2011 , 10:36   Re: auto mode changer
Reply With Quote #10

Try this
Code:
#pragma semicolon 1

#include <sourcemod>

// Global Definitions
#define PLUGIN_VERSION "1.0.0"

// Functions
public Plugin:myinfo =
{
    name = "-",
    author = "-",
    description = "-",
    version = PLUGIN_VERSION,
    url = "-"
};

public OnPluginStart()
{
    CreateTimer(120.0, TimerCheckTime, INVALID_HANDLE, TIMER_REPEAT);
}

public Action:TimerCheckTime(Handle:timer)
{

    decl String:x[4], String:y[4];
    FormatTime(x,sizeof(x),"%H",GetTime());
    FormatTime(y,sizeof(y),"%M",GetTime());
    PrintToServer("Time %s:%s", x, y);
    new time, time2;
    time = StringToInt(x);
    time2 = StringToInt(y);

if ( time >= 00 && time2 >= 25 || time < 08 )
    {
        ServerCommand("zombie_mode 1");
    }
    else if ( time >= 08 || time < 00 && time2 < 25 )
    {
        ServerCommand("zombie_mode 0");
    }
}
LambdaLambda 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 00:48.


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