记得修改gm密码local GMPassword = "nr"
lua/module中,新建easygm.lua,暨lua/module/easygm.lua
并添加如下代码
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- 【【【脚本说明】】】
------------------------------------------------------------------------------
--EasyGM指令(高级GM指令)
--
--功能包括:(部分未修复)
--1、基本控制:公告、高级在线、地图在线、鉴定、清空
--2、玩家操作:踢出、召唤、跟踪、传送、查人物、查物品、查宠物、给物品、删物品、给宠物、给满档宠物、删宠物
--3、高级控制:人物数据、宠物数据、物品数据、奖励
--
--20210505 ahsin修复在cgmsv中可用,部分功能待修复
----------------------------------------------------------------------------
--Lua高级GM指令密码
local GMPassword = "nr"
--Lua高级GM指令最低GM等级限制(1~5),0为所有非GM玩家都可以使用
local GMLevel = 1
----------------------------------------------------------------------------
--常量设置
local 常量 = {}
常量.对象 = {}
常量.对象.原名 = %对象_原名%
常量.对象.等级 = %对象_等级%
常量.对象.地图类型 = %对象_MAP%
常量.对象.地图 = %对象_地图%
常量.对象.X = %对象_X%
常量.对象.Y = %对象_Y%
常量.对象.账号 = %对象_账号%
常量.对象.GM = %对象_GM%
----------------------------------------------------------------------------
--基础数据(本脚本依赖此数据)
useModule("BaseData");
Players = Players or {}
Delegate.RegDelTalkEvent("EasyGMEvent");
function EasyGMEvent( _PlayerIndex, _msg, _color, _range, _size)
TalkMsg = _msg
TalkMsg = string.gsub(TalkMsg,"【","[")
TalkMsg = string.gsub(TalkMsg,"】","]")
TalkMsg = string.sub(TalkMsg,0)
print(Char.GetData(_PlayerIndex,常量.对象.原名)..":" .. TalkMsg)
if CheckGMPassword(TalkMsg)~=true then
return 1
end
TalkMsg = string.gsub(TalkMsg,"]","")
if (Char.GetData(_PlayerIndex,常量.对象.GM)<GMLevel) then
--NLG.SystemMessage(_PlayerIndex,"[系统] 你不是GM,无法使用此功能")
return 1
end
if CheckCommand(TalkMsg, "公告")==true or CheckCommand(TalkMsg, "msg")==true then
local CdKey = Char.GetData(_PlayerIndex,常量.对象.账号);
local toStr = ""
if CheckCommand(TalkMsg, "公告")==true then
toStr = GetCommandPara(TalkMsg ,"公告")
elseif CheckCommand(TalkMsg, "msg")==true then
toStr = GetCommandPara(TalkMsg ,"msg")
end
local toPlayer = toStr[1]
local toMsg = toStr[2]
local toCdKey = -1
for k,v in pairs(Players) do
if v.Index==tonumber(toPlayer) or v.Name==toPlayer or k==toPlayer then
toCdKey=k
end
end
if toCdKey~=-1 then
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] 公告:" .. toMsg)
NLG.SystemMessage(_PlayerIndex,"[系统] " .. Players[toCdKey]["Name"] .. "玩家公告发放完毕")
elseif toPlayer=="all" or toPlayer=="All" or toPlayer=="全部" or toPlayer=="全" or toPlayer=="-1" or toPlayer==-1 or toPlayer=="*" then
local rt = ""
for k,v in pairs(Players) do
NLG.SystemMessage(v["Index"], "[系统] 公告:" .. toMsg)
end
NLG.SystemMessage(_PlayerIndex,"[系统] 所有在线玩家公告发放完毕")
else
NLG.SystemMessage(_PlayerIndex,"[系统] 没有找到该玩家或该玩家不在线。")
end
return 0
elseif CheckCommand(TalkMsg, "踢出")==true or CheckCommand(TalkMsg, "kill")==true then
local CdKey = Char.GetData(_PlayerIndex,常量.对象.账号);
local toStr = ""
if CheckCommand(TalkMsg, "踢出")==true then
toStr = GetCommandPara(TalkMsg ,"踢出")[1]
elseif CheckCommand(TalkMsg, "kill")==true then
toStr = GetCommandPara(TalkMsg ,"kill")[1]
end
local toPlayer = toStr
local toCdKey = -1
for k,v in pairs(Players) do
if v.Index==tonumber(toPlayer) or v.Name==toPlayer or k==toPlayer then
toCdKey=k
end
end
if toCdKey~=-1 then
NLG.SystemMessage(_PlayerIndex,"[系统] 你已将 [" .. Players[toCdKey].Index .. "][" .. toCdKey .. "]" .. Players[toCdKey].Name .. " 踢出。")
NLG.Kill(Players[toCdKey].Index)
elseif toPlayer=="all" or toPlayer=="All" or toPlayer=="全部" or toPlayer=="全" or toPlayer=="-1" or toPlayer==-1 or toPlayer=="*" then
local rt = ""
for k,v in pairs(Players) do
toCdKey=k
NLG.Kill(Players[toCdKey].Index)
end
NLG.SystemMessage(_PlayerIndex,"[系统] 已将所有玩家踢出")
elseif toCdKey==Char.GetData(_PlayerIndex,常量.对象.账号) then
NLG.SystemMessage(_PlayerIndex,"[系统] 不能踢出自己")
else
NLG.SystemMessage(_PlayerIndex,"[系统] 没有找到该玩家或该玩家不在线。")
end
return 0
elseif CheckCommand(TalkMsg, "鉴定")==true or CheckCommand(TalkMsg, "ju")==true then
local Count = 0
for ItemSlot = 8,27 do
local ItemIndex = Char.GetItemIndex(_PlayerIndex, ItemSlot)
if ItemIndex > 0 then
if Item.GetData(ItemIndex, 63)==0 then
Count = Count + 1
Item.SetData(ItemIndex, 63, 1)
NLG.SystemMessage(_PlayerIndex,"[系统] 你身上的 " .. Item.GetData(ItemIndex, 2000) .. " 已鉴定为 " .. Item.GetData(ItemIndex, 2001))
Item.UpItem(_PlayerIndex, ItemSlot)
end
end
end
if Count==0 then
NLG.SystemMessage(_PlayerIndex, "[系统] 你身上没有需要鉴定的物品")
end
return 0
elseif CheckCommand(TalkMsg, "清空")==true or CheckCommand(TalkMsg, "clear")==true then
for ItemSlot = 8,27 do
local ItemIndex = Char.GetItemIndex(_PlayerIndex, ItemSlot)
local ItemID = Item.GetData(ItemIndex, %道具_ID%)
Char.DelItem(_PlayerIndex, ItemID, 999999)
end
return 0
elseif CheckCommand(TalkMsg, "召唤")==true or CheckCommand(TalkMsg, "call")==true then
local CdKey = Char.GetData(_PlayerIndex,常量.对象.账号);
local toStr = ""
if CheckCommand(TalkMsg, "召唤")==true then
toStr = GetCommandPara(TalkMsg ,"召唤")[1]
elseif CheckCommand(TalkMsg, "call")==true then
toStr = GetCommandPara(TalkMsg ,"call")[1]
end
local toPlayer = toStr
local toCdKey = -1
for k,v in pairs(Players) do
if v.Index==tonumber(toPlayer) or v.Name==toPlayer or k==toPlayer then
toCdKey=k
end
end
if toCdKey~=-1 then
Char.Warp( Players[toCdKey].Index, Char.GetData(_PlayerIndex, 常量.对象.地图类型), Char.GetData(_PlayerIndex, 常量.对象.地图), Char.GetData(_PlayerIndex, 常量.对象.X), Char.GetData(_PlayerIndex, 常量.对象.Y))
--NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] 你已被强制召唤到" .. Char.GetData(_PlayerIndex,常量.对象.原名) .. " 身边")
--NLG.SystemMessage(_PlayerIndex, "[系统] 你已强制召唤 " .. Players[toCdKey]["Name"] .. " 到身边")
elseif toPlayer=="all" or toPlayer=="All" or toPlayer=="全部" or toPlayer=="全" or toPlayer=="-1" or toPlayer==-1 or toPlayer=="*" then
local rt = ""
for k,v in pairs(Players) do
toCdKey=k
Char.Warp( Players[toCdKey].Index, Char.GetData(_PlayerIndex, 常量.对象.地图类型), Char.GetData(_PlayerIndex, 常量.对象.地图), Char.GetData(_PlayerIndex, 常量.对象.X), Char.GetData(_PlayerIndex, 常量.对象.Y))
end
NLG.SystemMessage(_PlayerIndex,"[系统] 所有在线玩家召唤完毕")
elseif toCdKey==Char.GetData(_PlayerIndex,常量.对象.账号) then
NLG.SystemMessage(_PlayerIndex,"[系统] 不能召唤自己")
else
NLG.SystemMessage(_PlayerIndex,"[系统] 没有找到该玩家或该玩家不在线。")
end
return 0
elseif CheckCommand(TalkMsg, "跟踪")==true or CheckCommand(TalkMsg, "follow")==true then
local CdKey = Char.GetData(_PlayerIndex,常量.对象.账号);
local toStr = ""
if CheckCommand(TalkMsg, "跟踪")==true then
toStr = GetCommandPara(TalkMsg ,"跟踪")[1]
elseif CheckCommand(TalkMsg, "follow")==true then
toStr = GetCommandPara(TalkMsg ,"follow")[1]
end
local toPlayer = toStr
local toCdKey = -1
for k,v in pairs(Players) do
if v.Index==tonumber(toPlayer) or v.Name==toPlayer or k==toPlayer then
toCdKey=k
end
end
if toCdKey~=-1 then
Char.Warp( _PlayerIndex, Char.GetData(Players[toCdKey]["Index"], 常量.对象.地图类型), Char.GetData(Players[toCdKey]["Index"], 常量.对象.地图), Char.GetData(Players[toCdKey]["Index"], 常量.对象.X), Char.GetData(Players[toCdKey]["Index"], 常量.对象.Y))
--NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] 你已被 " .. Char.GetData(_PlayerIndex,常量.对象.原名) .. " 跟踪")
--NLG.SystemMessage(_PlayerIndex, "[系统] 你已跟踪 " .. Players[toCdKey]["Name"] .. " 身边")
elseif toCdKey==Char.GetData(_PlayerIndex,常量.对象.账号) then
NLG.SystemMessage(_PlayerIndex,"[系统] 不能跟踪自己")
else
NLG.SystemMessage(_PlayerIndex,"[系统] 没有找到该玩家或该玩家不在线。")
end
return 0
elseif CheckCommand(TalkMsg, "称号重置")==true then
local CdKey = Char.GetData(_PlayerIndex,常量.对象.账号);
local toStr = ""
if CheckCommand(TalkMsg, "称号重置")==true then
toStr = GetCommandPara(TalkMsg ,"称号重置")[1]
end
local toPlayer = toStr
local toCdKey = -1
for k,v in pairs(Players) do
if v.Index==tonumber(toPlayer) or v.Name==toPlayer or k==toPlayer then
toCdKey=k
end
end
if toCdKey~=-1 then
Field.Set(Players[toCdKey].Index,"TitleOn",0)
NLG.SystemMessage(_PlayerIndex,"[系统] 重置成功"..Field.Get(Players[toCdKey].Index,"TitleOn")..Char.GetData(Players[toCdKey]["Index"], %对象_账号%))
elseif toCdKey==Char.GetData(_PlayerIndex,常量.对象.账号) then
NLG.SystemMessage(_PlayerIndex,"[系统] 不能重置自己")
else
NLG.SystemMessage(_PlayerIndex,"[系统] 没有找到该玩家或该玩家不在线。")
end
return 0
elseif CheckCommand(TalkMsg, "传送")==true or CheckCommand(TalkMsg, "teleport")==true then
local CdKey = Char.GetData(_PlayerIndex,常量.对象.账号);
local toStr = ""
if CheckCommand(TalkMsg, "传送")==true then
toStr = GetCommandPara(TalkMsg ,"传送")
elseif CheckCommand(TalkMsg, "teleport")==true then
toStr = GetCommandPara(TalkMsg ,"teleport")
end
local toPlayer = toStr[1]
local toMapType = toStr[2]
local toMapID = toStr[3]
local toPosX = toStr[4]
local toPosY = toStr[5]
if toMapType==nil or toMapID==nil or toPosX==nil or toPosY==nil then
NLG.SystemMessage(_PlayerIndex,"[系统] 参数错误,请重新输入!")
return 0
end
local toCdKey = -1
for k,v in pairs(Players) do
if v.Index==tonumber(toPlayer) or v.Name==toPlayer or k==toPlayer then
toCdKey=k
end
end
if toCdKey~=-1 then
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] GM对你进行操作:")
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] 传送完毕")
Char.Warp(Players[toCdKey]["Index"], toMapType, toMapID, toPosX, toPosY)
NLG.SystemMessage(_PlayerIndex,"[系统] " .. Players[toCdKey]["Name"] .. " 传送完毕")
elseif toPlayer=="all" or toPlayer=="All" or toPlayer=="全部" or toPlayer=="全" or toPlayer=="-1" or toPlayer==-1 or toPlayer=="*" then
local rt = ""
for k,v in pairs(Players) do
toCdKey=k
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] GM对你进行操作:")
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] 传送完毕")
Char.Warp(Players[toCdKey]["Index"], toMapType, toMapID, toPosX, toPosY)
end
NLG.SystemMessage(_PlayerIndex,"[系统] 所有在线玩家传送完毕")
else
NLG.SystemMessage(_PlayerIndex,"[系统] 没有找到该玩家或该玩家不在线")
end
return 0
elseif CheckCommand(TalkMsg, "查人物")==true or CheckCommand(TalkMsg, "checkplayer")==true then
local CdKey = Char.GetData(_PlayerIndex,常量.对象.账号);
local toStr = ""
if CheckCommand(TalkMsg, "查人物")==true then
toStr = GetCommandPara(TalkMsg ,"查人物")[1]
elseif CheckCommand(TalkMsg, "checkplayer")==true then
toStr = GetCommandPara(TalkMsg ,"checkplayer")[1]
end
local toPlayer = toStr
local toCdKey = -1
for k,v in pairs(Players) do
if v.Index==tonumber(toPlayer) or v.Name==toPlayer or k==toPlayer then
toCdKey=k
end
end
if toCdKey~=-1 then
local buf= Char.GetData(Players[toCdKey]["Index"], 1) .. "|"
buf = buf .. "[" .. Players[toCdKey]["CdKey"] .. "]" .. Players[toCdKey]["Name"]
buf = buf .. " " .. getJobTypeName(Char.GetData(Players[toCdKey]["Index"], %对象_职类ID%)) .. Char.GetData(Players[toCdKey]["Index"], %对象_职阶%) .. "阶"
buf = buf .. " Lv." .. Char.GetData(Players[toCdKey]["Index"], 常量.对象.等级)
--buf = buf .. "\n【声望战绩信息】"
buf = buf .. "\n\n声望:" .. Char.GetData(Players[toCdKey]["Index"], %对象_声望%) .. " 战绩:" .. Char.GetData(Players[toCdKey]["Index"], %对象_DP%) .. " 幸运:" .. Char.GetData(Players[toCdKey]["Index"], %对象_运%)
--buf = buf .. "\n【金币信息】"
buf = buf .. "\n\n身上:" .. Char.GetData(Players[toCdKey]["Index"], %对象_金币%) .. "G"
buf = buf .. " 银行:" .. Char.GetData(Players[toCdKey]["Index"], %对象_银行金币%) .. "G"
--buf = buf .. "\n【登录信息】"
buf = buf .. "\n\n上次离线:" .. os.date("%Y.%m.%d %X", Char.GetData(Players[toCdKey]["Index"], 148))
buf = buf .. "\n本次登入:" .. os.date("%Y.%m.%d %X", Char.GetData(Players[toCdKey]["Index"], 600))
--[[
buf = buf .. "\n登录[" .. Char.GetData(Players[toCdKey]["Index"], 65) .. ",走动[" .. Char.GetData(Players[toCdKey]["Index"], %对象_走动次数%)
buf = buf .. ",死亡" .. Char.GetData(Players[toCdKey]["Index"], %对象_死亡数%) .. ",杀敌[" .. Char.GetData(Players[toCdKey]["Index"], %对象_杀宠数%) .. ",被打[" .. Char.GetData(Players[toCdKey]["Index"], %对象_伤害数%)
buf = buf .. ",获宠" .. Char.GetData(Players[toCdKey]["Index"], %对象_获得宠数%) .. ",生产[" .. Char.GetData(Players[toCdKey]["Index"], %对象_生产数%) .. ",封印[" .. Char.GetData(Players[toCdKey]["Index"], %对象_封印数%)
--]]
WindowTalkedSelf = WindowTalkedSelf or NL.CreateNpc("lua/System/BaseModule/Base.lua", "Myinit");
NLG.ShowWindowTalked( _PlayerIndex, 37, 1, 999, buf, WindowTalkedSelf );
end
elseif CheckCommand(TalkMsg, "查物品")==true or CheckCommand(TalkMsg, "查道具")==true or CheckCommand(TalkMsg, "checkitem")==true then
local CdKey = Char.GetData(_PlayerIndex,常量.对象.账号);
local toStr = ""
if CheckCommand(TalkMsg, "查物品")==true then
toStr = GetCommandPara(TalkMsg ,"查物品")[1]
elseif CheckCommand(TalkMsg, "查道具")==true then
toStr = GetCommandPara(TalkMsg ,"查道具")[1]
elseif CheckCommand(TalkMsg, "checkitem")==true then
toStr = GetCommandPara(TalkMsg ,"checkitem")[1]
end
local toPlayer = toStr
local toCdKey = -1
for k,v in pairs(Players) do
if v.Index==tonumber(toPlayer) or v.Name==toPlayer or k==toPlayer then
toCdKey=k
end
end
if toCdKey~=-1 then
local ItemPosName = {"头部", "身体", "右手", "左手", "脚部", "饰品1", "饰品2", "水晶"}
NLG.SystemMessage(_PlayerIndex,"[系统] 玩家 [" .. Players[toCdKey]["Index"] .. "][" .. Players[toCdKey]["CdKey"] .. "]" .. Players[toCdKey]["Name"] .. " 道具清单如下:")
NLG.SystemMessage(_PlayerIndex," 名称(ID) 类型 Lv 堆叠 耐久")
for i = 1,28 do
local Pos = i-1
local buf = ""
local ItemIndex = Char.GetItemIndex(Players[toCdKey]["Index"], Pos)
if ItemPosName[i]~=nil then
buf = buf .. strFormat(ItemPosName[i],6,1) .. ":"
else
buf = buf .. strFormat("道具" .. Pos-7,6,1) .. ":"
end
if ItemIndex>=0 then
buf = buf .. strFormat(Item.GetData(ItemIndex, 2001) .. "[" .. Item.GetData(ItemIndex, 0) .. "]",18,2) .. " " --名称
buf = buf .. strFormat(getItemTypeName(Item.GetData(ItemIndex, %道具_类型%)),8,2) .. " " --类型
buf = buf .. strFormat(Item.GetData(ItemIndex, %道具_等级%),3,3) .. " " --等级
buf = buf .. strFormat(Item.GetData(ItemIndex, %道具_堆叠数%),4,3) .. "/" .. strFormat(Item.GetData(ItemIndex, %道具_最大堆叠数%),4,1) .. " " --堆叠
buf = buf .. strFormat(Item.GetData(ItemIndex, 65),4,3) .. "/" .. strFormat(Item.GetData(ItemIndex, %道具_最大耐久%),4,1) --耐久
else
--buf = buf .. "空"
end
NLG.SystemMessage(_PlayerIndex, buf)
end
else
NLG.SystemMessage(_PlayerIndex,"[系统] 没有找到该玩家或该玩家不在线。")
end
return 0
elseif CheckCommand(TalkMsg, "查宠物")==true or CheckCommand(TalkMsg, "checkpet")==true then
local CdKey = Char.GetData(_PlayerIndex,常量.对象.账号);
local toStr = ""
if CheckCommand(TalkMsg, "查宠物")==true then
toStr = GetCommandPara(TalkMsg ,"查宠物")[1]
elseif CheckCommand(TalkMsg, "checkpet")==true then
toStr = GetCommandPara(TalkMsg ,"checkpet")[1]
end
local toPlayer = toStr
local toCdKey = -1
for k,v in pairs(Players) do
if v.Index==tonumber(toPlayer) or v.Name==toPlayer or k==toPlayer then
toCdKey=k
end
end
if toCdKey~=-1 then
NLG.SystemMessage(_PlayerIndex,"[系统] 玩家 [" .. Players[toCdKey]["Index"] .. "][" .. Players[toCdKey]["CdKey"] .. "]" .. Players[toCdKey]["Name"] .. " 宠物清单如下:")
NLG.SystemMessage(_PlayerIndex," 名称(ID) 类型 Lv 体 力 防 敏 魔 总")
for i = 1,5 do
local Pos = i-1
local buf = ""
local PetIndex = Char.GetPet(Players[toCdKey]["Index"], Pos)
buf = buf .. strFormat("宠物" .. i,5,1) .. ":"
if PetIndex>=0 then
buf = buf .. strFormat(Char.GetData(PetIndex, 常量.对象.原名) .. "[" .. Char.GetData(PetIndex, 68) .. "]",18,2) .. " " --名称
buf = buf .. strFormat(getPetTypeName(Char.GetData(PetIndex, %对象_种族%)),4,2) .. " " --类型
buf = buf .. strFormat(Char.GetData(PetIndex, 常量.对象.等级),3,3) .. " " --等级
buf = buf .. strFormat(Pet.GetArtRank(PetIndex, %宠档_体成%) - Pet.FullArtRank(PetIndex, %宠档_体成%),3,3) .. " " --体力档数
buf = buf .. strFormat(Pet.GetArtRank(PetIndex, %宠档_力成%) - Pet.FullArtRank(PetIndex, %宠档_力成%),3,3) .. " " --力量档数
buf = buf .. strFormat(Pet.GetArtRank(PetIndex, %宠档_强成%) - Pet.FullArtRank(PetIndex, %宠档_强成%),3,3) .. " " --强度档数
--123
--456
buf = buf .. strFormat(Pet.GetArtRank(PetIndex, %宠档_敏成%) - Pet.FullArtRank(PetIndex, %宠档_敏成%),3,3) .. " " --速度档数
buf = buf .. strFormat(Pet.GetArtRank(PetIndex, %宠档_魔成%) - Pet.FullArtRank(PetIndex, %宠档_魔成%),3,3) .. " " --魔法档数
buf = buf .. strFormat(Pet.GetArtRank(PetIndex, %宠档_体成%) + Pet.GetArtRank(PetIndex, %宠档_力成%) + Pet.GetArtRank(PetIndex, %宠档_强成%) + Pet.GetArtRank(PetIndex, %宠档_敏成%) + Pet.GetArtRank(PetIndex, %宠档_魔成%) - Pet.FullArtRank(PetIndex, %宠档_体成%) - Pet.FullArtRank(PetIndex, %宠档_力成%) - Pet.FullArtRank(PetIndex, %宠档_强成%) - Pet.FullArtRank(PetIndex, %宠档_敏成%) - Pet.FullArtRank(PetIndex, %宠档_魔成%),3,3) --总档数
else
--buf = buf .. "空"
end
NLG.SystemMessage(_PlayerIndex, buf)
end
else
NLG.SystemMessage(_PlayerIndex,"[系统] 没有找到该玩家或该玩家不在线。")
end
return 0
elseif CheckCommand(TalkMsg, "给物品")==true or CheckCommand(TalkMsg, "给道具")==true or CheckCommand(TalkMsg, "giveitem")==true then
local CdKey = Char.GetData(_PlayerIndex,常量.对象.账号);
local toStr = ""
if CheckCommand(TalkMsg, "给物品")==true then
toStr = GetCommandPara(TalkMsg ,"给物品")
elseif CheckCommand(TalkMsg, "给道具")==true then
toStr = GetCommandPara(TalkMsg ,"给道具")
elseif CheckCommand(TalkMsg, "giveitem")==true then
toStr = GetCommandPara(TalkMsg ,"giveitem")
end
local toPlayer = toStr[1]
local toItemID = toStr[2]
local toItemNum = toStr[3] or 1
local toCdKey = -1
for k,v in pairs(Players) do
if v.Index==tonumber(toPlayer) or v.Name==toPlayer or k==toPlayer then
toCdKey=k
end
end
if toCdKey~=-1 then
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] GM对你进行操作:")
Char.GiveItem(Players[toCdKey]["Index"], toItemID, toItemNum)
NLG.SystemMessage(_PlayerIndex,"[系统] " .. Players[toCdKey]["Name"] .. "物品发放完毕")
elseif toPlayer=="all" or toPlayer=="All" or toPlayer=="全部" or toPlayer=="全" or toPlayer=="-1" or toPlayer==-1 or toPlayer=="*" then
local rt = ""
for k,v in pairs(Players) do
toCdKey=k
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] GM对你进行操作:")
Char.GiveItem(Players[toCdKey]["Index"], toItemID, toItemNum)
end
NLG.SystemMessage(_PlayerIndex,"[系统] 所有在线玩家物品发放完毕")
else
NLG.SystemMessage(_PlayerIndex,"[系统] 没有找到该玩家或该玩家不在线")
end
return 0
elseif CheckCommand(TalkMsg, "删物品")==true or CheckCommand(TalkMsg, "删道具")==true or CheckCommand(TalkMsg, "killitem")==true then
local CdKey = Char.GetData(_PlayerIndex,常量.对象.账号);
local toStr = ""
if CheckCommand(TalkMsg, "删物品")==true then
toStr = GetCommandPara(TalkMsg ,"删物品")
elseif CheckCommand(TalkMsg, "删道具")==true then
toStr = GetCommandPara(TalkMsg ,"删道具")
elseif CheckCommand(TalkMsg, "killitem")==true then
toStr = GetCommandPara(TalkMsg ,"killitem")
end
local toPlayer = toStr[1]
local toItemID = toStr[2]
local toItemNum = toStr[3] or 1
local toCdKey = -1
for k,v in pairs(Players) do
if v.Index==tonumber(toPlayer) or v.Name==toPlayer or k==toPlayer then
toCdKey=k
end
end
if toCdKey~=-1 then
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] GM对你进行操作:")
Char.DelItem(Players[toCdKey]["Index"], toItemID, toItemNum)
NLG.SystemMessage(_PlayerIndex,"[系统] " .. Players[toCdKey]["Name"] .. "的物品删除完毕")
elseif toPlayer=="all" or toPlayer=="All" or toPlayer=="全部" or toPlayer=="全" or toPlayer=="-1" or toPlayer==-1 or toPlayer=="*" then
local rt = ""
for k,v in pairs(Players) do
toCdKey=k
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] GM对你进行操作:")
Char.DelItem(Players[toCdKey]["Index"], toItemID, toItemNum)
end
NLG.SystemMessage(_PlayerIndex,"[系统] 所有在线玩家物品删除完毕")
else
NLG.SystemMessage(_PlayerIndex,"[系统] 没有找到该玩家或该玩家不在线")
end
return 0
elseif CheckCommand(TalkMsg, "给满档宠物")==true or CheckCommand(TalkMsg, "givefullpet")==true then
local CdKey = Char.GetData(_PlayerIndex,常量.对象.账号);
local toStr = ""
if CheckCommand(TalkMsg, "给满档宠物")==true then
toStr = GetCommandPara(TalkMsg ,"给满档宠物")
elseif CheckCommand(TalkMsg, "givefullpet")==true then
toStr = GetCommandPara(TalkMsg ,"givefullpet")
end
local toPlayer = toStr[1]
local toPetID = toStr[2]
local toCdKey = -1
for k,v in pairs(Players) do
if v.Index==tonumber(toPlayer) or v.Name==toPlayer or k==toPlayer then
toCdKey=k
end
end
if toCdKey~=-1 then
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] GM对你进行操作:")
Char.AddPet(Players[toCdKey]["Index"], toPetID,1)
NLG.SystemMessage(_PlayerIndex,"[系统] " .. Players[toCdKey]["Name"] .. "满档宠物发放完毕")
elseif toPlayer=="all" or toPlayer=="All" or toPlayer=="全部" or toPlayer=="全" or toPlayer=="-1" or toPlayer==-1 or toPlayer=="*" then
local rt = ""
for k,v in pairs(Players) do
toCdKey=k
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] GM对你进行操作:")
Char.AddPet(Players[toCdKey]["Index"], toPetID,1)
end
NLG.SystemMessage(_PlayerIndex,"[系统] 所有在线玩家满档宠物发放完毕")
else
NLG.SystemMessage(_PlayerIndex,"[系统] 没有找到该玩家或该玩家不在线")
end
return 0
elseif CheckCommand(TalkMsg, "给宠物")==true or CheckCommand(TalkMsg, "givepet")==true then
local CdKey = Char.GetData(_PlayerIndex,常量.对象.账号);
local toStr = ""
if CheckCommand(TalkMsg, "给宠物")==true then
toStr = GetCommandPara(TalkMsg ,"给宠物")
elseif CheckCommand(TalkMsg, "givepet")==true then
toStr = GetCommandPara(TalkMsg ,"givepet")
end
local toPlayer = toStr[1]
local toPetID = toStr[2]
local toCdKey = -1
for k,v in pairs(Players) do
if v.Index==tonumber(toPlayer) or v.Name==toPlayer or k==toPlayer then
toCdKey=k
end
end
if toCdKey~=-1 then
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] GM对你进行操作:")
Char.AddPet(Players[toCdKey]["Index"], toPetID)
NLG.SystemMessage(_PlayerIndex,"[系统] " .. Players[toCdKey]["Name"] .. "宠物发放完毕")
elseif toPlayer=="all" or toPlayer=="All" or toPlayer=="全部" or toPlayer=="全" or toPlayer=="-1" or toPlayer==-1 or toPlayer=="*" then
local rt = ""
for k,v in pairs(Players) do
toCdKey=k
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] GM对你进行操作:")
Char.AddPet(Players[toCdKey]["Index"], toPetID)
end
NLG.SystemMessage(_PlayerIndex,"[系统] 所有在线玩家宠物发放完毕")
else
NLG.SystemMessage(_PlayerIndex,"[系统] 没有找到该玩家或该玩家不在线")
end
return 0
elseif CheckCommand(TalkMsg, "给魔币")==true or CheckCommand(TalkMsg, "givegold")==true then
local CdKey = Char.GetData(_PlayerIndex,常量.对象.账号);
local toStr = ""
if CheckCommand(TalkMsg, "给魔币")==true then
toStr = GetCommandPara(TalkMsg ,"给魔币")
elseif CheckCommand(TalkMsg, "givegold")==true then
toStr = GetCommandPara(TalkMsg ,"givegold")
end
local toPlayer = toStr[1]
local toAddGold = tonumber(toStr[2])
local toCdKey = -1
for k,v in pairs(Players) do
if v.Index==tonumber(toPlayer) or v.Name==toPlayer or k==toPlayer then
toCdKey=k
end
end
if toCdKey~=-1 then
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] GM对你进行打赏魔币:"..toAddGold)
Char.AddGold(Players[toCdKey]["Index"],toAddGold)
NLG.UpChar(Players[toCdKey]["Index"])
NLG.SystemMessage(_PlayerIndex,"[系统] " .. Players[toCdKey]["Name"] .. "魔币发放完毕"..toAddGold)
elseif toPlayer=="all" or toPlayer=="All" or toPlayer=="全部" or toPlayer=="全" or toPlayer=="-1" or toPlayer==-1 or toPlayer=="*" then
local rt = ""
for k,v in pairs(Players) do
toCdKey=k
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] GM心情不错,打赏全服奖励魔币:"..toAddGold)
Char.AddGold(Players[toCdKey]["Index"],toAddGold)
NLG.UpChar(Players[toCdKey]["Index"])
end
NLG.SystemMessage(_PlayerIndex,"[系统] 所有在线玩家魔币发放完毕"..toAddGold)
else
NLG.SystemMessage(_PlayerIndex,"[系统] 没有找到该玩家或该玩家不在线")
end
return 0
elseif CheckCommand(TalkMsg, "给经验")==true or CheckCommand(TalkMsg, "giveexp")==true then
local CdKey = Char.GetData(_PlayerIndex,常量.对象.账号);
local toStr = ""
if CheckCommand(TalkMsg, "给经验")==true then
toStr = GetCommandPara(TalkMsg ,"给经验")
elseif CheckCommand(TalkMsg, "giveexp")==true then
toStr = GetCommandPara(TalkMsg ,"giveexp")
end
local toPlayer = toStr[1]
local toAddExp = tonumber(toStr[2])
local toCdKey = -1
for k,v in pairs(Players) do
if v.Index==tonumber(toPlayer) or v.Name==toPlayer or k==toPlayer then
toCdKey=k
end
end
if toCdKey~=-1 then
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] GM对你进行操作:+"..toAddExp)
Char.SetData(Players[toCdKey]["Index"], %对象_经验%,Char.GetData(Players[toCdKey]["Index"], %对象_经验%)+toAddExp)
NLG.UpChar(Players[toCdKey]["Index"])
NLG.SystemMessage(_PlayerIndex,"[系统] " .. Players[toCdKey]["Name"] .. "经验发放完毕")
elseif toPlayer=="all" or toPlayer=="All" or toPlayer=="全部" or toPlayer=="全" or toPlayer=="-1" or toPlayer==-1 or toPlayer=="*" then
local rt = ""
for k,v in pairs(Players) do
toCdKey=k
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] GM对你进行经验操作:+"..toAddExp)
Char.SetData(Players[toCdKey]["Index"], %对象_经验%,Char.GetData(Players[toCdKey]["Index"], %对象_经验%)+toAddExp)
NLG.UpChar(Players[toCdKey]["Index"])
end
NLG.SystemMessage(_PlayerIndex,"[系统] 所有在线玩家经验发放完毕")
else
NLG.SystemMessage(_PlayerIndex,"[系统] 没有找到该玩家或该玩家不在线")
end
return 0
elseif CheckCommand(TalkMsg, "宠物经验")==true or CheckCommand(TalkMsg, "petexp")==true then
local CdKey = Char.GetData(_PlayerIndex,常量.对象.账号);
local toStr = ""
if CheckCommand(TalkMsg, "宠物经验")==true then
toStr = GetCommandPara(TalkMsg ,"宠物经验")
elseif CheckCommand(TalkMsg, "petexp")==true then
toStr = GetCommandPara(TalkMsg ,"petexp")
end
local toPlayer = toStr[1]
local toAddExp = tonumber(toStr[2])
local toCdKey = -1
for k,v in pairs(Players) do
if v.Index==tonumber(toPlayer) or v.Name==toPlayer or k==toPlayer then
toCdKey=k
end
end
if toCdKey~=-1 then
Pos= Char.GetData(Players[toCdKey]["Index"], %对象_战宠%)
if Pos >=0 then
PetIndex =Char.GetPet(Players[toCdKey]["Index"],Pos)
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] GM对你宠物进行经验操作:+"..toAddExp)
Char.SetData(PetIndex, %对象_经验%,Char.GetData(PetIndex,%对象_经验%)+toAddExp)
Pet.UpPet(Players[toCdKey]["Index"],PetIndex)
NLG.SystemMessage(_PlayerIndex,"[系统] " .. Players[toCdKey]["Name"] .. "宠物"..Char.GetData(PetIndex,%对象_原名%).."经验发放完毕"..toAddExp)
else
NLG.SystemMessage(_PlayerIndex,"[系统] " .. Players[toCdKey]["Name"] .. "无战宠,设置失败")
end
elseif toPlayer=="all" or toPlayer=="All" or toPlayer=="全部" or toPlayer=="全" or toPlayer=="-1" or toPlayer==-1 or toPlayer=="*" then
local rt = ""
for k,v in pairs(Players) do
toCdKey=k
Pos= Char.GetData(Players[toCdKey]["Index"], %对象_战宠%)
if Pos >=0 then
PetIndex =Char.GetPet(Players[toCdKey]["Index"],Pos)
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] GM对你宠物进行经验操作:+"..toAddExp)
Char.SetData(PetIndex, %对象_经验%,Char.GetData(PetIndex,%对象_经验%)+toAddExp)
Pet.UpPet(Players[toCdKey]["Index"],PetIndex)
else
NLG.SystemMessage(_PlayerIndex,"[系统] " .. Players[toCdKey]["Name"] .. "无战宠,设置失败")
end
end
NLG.SystemMessage(_PlayerIndex,"[系统] 所有在线玩家宠物经验发放完毕")
else
NLG.SystemMessage(_PlayerIndex,"[系统] 没有找到该玩家或该玩家不在线")
end
return 0
elseif CheckCommand(TalkMsg, "宠物档数")==true or CheckCommand(TalkMsg, "setpetd")==true then
local CdKey = Char.GetData(_PlayerIndex,常量.对象.账号);
local toStr = ""
if CheckCommand(TalkMsg, "宠物档数")==true then
toStr = GetCommandPara(TalkMsg ,"宠物档数")
elseif CheckCommand(TalkMsg, "setpetd")==true then
toStr = GetCommandPara(TalkMsg ,"setpetd")
end
local toPlayer = toStr[1]
local toti = tonumber(toStr[2]) or 0
local toli = tonumber(toStr[3]) or 0
local tofang = tonumber(toStr[4]) or 0
local tomin = tonumber(toStr[5]) or 0
local tomo = tonumber(toStr[6]) or 0
local toCdKey = -1
for k,v in pairs(Players) do
if v.Index==tonumber(toPlayer) or v.Name==toPlayer or k==toPlayer then
toCdKey=k
end
end
if toCdKey~=-1 then
Pos= Char.GetData(Players[toCdKey]["Index"], %对象_战宠%)
if Pos >=0 then
PetIndex =Char.GetPet(Players[toCdKey]["Index"],Pos)
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] GM对你宠物进行档数操作:"..toti..toli..tofang..tomin..tomo)
local rank1 = Pet.FullArtRank(PetIndex,%宠档_体成%);
Pet.SetArtRank(PetIndex,%宠档_体成%, rank1-toti);
local rank2 = Pet.FullArtRank(PetIndex,%宠档_力成%);
Pet.SetArtRank(PetIndex,%宠档_力成%, rank2-toli);
local rank3 = Pet.FullArtRank(PetIndex,%宠档_强成%);
Pet.SetArtRank(PetIndex,%宠档_强成%, rank3-tofang);
local rank4 = Pet.FullArtRank(PetIndex,%宠档_敏成%);
Pet.SetArtRank(PetIndex,%宠档_敏成%, rank4-tomin);
local rank5 = Pet.FullArtRank(PetIndex,%宠档_魔成%);
Pet.SetArtRank(PetIndex,%宠档_魔成%, rank5-tomo);
Pet.ReBirth(Players[toCdKey]["Index"],PetIndex);
Pet.UpPet(Players[toCdKey]["Index"],Pos)
NLG.SystemMessage(_PlayerIndex,"[系统] " .. Players[toCdKey]["Name"] .. "宠物"..Char.GetData(PetIndex,%对象_原名%).."档数操作完毕"..toAddExp)
else
NLG.SystemMessage(_PlayerIndex,"[系统] " .. Players[toCdKey]["Name"] .. "无战宠,设置失败")
end
elseif toPlayer=="all" or toPlayer=="All" or toPlayer=="全部" or toPlayer=="全" or toPlayer=="-1" or toPlayer==-1 or toPlayer=="*" then
NLG.SystemMessage(_PlayerIndex,"[系统]该指令不支持全体")
return 0
else
NLG.SystemMessage(_PlayerIndex,"[系统] 没有找到该玩家或该玩家不在线")
end
return 0
elseif CheckCommand(TalkMsg, "删宠物")==true or CheckCommand(TalkMsg, "killpet")==true then
local CdKey = Char.GetData(_PlayerIndex,常量.对象.账号);
local toStr = ""
if CheckCommand(TalkMsg, "删宠物")==true then
toStr = GetCommandPara(TalkMsg ,"删宠物")
elseif CheckCommand(TalkMsg, "killpet")==true then
toStr = GetCommandPara(TalkMsg ,"killpet")
end
local toPlayer = toStr[1]
local toPetID = toStr[2]
local toLevel = tonumber(toStr[4]) or 1
local toMode = nil
if toStr[3]==">=" then
toMode=2
elseif toStr[3]==">" then
toMode=2
toLevel = toLevel + 1
elseif toStr[3]=="=" then
toMode=1
elseif toStr[3]=="<" then
toMode=0
toLevel = toLevel - 1
elseif toStr[3]=="<=" then
toMode=0
end
if toStr[3]==nil or toStr[4]==nil then
toMode=2
toLevel=1
end
local toCdKey = -1
for k,v in pairs(Players) do
if v.Index==tonumber(toPlayer) or v.Name==toPlayer or k==toPlayer then
toCdKey=k
end
end
if toCdKey~=-1 then
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] GM对你进行操作:")
Char.DelPet(Players[toCdKey]["Index"], toPetID, toLevel, toMode)
NLG.SystemMessage(_PlayerIndex,"[系统] " .. Players[toCdKey]["Name"] .. "的宠物删除完毕")
elseif toPlayer=="all" or toPlayer=="All" or toPlayer=="全部" or toPlayer=="全" or toPlayer=="-1" or toPlayer==-1 or toPlayer=="*" then
local rt = ""
for k,v in pairs(Players) do
toCdKey=k
NLG.SystemMessage(Players[toCdKey]["Index"], "[系统] GM对你进行操作:")
Char.DelPet(Players[toCdKey]["Index"], toPetID, toLevel, toMode)
end
NLG.SystemMessage(_PlayerIndex,"[系统] 所有在线玩家宠物删除完毕")
else
NLG.SystemMessage(_PlayerIndex,"[系统] 没有找到该玩家或该玩家不在线")
end
return 0
elseif CheckCommand(TalkMsg, "高级在线")==true or CheckCommand(TalkMsg, "list")==true or CheckCommand(TalkMsg, "l")==true then
NLG.SystemMessage(_PlayerIndex, "全部在线玩家如下:");
for Key,Value in pairs(Players) do
local tName = Char.GetData(Value.Index, 常量.对象.原名) --Name
local tLv = Char.GetData(Value.Index, 常量.对象.等级) --Lv
local tMapName = ""
if Char.GetData(Value.Index, 常量.对象.地图类型)==0 then
tMapName = getMapName(Char.GetData(Value.Index, 常量.对象.地图))
elseif Char.GetData(Value.Index, 常量.对象.地图类型)==1 then
tMapName = "随机迷宫"
elseif Char.GetData(Value.Index, 常量.对象.地图类型)==2 then
tMapName = "出租屋"
else
tMapName = "未知"
end
local tMapPos = Char.GetData(Value.Index, 常量.对象.地图类型) .. "." .. Char.GetData(Value.Index, 常量.对象.地图) .. "." .. Char.GetData(Value.Index, 常量.对象.X) .. "." .. Char.GetData(Value.Index, 常量.对象.Y)
local BattleStat = ""
if Char.GetData(Value.Index, 8000)==true then BattleStat=" *战斗中*" end
NLG.SystemMessage(_PlayerIndex, "[" .. Value.Index .. "][" .. Value.CdKey .. "]" .. tName .. "(Lv." .. tLv .. ") At " .. tMapName .. " [" .. tMapPos .. "] " .. BattleStat);
end
return 0
elseif CheckCommand(TalkMsg, "地图在线")==true or CheckCommand(TalkMsg, "maplist")==true or CheckCommand(TalkMsg, "ml")==true then
NLG.SystemMessage(_PlayerIndex, "当前地图在线玩家如下:");
for Key,Value in pairs(Players) do
if Char.GetData(_PlayerIndex, 常量.对象.地图类型)==Char.GetData(Value.Index, 常量.对象.地图类型) and Char.GetData(_PlayerIndex, 常量.对象.地图)==Char.GetData(Value.Index, 常量.对象.地图) then
local tName = Char.GetData(Value.Index, 常量.对象.原名) --Name
local tLv = Char.GetData(Value.Index, 常量.对象.等级) --Lv
local tMapName = ""
if Char.GetData(Value.Index, 常量.对象.地图类型)==0 then
--123
--456
tMapName = getMapName(Char.GetData(Value.Index, 常量.对象.地图))
elseif Char.GetData(Value.Index, 常量.对象.地图类型)==1 then
tMapName = "随机迷宫"
elseif Char.GetData(Value.Index, 常量.对象.地图类型)==2 then
tMapName = "出租屋"
else
tMapName = "未知"
end
local pMapID = Char.GetData(_PlayerIndex, 常量.对象.地图)
--123
--456
local tMapPos = Char.GetData(Value.Index, 常量.对象.地图类型) .. "." .. Char.GetData(Value.Index, 常量.对象.地图) .. "." .. Char.GetData(Value.Index, 常量.对象.X) .. "." .. Char.GetData(Value.Index, 常量.对象.Y)
local BattleStat = ""
if Char.GetData(Value.Index, 8000)==true then BattleStat=" *战斗中*" end
NLG.SystemMessage(_PlayerIndex, "[" .. Value.Index .. "][" .. Value.CdKey .. "]" .. tName .. "(Lv." .. tLv .. ") At " .. tMapName .. " [" .. tMapPos .. "] " .. BattleStat);
end
end
return 0
elseif CheckCommand(TalkMsg, "经验加成")==true or CheckCommand(TalkMsg, "jyjc")==true then
local toStr = ""
if CheckCommand(TalkMsg, "经验加成")==true then
toStr = GetCommandPara(TalkMsg ,"经验加成")
elseif CheckCommand(TalkMsg, "jyjc")==true then
toStr = GetCommandPara(TalkMsg ,"jyjc")
end
ExpADD(toStr[1],0)
return 0
elseif CheckCommand(TalkMsg, "lua")==true then
toStr = GetCommandPara(TalkMsg ,"lua")[1]
f = loadstring(toStr)
print("Lua脚本调试语句:|" .. toStr .. "|")
print("Lua脚本调试结果:")
local rt = f()
if type(rt)=="nil" then rt="nil" end
if type(rt)=="table" then rt="table" end
if type(rt)=="function" then rt="function" end
print(rt)
print("Lua脚本调试结束。")
return 0
end
return 1
end
function CheckGMPassword(Msg)
local RightGM = "[" .. GMPassword .. " "
if string.sub(Msg,1,string.len(GMPassword)+2) == RightGM then
return true
end
return false
end
function CheckCommand(Msg, Cmd)
local sMsg = string.sub(Msg, string.len("[" .. GMPassword .. " ")+1)
if sMsg==Cmd then
return true
end
if string.find(sMsg, " ")~=nil then
local tMsg = Split(sMsg, " ")
if tMsg[1]==Cmd then
return true
end
end
return false
end
function GetCommandPara(Msg, Cmd)
local sMsg = string.sub(Msg, string.len("[" .. GMPassword .. " ")+1)
local tPara = Split(sMsg, " ")
table.remove(tPara, 1)
return tPara
end
复制代码
lua/module中,放入basedata.lua,暨lua/module/basedata.lua
(代码中,对应技能、地图id和名字等与你sf不一样的,可以自行修改,不改也能用,没什么大的影响
lua/module中,放入onlineplayer.lua,暨lua/module/onlineplayer.lua
Module.rar
(28.11 KB, 下载次数: 3)
(这2个lua太长了发不出,只能打包了,rar中包含basedata.lua onlineplayer.lua)
lua/config.lua中,最后一行添加
useModule("EasyGM"); --lua gm命令扩展
useModule("BaseData"); --lua gm命令扩展 复制代码
lua/config.lua中,修改
--useModule("OnlinePlayer"); --玩家在线列表(必须) 复制代码
为
useModule("OnlinePlayer"); --玩家在线列表(必须) 复制代码