• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Lua Function getHouseTiles(houseId)

Gesior.pl

Mega Noob&LOL 2012
Senator
Joined
Sep 18, 2007
Messages
2,969
Solutions
99
Reaction score
3,386
Location
Poland
GitHub
gesior
getHouseTiles(houseId)
Function return table with positions of house tiles or boolean false if house does not exist.

Code for 0.3.6, change LuaScriptInterface to '0.4 code for LUA functions' and it will work.
luascript.h
[CPP]static int32_t luaGetHouseTiles(lua_State* L);[/CPP]
luascript.cpp
[CPP]
//getHouseTiles(houseId)
lua_register(m_luaState, "getHouseTiles", LuaScriptInterface::luaGetHouseTiles);
[/CPP]
luascript.cpp
[CPP]
int32_t LuaScriptInterface::luaGetHouseTiles(lua_State* L)
{
//getHouseTiles(houseId)
if(House* house = Houses::getInstance()->getHouse(popNumber(L)))
{
uint32_t i = 1;
lua_newtable(L);
for(HouseTileList::iterator houseTile = house->getHouseTileBegin(); houseTile != house->getHouseTileEnd(); ++houseTile)
{
lua_pushnumber(L, i);
Tile* tile = *houseTile;
pushPosition(L, tile->getPosition(), 0);
pushTable(L);
++i;
}
}
else
{
errorEx(getError(LUA_ERROR_HOUSE_NOT_FOUND));
lua_pushboolean(L, false);
}

return 1;
}
[/CPP]
 
Prolly

Lua:
for _, pos in pairs(getHouseTiles(HOUSEID)) do
doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
end
 
Nah. I will use it only for my friends OTSes and for OTSes that are ready to pay for it :)
 
Back
Top