UID178554
帖子
精華
主題
積分16695
現金
積極性
威望
違規
熱心
推廣次數
閱讀權限30
註冊時間2009-7-26
在線時間 小時
最後登錄1970-1-1
TA的每日心情 | 慵懶 2013-7-11 12:09 AM |
---|
簽到天數: 118 天 連續簽到: 1 天 [LV.6]常住居民II
|
如標題,這是Ea源碼,讓指令可以用來指定玩家施展
用個簡單的範例讓大家了解,
以下是獲得手推車的指令源碼
請打開script.c
然後它的內容是這樣的 -
- BUILDIN_FUNC(setcart)
- {
- int type = 1;
- TBL_PC* sd;
- sd = script_rid2sd(st);
- if( sd == NULL )
- return 0;// no player attached, report source
- if( script_hasdata(st,2) )
- type = script_getnum(st,2);
- pc_setcart(sd, type);
- return 0;
- }
複製代碼
好,開始解釋
它原先使用方法是:setcart <type>;
type=手推車參數(每個的樣子)
sd:變數
script_rid2sd(st);//取得使用指令的玩家ID
script_hasdata(st,2):如果有第二個參數資料(type)便將type指定為它(沒有則默認為1,0代表消除推車)
pc_setcart(sd, type):pc_setcart~把sd, type兩者資料傳送到pc_setcart執行(內容複雜,暫時不說)
如果我們要把手推車可以指定玩家的話,可以改成 -
- BUILDIN_FUNC(setcart)
- {
- int type = 1;
- TBL_PC* sd;
- if( script_hasdata(st,3) )
- sd=map_id2sd(script_getnum(st,3));
- else
- sd=script_rid2sd(st);
- if( sd == NULL )
- return 0;// no player attached, report source
- if( script_hasdata(st,2) )
- type = script_getnum(st,2);
- pc_setcart(sd, type);
- return 0;
- }
複製代碼
script_hasdata(st,3):如果有第三個參數,就將sd設為第三個參數
script_getnum:取得第三個參數(數字)
這樣就可以了~
很多指令皆可這樣更改~
如果有錯誤請回報,感恩 |
評分
-
查看全部評分
|