UID52158
帖子
精華
主題
積分47220
現金
積極性
威望
違規
熱心
推廣次數
閱讀權限30
註冊時間2008-1-17
在線時間 小時
最後登錄1970-1-1
TA的每日心情 | 開心 2012-10-20 12:31 AM |
---|
簽到天數: 305 天 連續簽到: 94 天 [LV.8]以壇為家I
|
本帖最後由 rgrg1234 於 2011-10-10 03:17 PM 編輯
胡亂寫了一個...- script.c
- BUILDIN_FUNC(antidoubleopen)
- {
- struct s_mapiterator* i_pc = mapit_getallusers();
- int type,fd,m;
- const char *str=script_hasdata(st, 4)?script_getstr(st,4):"";
- TBL_PC *pl_sd,*sd = map_id2sd(script_getnum(st,2));
- if( sd == NULL )
- {
- ShowError("script:antidoubleopen: no player attached\n");
- return 0;
- }
- fd=sd->fd ;
- for( pl_sd = (TBL_PC*)mapit_first(i_pc); mapit_exists(i_pc); pl_sd = (TBL_PC*)mapit_next(i_pc) )
- {
- type=script_hasdata(st, 4)?script_getnum(st,3)%2+2:script_getnum(st,3)%2;
- if((m=map_mapname2mapid(str))< 0 && script_hasdata(st, 4)){
- ShowWarning("script: antidoubleopen: not mapname variable\n");
- return 1;
- }
- switch(type)
- {
- case 0:
- if(!strcmp(script_getIP(sd->fd),script_getIP(pl_sd->fd))&&sd!=pl_sd){
- script_pushint(st, 1);
- return 0;
- }
- break;
- case 1:
- if(!strcmp(script_getIP(sd->fd),script_getIP(pl_sd->fd))&&sd!=pl_sd){
- if( fd > 0 )
- clif_authfail_fd(fd, 15);
- else
- map_quit(sd);
- script_pushint(st, 1);
- return 0;
- }
- break;
- case 2:
- if(!strcmp(script_getIP(sd->fd),script_getIP(pl_sd->fd)) && sd!=pl_sd && sd->bl.m==pl_sd->bl.m && sd->bl.m==map[m].m){
- script_pushint(st, 1);
- return 0;
- }
- break;
- case 3:
- if(!strcmp(script_getIP(sd->fd),script_getIP(pl_sd->fd)) && sd!=pl_sd && sd->bl.m==pl_sd->bl.m && sd->bl.m==map[m].m){
- if( fd > 0 )
- clif_authfail_fd(fd, 15);
- else
- map_quit(sd);
- script_pushint(st, 1);
- return 0;
- }
- break;
- default:
- ShowError("script:antidoubleopen: 一個未知的參數 (%d).\n",type);
- script_pushint(st, -1);
- return 0;
- }
- }
- script_pushint(st, 0);
- return 0;
- }
- BUILDIN_DEF(antidoubleopen, "ii?"),
- clif.c
- char* script_getIP(int fd)
- {
- if( !session[fd] ) return 0 ;
- return (char*)ip2str(session[fd]->client_addr, NULL);
- }
- clif.h
- char* script_getIP(int fd);
複製代碼 *antidoubleopen(<id>,<type>{,"<map name>"})- antidoubleopen(getcharid(3),1,"payon")
複製代碼 type 0 用來檢查 該人物為雙開人物返回1 否返回0
type 1 該人物為雙開人物返回1 否返回0 並踢除該腳色 |
|