mirror of
https://github.com/noisiver/mod-weekendbonus.git
synced 2026-01-12 16:48:38 +00:00
Send the player a message on login if the weekend bonus is active
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "mod_weekendbonus.h"
|
||||
|
||||
WeekendBonus::WeekendBonus() : WorldScript("WeekendBonusWorldScript") {}
|
||||
WeekendBonus::WeekendBonus() : PlayerScript("WeekendBonusPlayerScript"), WorldScript("WeekendBonusWorldScript") {}
|
||||
|
||||
void Addmod_weekendbonusScripts()
|
||||
{
|
||||
|
||||
@@ -14,11 +14,14 @@ enum Day
|
||||
SATURDAY
|
||||
};
|
||||
|
||||
class WeekendBonus : public WorldScript
|
||||
class WeekendBonus : public PlayerScript, WorldScript
|
||||
{
|
||||
public:
|
||||
WeekendBonus();
|
||||
|
||||
// PlayerScript
|
||||
void OnPlayerLogin(Player* /*player*/) override;
|
||||
|
||||
// WorldScript
|
||||
void OnAfterConfigLoad(bool /*reload*/) override;
|
||||
void OnStartup() override;
|
||||
|
||||
11
src/mod_weekendbonus_player.cpp
Normal file
11
src/mod_weekendbonus_player.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "Chat.h"
|
||||
|
||||
#include "mod_weekendbonus.h"
|
||||
|
||||
void WeekendBonus::OnPlayerLogin(Player* player)
|
||||
{
|
||||
if ((localtime(&LocalTime)->tm_wday == Day::FRIDAY && localtime(&LocalTime)->tm_hour >= 18) || localtime(&LocalTime)->tm_wday == Day::SATURDAY || localtime(&LocalTime)->tm_wday == Day::SUNDAY)
|
||||
{
|
||||
ChatHandler(player->GetSession()).SendSysMessage("The weekend bonus is active, granting you bonuses!");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user