Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
长时间后用户返回的数据库值?
所以我的数据库中有值,例如 stamina, max_stamina, ...
我想做的是:
If stamina is < max_stamina then after 60 seconds stamina=stamina+1 else nothing
我需要循环这个直到stamina等于max_stamina
stamina
max_stamina
我可以轻松创建 if 语句,我需要帮助的问题是编码 60 秒,我该怎么做?
所有这些都需要在玩家登录和未登录时运行。
看看 mysql 事件和时间表认为这就是你要找的。此外,如果您有 1 个以上的用户,那么在您需要的 60 秒间隔内更新它们是明智的。
在不了解代码架构的情况下,您很可能需要每分钟运行一次 cronjob 并根据您的标准更新所有耐力记录。