|
发表于 2023-4-7 23:06:31
|
显示全部楼层
来自 美国
试试。。。
- #include <amxmodx>
- #include <amxmisc>
- #include <string>
- #define PLUGIN "时间转服"
- #define VERSION "0.1"
- #define AUTHOR "Sea"
- public plugin_init()
- {
- register_plugin(PLUGIN,VERSION,AUTHOR)
- }
- public client_putinserver(id)
- {
- set_task(10.0, "ChangeConnect", 987123, "", 0, "b")
- }
- public client_connect(id)
- {
- new sTimeH[4]
- get_time("%H",sTimeH,3)
- new TimeH = str_to_num(sTimeH)
- if (TimeH > 20 && TimeH <23)
- {
- client_cmd(id, "connect 192.168.0.101:27111")
- }
- return PLUGIN_CONTINUE;
- }
- public client_disconnected(id)
- {
- remove_task(id)
- }
- public ChangeConnect()
- {
- new sTimeH[4]
- get_time("%H",sTimeH,3)
- new TimeH = str_to_num(sTimeH)
- if (TimeH > 20 && TimeH<23)
- {
- set_task(60.0, "Get_Thetime", 987123, "", 0, "b")
- }
- }
- public Get_Thetime()
- {
- for (new i = 1; i <= get_maxplayers(); i++)
- {
- client_cmd(get_maxplayers(), "connect 192.168.0.101:27111")
- }
- }
复制代码 |
|