#7

Code:
enum e_Events
{
    Name[28],
    Day,
    Month
};

new Events[][e_Events] =
{
    {"New Year's Day", 1, 1},
    {"Martin Luther King Day", 8, 1},
    {"Valentine's Day", 14, 2},
    {"Presidents's Day", 15, 2},
    {"Easter Sunday", 3, 27},
    {"Thomas Jefferson's Birthday", 13, 4},
    {"Mother's Day", 8, 5},
    {"Memorial Day", 30, 5},
    {"Father's Day", 16, 6},
    {"Independence Day" 4, 7},
    {"Labor Day" 5, 9},
    {"Columbos Day", 10, 10},
    {"Halloween", 31, 10},
    {"Election Day", 8, 11},
    {"Veterans Day", 11, 11},
    {"Christmas Eve", 24, 12},
    {"Christmas Day", 25, 12},
    {"Christmas Day Observed", 26, 12},
    {"New Year's Eve", 31, 12}
};

forward LoadEvents();
public LoadEvents() 
{
    new day, month, year;
    getdate(day, month, year);


    for (new i = 0; i < sizeof (Events); i++)
    {
        if(day == Events[i][Day] && month == Events[i][Month])
        {
            format(string, sizeof(string), "[BOT]: Happy %s (%02d/%02d)", Events[i][Name], GetDay(day, month), GetMonth(month));
            SendClientMessageToAll(-1, string);
            break;
        }
    }
    return 1;
}
Quote:
Originally Posted by WhiteGhost
View Post
Why use a 3demi for that?
I think you mean dime and not demi.

EDIT: jlalt was faster, but you should break the loop once you have found the date.
No need to keep looping for no reason.
Reply


Messages In This Thread
Help - by Zorono - 04.08.2016, 15:51
Re: Help - by SyS - 04.08.2016, 15:52
Re: Help - by Zorono - 04.08.2016, 15:53
Re: Help - by WhiteGhost - 04.08.2016, 16:04
Re: Help - by Zorono - 04.08.2016, 16:14
Re: Help - by jlalt - 04.08.2016, 16:18
Re: Help - by Stinged - 04.08.2016, 16:20
Re: Help - by Zorono - 04.08.2016, 16:36

Forum Jump:


Users browsing this thread: 1 Guest(s)