|
本帖最后由 honhegu 于 2021-12-7 12:26 编辑
帮忙看下代码
Invasao.cpp
------------------------------------------------------------------------------------------------------------------
- #include "stdafx.h"
- #include "Invasao.h"
- #include "structs.h"
- void cInvasao::ProcessTimer()
- {
- time_t rawnow = time(NULL);
- struct tm *now = localtime(&rawnow);
- auto cDiaDaSem = now->tm_wday;
- auto cHor = now->tm_hour;
- auto cMin = now->tm_min;
- auto cSeg = now->tm_sec;
- //auto game = ServerStatus;
- if (cHor == 6 || cHor == 12 || cHor == 18 || cHor == 20)
- {
- if (cMin == 55)
- {
- if (cSeg == 01)
- {
- SendNotice("5 分钟后开始.");
- }
- }
- if (cMin == 58)
- {
- if (cSeg == 01)
- {
- SendNotice("2 分钟后开始.");
- }
- }
- }
- if (cHor == 7 || cHor == 13 || cHor == 19 || cHor == 21)
- {
- if (cMin == 0)
- {
- if (cSeg == 01)
- {
- int random = rand() % 5;
- if (random == 1)
- {
- SendNotice("aaaa");
- CreateMob("aaa1", 2176, 2103, "npc");
- for (size_t i = 0; i < 10; i++)
- {
- CreateMob("dirlist", 2176, 2103, "npc");
- }
- }
- ........
- }
- }
- }
- }
- bool cInvasao::PlayerDeath(const int32_t client, const int32_t killer)
- {
- auto dead = GetMobFromIndex(client);
- auto mob = GetMobFromIndex(killer);
- auto user = Func::GetUserFromIndex(killer);
- auto userData = pUserData[killer];
- SendNotice(Func::strFmt("player [%s] kill [%s] ", mob->MOB.MobName, dead->MOB.MobName));
- return true;
- }
复制代码
Invasao.h
---------------------------------------------------------------
- #pragma once
- class cInvasao
- {
- public:
- static void ProcessTimer();
- static bool PlayerDeath(const int32_t client, const int32_t killer);
- };
复制代码
前面的调用里已经定义了struct tm,程序编译没问题,但到时间没有任何返回结果。 |
上一篇: 警告 C28251 “wWinMain”的批注不一致:下一篇: 帮忙看段代码
|