qben360
Member
- Joined
- Feb 20, 2015
- Messages
- 170
- Solutions
- 1
- Reaction score
- 12
Hello guys i have creaturescript loot message, but this script sending loot info to Server log channel. I create a new channel name CHANNEL_LOOT, and i want to sending loot info into Loot Channel.
IN othire i didint find function about sends msg to channels, so i inject a luaDoPlayerSendChannelMessage to othire engine.
and its my function from lootmessage.lua
I need help to change some strings in function
to DoPlayerSendChannelMessage
IN othire i didint find function about sends msg to channels, so i inject a luaDoPlayerSendChannelMessage to othire engine.
C++:
int32_t LuaScriptInterface::luaDoPlayerSendChannelMessage(lua_State* L)
{
//doPlayerSendChannelMessage(cid, author, message, MessageClasses, channel)
uint16_t channelId = popNumber(L);
uint32_t cid = popNumber(L);
std::string text = popString(L), name = popString(L);
ScriptEnviroment* env = getScriptEnv();
Player* player = env->getPlayerByUID(popNumber(L));
if(!player)
{
reportErrorFunc(getErrorDesc(LUA_ERROR_PLAYER_NOT_FOUND));
lua_pushboolean(L, false);
return 1;
}
player->sendChannelMessage(name, text, (MessageClasses)cid, channelId);
lua_pushboolean(L, true);
return 1;
}
and its my function from lootmessage.lua
Lua:
if party then
local leaderid
for _, pid in ipairs(getPartyMembers(cid)) do
if isPartyLeader(pid) then
leaderid = pid
end
end
local hash = ("%d:%d"):format(leaderid, target)
if not MessageSent[hash] then
for _, pid in ipairs(getPartyMembers(cid)) do
if isPremium(pid) then
doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, 'Loot of '.. getArticleByWord(name) .. ' ' .. string.lower(name) .. ': ' .. (ret ~= '' and ret or 'nothing'))
end
end
MessageSent[hash] = true
addEvent(function() MessageSent[hash] = nil end, 1000)
end
else
if isPremium(cid) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Loot of '.. getArticleByWord(name) .. ' ' .. string.lower(name) .. ': ' .. (ret ~= '' and ret or 'nothing'))
end
end
I need help to change some strings in function
Lua:
doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, 'Loot of '.. getArticleByWord(name) .. ' ' .. string.lower(name) .. ': ' .. (ret ~= '' and ret or 'nothing'))
to DoPlayerSendChannelMessage