找回密码
 注册/Sign up
搜索
查看: 2404|回复: 1

【花哨哥】【M佬框架】【lua】快速组队、全队打卡

[复制链接]

发表于 2022-5-3 23:44:55 | 显示全部楼层 |阅读模式
本帖最后由 lwc64508978 于 2022-5-3 23:47 编辑
  1. local ngModule = ModuleBase:createModule('ng')
  2. function ngModule:ng_TalkEvent(player,msg,color,range,size)
  3.       -- 全队伍打卡
  4.   if self:startswith(msg,"/7 ")  then
  5.     local command = string.sub(msg,4)
  6.     print(command)
  7.     for slot = 0,4 do
  8.       local p =Char.GetPartyMember(player,slot)
  9.       if(p>0) then
  10.         local money = Char.GetData(p,%对象_金币%);
  11.         Char.SetData(p,%对象_金币%,money-200);
  12.           if(command =='on') then
  13.             Char.FeverStart(p);
  14.             NLG.UpChar(p);
  15.             NLG.SystemMessage(p, "扣除魔币200G。");   
  16.             NLG.SystemMessage(p, "恭喜您打卡成功。");   
  17.           elseif(command =='off') then
  18.             Char.FeverStop(p);
  19.             NLG.UpChar(p);
  20.             NLG.SystemMessage(p, "扣除魔币200G。");   
  21.             NLG.SystemMessage(p, "恭喜您关闭打卡成功。");   
  22.           end
  23.         
  24.       end
  25.     end
  26.    
  27.   end
  28.   -- 快速组队
  29.   if self:startswith(msg,"/8 ")  then
  30.     local names = string.sub(msg,4)
  31.     local nameTable = self:split(names," ")
  32.     for _,cdkey in pairs(nameTable) do
  33.       -- 判断本身队伍是否满人
  34.       local partyNum = Char.PartyNum(player)
  35.       if(partyNum>=5) then
  36.         NLG.SystemMessage(player, "队伍已满5人");   
  37.         return
  38.       end
  39.       local charIndex  = NLG.FindUser(cdkey)
  40.       if(charIndex>0) then
  41.         local invitedPartyNum = Char.PartyNum(charIndex)
  42.         print(invitedPartyNum)
  43.         if(invitedPartyNum>0) then
  44.           NLG.SystemMessage(player, "被邀请者已有队伍");
  45.         else
  46.           -- 第一个参数 队员,第二个参数队长
  47.           Char.JoinParty(charIndex, player)
  48.         end
  49.       end
  50.     end
  51.   end
  52. end
  53. function ngModule:split( str,reps )
  54.     local resultStrList = {}
  55.     string.gsub(str,'[^'..reps..']+',function ( w )
  56.         table.insert(resultStrList,w)
  57.     end)
  58.     return resultStrList
  59. end
  60. function ngModule:startswith ( str, substr)  
  61.     if str == nil or substr == nil then  
  62.         return nil, "the string or the sub-stirng parameter is nil"  
  63.     end  
  64.     if string.find(str, substr) ~= 1 then  
  65.         return false  
  66.     else  
  67.         return true  
  68.     end  
  69. end
  70. --- 加载模块钩子
  71. function ngModule:onLoad()
  72.   self:logInfo('load')
  73.   self:regCallback('TalkEvent', Func.bind(self.ng_TalkEvent, self))
  74. end
  75. --- 卸载模块钩子
  76. function ngModule:onUnload()
  77.   self:logInfo('unload')
  78. end
  79. return ngModule
复制代码








全队打卡命令 【/7 on 】 开启;【/7 off】 关闭

快速组队命令【/8 用户名1 用户名2 用户名3】 队员无论在何处(但不能在队伍中)都可以组队



发表于 2022-5-5 12:18:03 | 显示全部楼层
感谢分享!感谢分享!感谢分享!
您需要登录后才可以回帖 登录 | 注册/Sign up

本版积分规则

手机版|cgmsv引擎论坛

GMT+8, 2026-6-5 10:34 , Processed in 0.030687 second(s), 3 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表