UID159057
帖子
精華
主題
積分2380
現金
積極性
威望
違規
熱心
推廣次數
閱讀權限10
註冊時間2009-5-26
在線時間 小時
最後登錄1970-1-1
TA的每日心情 | 開心 2018-12-14 06:21 PM |
---|
簽到天數: 123 天 連續簽到: 2 天 [LV.7]常住居民III
|
發表於 2009-7-30 17:43:08
|
顯示全部樓層
*getpartymember <party id>,{<type>};
Thank you to HappyDenn for all this information.
This command will find all members of a specified party and returns their names
(or character id or account id depending on the value of "type") into an array
of temporary global variables. There's actually quite a few commands like this
which will fill a special variable with data upon execution and not do anything
else.
Upon executing this,
$@partymembername$[] is a global temporary stringarray which contains all the
names of these party members
(only set when type is 0 or not specified)
$@partymembercid[] is a global temporary number array which contains the
character id of these party members.
(only set when type is 1)
$@partymemberaid[] is a global temporary number array which contains the
account id of these party members.
(only set when type is 2)
$@partymembercount is the number of party members that were found.
The party members will (apparently) be found regardless of whether they are
online or offline. Note that the names come in no particular order.
Be sure to use $@partymembercount to go through this array, and not
'getarraysize', because it is not cleared between runs of 'getpartymember'. If
someone with 7 party members invokes this script, the array would have 7
elements. But if another person calls up the NPC, and he has a party of 5, the
server will not clear the array for you, overwriting the values instead. So in
addition to returning the 5 member names, the 6th and 7th elements from the last
call remain, and you will get 5+2 members, of which the last 2 don't belong to
the new guy's party. $@partymembercount will always contain the correct number,
(5) unlike 'getarraysize()' which will return 7 in this case.
Example:
// get the character's party ID
getpartymember(getcharid(1));
// immediately copy $@partymembercount value to a new variable, since
// you don't know when 'getpartymember' will get called again for someone
// else's party, overwriting your global array.
set @partymembercount,$@partymembercount;
// copy $@partymembername array to a new array
copyarray @partymembername$[0],$@partymembername$[0],@partymembercount;
//list the party members in NPC dialog
set @count,0;
L_DisplayMember:
if(@count == @partymembercount) goto L_DisplayMemberEnd;
mes (@count + 1) + ". ^0000FF" + @partymembername$[@count] + "^000000";
set @count,@count+1;
goto L_DisplayMember;
L_DisplayMemberEnd:
close;
用goole去翻譯..
我現在在忙..抱歉 |
|