How would it be possible to manage something to that affect?
Reading through the wikis and c++ references, from what I understand, I would want to use
Gettime() then afterwards use
FormatTime() to get the relevant day out of the system. then apparently I would have to pass %A to get the report of the day from the time.
Would this give a string "Sunday" ?
I am ultimately looking to do something along the lines of;
Code:
OnDayExecute("Sunday")
{
//things here
}
-----------------
Resolution
-----------------
Thanks to toazron1 and SAMURAI16
Code:
#include <sourcemod>
#include <sdktools>
new bool:g_Enabled = false;
#define MAXTRIGGERS 1
static String:trigger[MAXTRIGGERS][] = { "speech" }
public Plugin:myinfo =
{
name = "Sunday Plugin",
author = "DDRKhat",
description = "A plugin that only executes stuff on Sunday!",
version = "1.0",
url = ""
}
public OnConfigsExecuted()
{
checkToday()
}
public OnPluginStart()
{
RegConsoleCmd("say", Command_Say);
RegConsoleCmd("say_team", Command_Say);
}
public checkToday()
{
new String:today[16];
fn_GetDay(today);
if(StrEqual(today,"Sunday"))
{
g_Enabled = true;
}
else
{
g_Enabled = false;
}
}
public Action:Command_Say(id, args)
{
new String:text[192],String:input[192];
new success = 0;
GetCmdArgString(text, sizeof(text));
GetLiteralString(text,input,192);
for(new x=0; x<MAXTRIGGERS; x++)
{
if(StrEqual(input, trigger[x]))
{
success = 1;
break;
}
}
if(!success)
{
return Plugin_Continue;
}
if (!g_Enabled)
{
PrintToChat(id, "[SM]: Sorry today is not sunday!");
}
else
{
//Do stuff because its Sunday
}
return Plugin_Handled;
}
stock GetLiteralString(const String:cmd[],String:buffer[],maxlength)
{
strcopy(buffer,strlen(cmd)+1,cmd);
ReplaceString(buffer,maxlength,"\"","");
TrimString(buffer);
}
stock fn_GetDay(String:output[])
{
new String:day[16];
FormatTime(day,sizeof(day),"%A",GetTime());
strcopy(output,sizeof(day),day);
}
__________________