UID178554
帖子
精華
主題
積分16695
現金
積極性
威望
違規
熱心
推廣次數
閱讀權限30
註冊時間2009-7-26
在線時間 小時
最後登錄1970-1-1
TA的每日心情 | 慵懶 2013-7-11 12:09 AM |
---|
簽到天數: 118 天 連續簽到: 1 天 [LV.6]常住居民II
|
恩......
技術沒芭樂高
所以沒有參數可以用XD
用法跟芭樂的cmd一樣
atcommand.h
新增:
-
- struct command {
- char command[50];//指令長度
- struct script_code *script;
- };
-
- void read_command();//讀取資料函數
複製代碼
atcommand.c
新增:
-
- static struct command* command_array[100];
複製代碼
找到bool is_atcommand函數,裡面的
下增加
找
-
- if( !message || !*message )
- return false;
複製代碼
增加:
- sscanf(message,"%99s",command);
- while(i<100 && command_array[++i]){
- if(strcmpi(command_array[i]->command,command)==0)
- {
- run_script(command_array[i]->script,0,sd->bl.id,0);
- return true;
- }
- }
-
複製代碼
隨處增加:
-
- void read_command()
- {
- FILE* fp;
- int i=0;
- char line[1024];
- if ((fp = fopen("command.txt", "r")) == NULL) {
- ShowWarning("系統讀取:沒有發現command.txt檔案\n");
- return;
- }
- memset(command_array, 0, sizeof(command_array));
- while(i++<100 && fgets(line, sizeof(line), fp)){
- char *str[2],*p;
- struct command* command;
- CREATE(command, struct command, 1);
- memset(str, 0, sizeof(str));
- p = line;
- if(line[0] == '/' && line[1] == '/')continue; //檢查註解狀態
- while( ISSPACE(*p) )++p; // 檢測開頭是否為空
- if( *p == '\0' )continue; // 檢測是否為結尾
- str[0] = p;
- p = strchr(p,',');
- *p = '\0';
- p++;
- str[1] = p;
- safestrncpy(command->command, str[0], sizeof(command->command));
- command->script = parse_script(str[1],"command.txt",i,0);
- if(command->script)
- command_array[i] = command;
- else
- aFree(command)
- }
- return;
- }
複製代碼
mob.c
static int mob_readdb(void)內
找
下面增加
結束 |
|