runsnake 发表于 2006-9-30 23:35:40

想依照时间来执行插件,怎么写

在某个出北京时间,如: 23:23:30, 才执行这个插件的内容,应该怎么写?

hqzycs 发表于 2006-10-1 10:20:17

回复: 想依照时间来执行插件,怎么写

以前有人要求发布过..但......没人写...............


/*
* AMX X Mod script.
*
* (c) Copyright 2004, olol
*
* This file is provided as is (no warranties).
*/
#include <amxmodx>

/*
* TimeProjector displays the time and the next map on the top right corner of the client
* display as a hudmessage.
*
* History:
*
* v0.1: -
*/


public show_timer(id){
new MONTHS[] = {"一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"}
new WEEK[] = {"一","二","三","四","五","六","日"}
new DAY[] = {"一","二","三","四","五","六","七","八","九","十","十一","十二","十三","十四","十五","十六","十七","十八","十九","二十","廿一","廿二","廿三","廿四","廿五","廿六","廿七","廿八","廿九","三十","三十一"}
new nextmap
new cumap
new timel = get_timeleft()
new ns_Hour, ns_Minutes,ns_Month,ns_Day,ns_Year,ns_second,ns_week
get_cvar_string("amx_nextmap",nextmap,31)
get_mapname(cumap,31)
get_time("%H", ns_Hour, 2)
get_time("%M", ns_Minutes, 2)
get_time("%m", ns_Month, 2)
get_time("%d", ns_Day, 2)
get_time("%Y", ns_Year, 4)
get_time("%S", ns_second, 2)
get_time("%w", ns_week, 4)
set_hudmessage(0,255,0,0.75,0.18,0, 1.0, 1.0, 0.1, 0.2, 12)
if((str_to_num(ns_week)) ==0){
show_hudmessage(id,"%s年%s%s日星期%s^n北京时间 %s:%s:%s",ns_Year,MONTHS,DAY,WEEK,ns_Hour,ns_Minutes,ns_second)
}else{
show_hudmessage(id,"%s年%s%s日星期%s^n北京时间 %s:%s:%s",ns_Year,MONTHS,DAY,WEEK,ns_Hour,ns_Minutes,ns_second)
}
return PLUGIN_CONTINUE
}

public plugin_init()
{
register_plugin("TimeProjector","0.1","olol")
//register_clcmd("say nowtime","show_timer")
set_task(1.0, "show_timer",0,"",0,"b")
return PLUGIN_CONTINUE
}
页: [1]
查看完整版本: 想依照时间来执行插件,怎么写