• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Invite House Guest Script

Arn

Member
Joined
Mar 8, 2010
Messages
282
Reaction score
18
Using TFS 0.2.13 pl1

I'm trying to write a simple script that will add a guest to the house. So far, it seems impossible. Please take a look at the script, and I will +rep anybody that can help.

Code:
function onSay(cid, words, param)

local house = getHouseByPlayerGUID(getPlayerGUID(cid))

local list = getHouseAccessList(house, 0x100)

setHouseAccessList(house, list, param)

end

For anybody that doesn't know, 0x100 is the guest list, and 0x101 is the subowner list.

-Arn
 
Code:
[b][color=#f75f5f]03:38 !lua return getHouseAccessList(42, 0x100)
[color=#FE6500]03:38 Matzor
Sickness
Clakzan
Frongdoof[/color]
03:39 !lua return setHouseAccessList(42, 0x100, 'Matzor\nSickness\nClakzan')
[color=#FE6500]03:39 true[/color]
03:39 !lua return getHouseAccessList(42, 0x100)
[color=#FE6500]03:39 Matzor
Sickness
Clakzan[/color][/color][/b]
seems to work fine in 0.3
 
I tried:

Code:
if setHouseAccessList(house, list, 'Tester') then

and it returns true. But the character still isn't a guest of the house, and when I get the access list again, its still blank.

Could you possibly paste your sources for that section?
 
[cpp]int32_t LuaScriptInterface::luaSetHouseAccessList(lua_State* L)
{
//setHouseAccessList(houseid, listid, listtext)
std::string list = popString(L);
uint32_t listid = popNumber(L);

if(House* house = Houses::getInstance()->getHouse(popNumber(L)))
{
house->setAccessList(listid, list);
lua_pushboolean(L, true);
}
else
{
errorEx(getError(LUA_ERROR_HOUSE_NOT_FOUND));
lua_pushboolean(L, false);
}
return 1;
}[/cpp]
[cpp]void House::setAccessList(uint32_t listId, const std::string& textlist, bool teleport/* = true*/)
{
if(listId == GUEST_LIST)
guestList.parseList(textlist);
else if(listId == SUBOWNER_LIST)
subOwnerList.parseList(textlist);
else
{
if(Door* door = getDoorByNumber(listId))
door->setAccessList(textlist);
#ifdef __DEBUG_HOUSES__
else
std::cout << "[Failure - House::setAccessList] door == NULL, listId = " << listId <<std::endl;
#endif

return;
}

if(teleport)
removePlayers(false);
}[/cpp]
[cpp]bool AccessList::parseList(const std::string& _list)
{
playerList.clear();
guildList.clear();
expressionList.clear();
regexList.clear();

list = _list;
if(_list.empty())
return true;

std::stringstream listStream(_list);
std::string line;
while(getline(listStream, line))
{
trimString(line);
trim_left(line, "\t");

trim_right(line, "\t");
trimString(line);

toLowerCaseString(line);
if(line.substr(0, 1) == "#" || line.length() > 100)
continue;

if(line.find("@") != std::string::npos)
{
std::string::size_type pos = line.find("@");
addGuild(line.substr(pos + 1), line.substr(0, pos));
}
else if(line.find("!") != std::string::npos || line.find("*") != std::string::npos || line.find("?") != std::string::npos)
addExpression(line);
else
addPlayer(line);
}

return true;
}[/cpp]
 
Back
Top