• 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 Function getHouseTiles(houseId)

Gesior.pl

Mega Noob&LOL 2012
Senator
Joined
Sep 18, 2007
Messages
2,967
Solutions
99
Reaction score
3,383
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