|
下面是最后三分钟黑夜模式
请教高手哪段代码是调试黑暗的程度
- #include <amxmodx>
- #include <engine>
- #define WARN_TIME 10
- #define TASK_NIGHT 363636
- new count
- public updatelights()
- {
- new msg[512]
- format(msg, 511,"^x04【现在开始黑夜模式,请购买夜视仪!!】^x01", WARN_TIME)
- client_color(0, msg)
- client_cmd(0,"spk misc/cvt_night0")
- set_task(1.0, "night", TASK_NIGHT,_,_, "a", WARN_TIME)
- }
- public night()
- {
- count++
- new word[6]
- num_to_word(WARN_TIME - count, word, 5)
- client_cmd(0, "spk vox/%s", word)
- if(count == WARN_TIME)
- {
- set_lights("a")
- count = 0
- }
- }
- public client_color(id,msg[])
- {
- new playerslist[32],playerscount//,i
- get_players(playerslist,playerscount,"c")
- while(replace(msg,127,"0x01","^x01")){}
- while(replace(msg,127,"0x02","^x02")){}
- while(replace(msg,127,"0x03","^x03")){}
- while(replace(msg,127,"0x04","^x04")){}
- if(id==0){
- message_begin(MSG_ALL, get_user_msgid("SayText"), {0,0,0},1)
- write_byte(1)
- write_string(msg)
- message_end()
-
- }
- else{
- message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, id)
- write_byte(id)
- write_string(msg)
- message_end()
- }
- }
- public round_restart()
- {
- if(task_exists(TASK_NIGHT))
- {
- remove_task(TASK_NIGHT)
- count = 0
- }
- set_lights("#OFF")
- }
- public plugin_precache()
- {
- precache_sound( "misc/cvt_night0.wav")
- }
- public plugin_init()
- {
- register_plugin("Daylight Changer","0.15x","[RED-Designs](Downtown1)")
- register_event("TextMsg", "round_restart", "a", "2=#Game_Commencing", "2=#Game_will_restart_in")
- set_task(190.0, "updatelights", 393939,_,_,"d")
- }
复制代码 |
|