int last_last_respond = 0;
int no_respond_times=0;
string timer_name = "";
void timer1()
{
timer_name = ctime();
if (last_respond() == last_last_respond)
{
no_respond_times++;
if(no_respond_times>5)
{
tell_user(timer_name + "失去服务器的响应,重新连接游戏\n");
restart_game(1);
}
}
else no_respond_times=0;
last_last_respond =last_respond();
set_timer(10, "timer1", "timer1");
}
#define anti_time 100
void _anti_()
{
int last_x,last_y;
while(1)
{
if(is_in_world())
{
last_x=me()["x"];
last_y=me()["y"];
printf("当前坐标[%d,%d]\n",last_x,last_y);
sleep(anti_time);
if(is_in_world()&&(me()["x"]==last_x)&&(me()["y"]==last_y))
{
printf("%d秒后.角色还在同一位置.重起战斗",anti_time);
restart_game(1);
}
}
else
{
printf("角色不在游戏中\n");
sleep(anti_time);
}
}
}
void on_enter_world()
{
set_timer(10, "timer1", "timer1");
delete_thread("_anti_");
create_thread("_anti_","_anti_");
}
set_timer(10, "timer1", "timer1");
delete_thread("_anti_");
create_thread("_anti_","_anti_");
int on_prepare_for_quest()
{
goto_city("道馆",402,119,3);
talk_to("综合管理");
current_menu[1]["action"]="@特殊修理1";
talk_to("综合管理",1);
return 0;
}
int on_go_to_pz(string rzone, int x, int y)
{
goto_city("道馆",402,119,3);
talk_to("功能NPC");
current_menu[1]["action"]="@超级传传8";
talk_to("功能NPC",1);
current_menu[1]["action"]="@StartjingbiMove(D1101,135,180,1)";
talk_to("功能NPC",1);
}
void on_attack_by(mapping attacker,int damaged)
{
if ((me()["mana"]<me()["max_mana"]*0.1)||(me()["life"]<me()["max_life"]*0.2))
{
create_thread("bb","bb");
}
}
这是我原来用的,帮忙看下该加在什么地方?