filhodaputa
New Member
- Joined
- Apr 29, 2010
- Messages
- 4
- Reaction score
- 0
Hello! i need a simple call with lua to know the private channel id...
well i know private channel have a number between 100 and 10000...
where i call this:
in lua
in luascript.cpp i do:
in chat.cpp i created:
compilation work as well, but in game i get NULL...
someone can help-me?
thx advanced!
well i know private channel have a number between 100 and 10000...
where i call this:
in lua
Code:
getPlayerChannelId(cid)
in luascript.cpp i do:
Code:
int32_t LuaScriptInterface::luagetPlayerChannelId(lua_State* L)
{
ScriptEnviroment* env = getEnv();
uint32_t cid = popNumber(L);
Player* player = env->getPlayerByUID(cid);
if(PrivateChatChannel* channel = g_chat.getChannelidByplayer(player))
{
lua_pushnumber(L, channel->getId());
} else {
lua_pushboolean(L, false);
}}
Code:
PrivateChatChannel* Chat::getChannelidByplayer(Player* player)
{
if(!player || player->isRemoved())
return NULL;
PrivateChatChannel* channel = NULL;
for(PrivateChannelMap::iterator it = m_privateChannels.begin(); it != m_privateChannels.end(); ++it)
{
if((channel = it->second) && channel->getOwner() == player->getGUID())
return channel;
}
return NULL;
}
compilation work as well, but in game i get NULL...
someone can help-me?
thx advanced!