1111
This commit is contained in:
48
Start/Example/7.md
Normal file
48
Start/Example/7.md
Normal file
@@ -0,0 +1,48 @@
|
||||
## 公会讲话互通 (贡献者: 凌众)
|
||||
|
||||
> 首先我们先在dp_s文件夹中建立一个项目文件夹 MyProject 方便管理
|
||||
|
||||

|
||||
|
||||
> 然后我们建立一个新文件 公会讲话互通.nut 用于编写我们的代码
|
||||
|
||||

|
||||
|
||||
> 然后我们在公会讲话互通.nut中写入以下代码
|
||||
|
||||
```
|
||||
//本例子由凌众提供
|
||||
|
||||
//输入hook
|
||||
Cb_Server_Chat_Log_Leave_Func.RindroGHHT <- function(args) {
|
||||
local type = args[2];
|
||||
|
||||
local SUser = User(args[1]);
|
||||
local msg = args[3];
|
||||
if (type == 6) {
|
||||
local guildName = SUser.GetGuildName();
|
||||
local name = SUser.GetCharacName();
|
||||
//遍历在线玩家
|
||||
local users = World.GetOnlinePlayer()
|
||||
|
||||
users.apply(function(Value) {
|
||||
local onguildName = Value.GetGuildName();
|
||||
if (guildName != onguildName) {
|
||||
Value.SendNotiPacketMessage(name + "[" + guildName + "] :" + msg, 6)
|
||||
}
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
> 最后我们回到dp_s文件夹中,打开Main.nut 加载我们刚才编写的逻辑
|
||||
|
||||
```
|
||||
sq_RunScript("MyProject/公会讲话互通.nut");
|
||||
```
|
||||
|
||||
> 至此一个简单的公会讲话互通的逻辑就写完了,这样其他公会的人也能互相看到了
|
||||
Reference in New Issue
Block a user