[摳頂] times_check.c
// times_check.c
// 這東西以後可以擴大應用
// Laechan@Sanc 2013/08/05
inherit ROOM;
mapping times_check=([]);
static int x;
void create()
{
::create();
setuid(getuid(this_object()));
if(file_exists("/open/cmds/times_check.o"))
restore_object("/open/cmds/times_check");
set_heart_beat(1);
}
int save_room()
{
save_object("/open/cmds/times_check");
return 1;
}
int times_check(int t)
{
string tmp,tmp2;
mixed tmps=({}),tmps2=({});
object ppl;
tmps=keys(times_check);
foreach(tmp in tmps)
{
if(atoi(tmp)>t) continue;
tmps2=keys(times_check);
foreach(tmp2 in tmps2)
{
if(!ppl=find_player(tmp2)) continue;
// 由各藥品寫 cancel_effect
catch(call_other(times_check[tmp][tmp2][0],"cancel_effect",
ppl,times_check[tmp][tmp2][1]));
}
map_delete(times_check,tmp);
}
save_room();
return 1;
}
void set_times_check(string names,string files,string med_names,int t)
{
t=t+time();
if(!times_check[""+t])
times_check[""+t]=([]);
times_check[""+t][names]=({files,med_names});
}
int heart_beat()
{
x=x+1;
if(x%15!=2) return 1;
times_check(time());
return 1;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
→
08/05 23:32, , 1F
08/05 23:32, 1F
※ 編輯: laechan 來自: 210.61.157.53 (08/06 08:58)
mud_sanc 近期熱門文章
PTT遊戲區 即時熱門文章
31
60
706
1406