• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Script errors

buyhouse.lua
Code:
  local config =  {
        teleportAccess = 3
}

function onSay(cid, words, param, channel)
        if(param == '') then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
                return true
        end

        local teleport = false
        local t = string.explode(param, ",")
        if(t[2]) then
                teleport = getBooleanFromString(t[2])
                param = t[1]
        end

        local house = getHouseByPlayerGUID(getPlayerGUIDByName(param))
        if(not house) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " does not own house or doesn't exists.")
                return true
        end

        local houseInfo = getHouseInfo(house)
        if(teleport and getPlayerAccess(cid) >= config.teleportAccess) then
                doTeleportThing(cid, houseInfo.entry)
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, param .. " owns house: " .. houseInfo.name .. ".")
        return true
end

addon.lua
Code:
[code=lua]function onSay(cid, words, param)

local itemid = 9693 -- the items id for addon doll
local msg = {"enter the correct name!", "You no have the Addon Doll!", "Bad param!", "You received your addons!"} -- the messages when use the talkaction

local femaleOutfits =
{
["citizen"]={136},
["hunter"]={137},
["mage"]={138},
["knight"]={139},
["noblewoman"]={140},
["summoner"]={141},
["warrior"]={142},
["barbarian"]={147},
["druid"]={148},
["wizard"]={149},
["oriental"]={150},
["pirate"]={155},
["assassin"]={156},
["beggar"]={157},
["shaman"]={158},
["norsewoman"]={252},
["nightmare"]={269},
["jester"]={270},
["brotherhood"]={279},
["demonhunter"]={288},
["yalaharian"]={324},
["warmaster"]={336},
["wayfarer"]={366},
["afflicted"]={431},
["elementalist"]={433},
["deepling"]={464},
["insectoid"]={466},
["entrepreneur"]={471},
["crystal warlord"]={513},
["soil guardian"]={514}

}
local maleOutfits =
{
["citizen"]={128},
["hunter"]={129},
["mage"]={130},
["knight"]={131},
["nobleman"]={132},
["summoner"]={133},
["warrior"]={134},
["barbarian"]={143},
["druid"]={144},
["wizard"]={145},
["oriental"]={146},
["pirate"]={151},
["assassin"]={152},
["beggar"]={153},
["shaman"]={154},
["norsewoman"]={251},
["nightmare"]={268},
["jester"]={273},
["brotherhood"]={278},
["demonhunter"]={289},
["yalaharian"]={325},
["warmaster"]={335},
["wayfarer"]={366},
["afflicted"]={430},
["elementalist"]={432},
["deepling"]={463},
["insectoid"]={465},
["entrepreneur"]={472},
["crystal warlord"]={512},
["soil guardian"]={516}
}
local param = string.lower(param)
if(getPlayerItemCount(cid, itemid) > 0) then
if(param ~= "" and maleOutfits[param] and femaleOutfits[param]) then
doPlayerRemoveItem(cid, itemid, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[4])
doSendMagicEffect(getCreaturePosition(cid), 33)
doSendAnimatedText(getPlayerPosition(cid), "AddonDoll", TEXTCOLOR_RED)
if(getPlayerSex(cid) == 0)then
doPlayerAddOutfit(cid, femaleOutfits[param][1], 3)
else
doPlayerAddOutfit(cid, maleOutfits[param][1], 3)
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[1])
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[2])
end
return TRUE
end
[/CODE]
 
buyhouse.lua
Code:
  local config =  {
        teleportAccess = 3
}

function onSay(cid, words, param, channel)
        if(param == '') then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
                return true
        end

        local teleport = false
        local t = string.explode(param, ",")
        if(t[2]) then
                teleport = getBooleanFromString(t[2])
                param = t[1]
        end

        local house = getHouseByPlayerGUID(getPlayerGUIDByName(param))
        if(not house) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " does not own house or doesn't exists.")
                return true
        end

        local houseInfo = getHouseInfo(house)
        if(teleport and getPlayerAccess(cid) >= config.teleportAccess) then
                doTeleportThing(cid, houseInfo.entry)
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, param .. " owns house: " .. houseInfo.name .. ".")
        return true
end


Code:
function onSay(cid, words, param, channel)
    if(param == "") then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return TRUE
    end

    local house = getHouseByPlayerGUID(getPlayerGUIDByName(param))
    if(not house) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " does not own house or doesn't exists.")
        return TRUE
    end

    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, param .. " owns house: " .. getHouseName(house) .. ".")
    return TRUE
end








addon.lua
Code:
[code=lua]function onSay(cid, words, param)

local itemid = 9693 -- the items id for addon doll
local msg = {"enter the correct name!", "You no have the Addon Doll!", "Bad param!", "You received your addons!"} -- the messages when use the talkaction

local femaleOutfits =
{
["citizen"]={136},
["hunter"]={137},
["mage"]={138},
["knight"]={139},
["noblewoman"]={140},
["summoner"]={141},
["warrior"]={142},
["barbarian"]={147},
["druid"]={148},
["wizard"]={149},
["oriental"]={150},
["pirate"]={155},
["assassin"]={156},
["beggar"]={157},
["shaman"]={158},
["norsewoman"]={252},
["nightmare"]={269},
["jester"]={270},
["brotherhood"]={279},
["demonhunter"]={288},
["yalaharian"]={324},
["warmaster"]={336},
["wayfarer"]={366},
["afflicted"]={431},
["elementalist"]={433},
["deepling"]={464},
["insectoid"]={466},
["entrepreneur"]={471},
["crystal warlord"]={513},
["soil guardian"]={514}

}
local maleOutfits =
{
["citizen"]={128},
["hunter"]={129},
["mage"]={130},
["knight"]={131},
["nobleman"]={132},
["summoner"]={133},
["warrior"]={134},
["barbarian"]={143},
["druid"]={144},
["wizard"]={145},
["oriental"]={146},
["pirate"]={151},
["assassin"]={152},
["beggar"]={153},
["shaman"]={154},
["norsewoman"]={251},
["nightmare"]={268},
["jester"]={273},
["brotherhood"]={278},
["demonhunter"]={289},
["yalaharian"]={325},
["warmaster"]={335},
["wayfarer"]={366},
["afflicted"]={430},
["elementalist"]={432},
["deepling"]={463},
["insectoid"]={465},
["entrepreneur"]={472},
["crystal warlord"]={512},
["soil guardian"]={516}
}
local param = string.lower(param)
if(getPlayerItemCount(cid, itemid) > 0) then
if(param ~= "" and maleOutfits[param] and femaleOutfits[param]) then
doPlayerRemoveItem(cid, itemid, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[4])
doSendMagicEffect(getCreaturePosition(cid), 33)
doSendAnimatedText(getPlayerPosition(cid), "AddonDoll", TEXTCOLOR_RED)
if(getPlayerSex(cid) == 0)then
doPlayerAddOutfit(cid, femaleOutfits[param][1], 3)
else
doPlayerAddOutfit(cid, maleOutfits[param][1], 3)
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[1])
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[2])
end
return TRUE
end
[/CODE]

what wrong with this ?
 
Code:
function onSay(cid, words, param, channel)
    if(param == "") then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return TRUE
    end

    local house = getHouseByPlayerGUID(getPlayerGUIDByName(param))
    if(not house) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " does not own house or doesn't exists.")
        return TRUE
    end

    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, param .. " owns house: " .. getHouseName(house) .. ".")
    return TRUE
end










what wrong with this ?
I replaced the buyhouse code but it did not work. It says Bad Param. in ingame chat when I use the !buyhouse command in front of a door. The other code still shows the same error and I do not know why.
 
Does addon.lua really start with "
LUA:
" ?

That would be weird (install error maybe), but it would explain the "parsing error on line 1" message.

re buyhouse:  "bad param" means something doesn't like the value of variable "param".
Probably this:   [CODE]getPlayerGUIDByName(param)


And please: don't filter the error messages you see. If you get a logged message, copy and paste the log here.
If you knew enough to select the specific things we need to solve your problem, you would already know enough to solve it yourself :)
 
Last edited:
Does addon.lua really start with "
LUA:
" ?

That would be weird (install error maybe), but it would explain the "parsing error on line 1" message.

re buyhouse:  "bad param" means something doesn't like the value of variable "param".
Probably this:   [CODE]getPlayerGUIDByName(param)


And please: don't filter the error messages you see. If you get a logged message, copy and paste the log here.
If you knew enough to select the specific things we need to solve your problem, you would already know enough to solve it yourself :)
Yes, the
LUA:
 is there.
 
Does addon.lua really start with "
LUA:
" ?

That would be weird (install error maybe), but it would explain the "parsing error on line 1" message.

re buyhouse:  "bad param" means something doesn't like the value of variable "param".
Probably this:   [CODE]getPlayerGUIDByName(param)


And please: don't filter the error messages you see. If you get a logged message, copy and paste the log here.
If you knew enough to select the specific things we need to solve your problem, you would already know enough to solve it yourself :)
Yes, the
LUA:
 is there.
 
I replaced the buyhouse code but it did not work. It says Bad Param. in ingame chat when I use the !buyhouse command in front of a door. The other code still shows the same error and I do not know why.

I use this and work

what TFS you use ?

Does addon.lua really start with "
LUA:
" ?

That would be weird (install error maybe), but it would explain the "parsing error on line 1" message.

re buyhouse:  "bad param" means something doesn't like the value of variable "param".
Probably this:   [CODE]getPlayerGUIDByName(param)


And please: don't filter the error messages you see. If you get a logged message, copy and paste the log here.
If you knew enough to select the specific things we need to solve your problem, you would already know enough to solve it yourself :)

About
LUA:
 I was reply on your post and it mistake :)
 
Yes, the
LUA:
 is there.[/quote]

Remove it and try again.


That will definitely blow up the Lua parser.

[] are used for array/table indexing, and they have to follow a variable name.
you can write
x = abc[code=lua]
and even if the code won't run, the parser doesn't care.

AFAIK a bare "[ ]" is always invalid - the parser will blow up, and the script won't load.
It might not stop OT starting, but it's likely to cause a lot of other problems :)
 
Remove it and try again.


That will definitely blow up the Lua parser.

[] are used for array/table indexing, and they have to follow a variable name.
you can write
x = abc
LUA:
and even if the code won't run, the parser doesn't care.

AFAIK a bare "[ ]" is always invalid - the parser will blow up, and the script won't load.
It might not stop OT starting, but it's likely to cause a lot of other problems :)[/quote]
It is going in the right directions, removing [code=lua] worked :)
But now I can not get the script to work. No errors but whenever I use the addon.lua script and say "!addon" it says "enter the correct name!". When I say like "!first mage addon" it does not do anything. No errors or texts.

When I use the buyhouse.lua script and say "!buyhouse" it says Command param required. with blue text in the chat. No errors tho.
 
try
Code:
local config = {
    teleportAccess = 3
}

function onSay(cid, words, param, channel)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return true
    end

    local teleport = false
    local t = string.explode(param, ",")
    if(t[2]) then
        teleport = getBooleanFromString(t[2])
    end

    local house = getHouseByPlayerGUID(getPlayerGUIDByName(t[1]))
    if(not house) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[1] .. " does not own house or doesn't exists.")
        return true
    end

    local houseInfo = getHouseInfo(house)
    if(teleport and getPlayerAccess(cid) >= config.teleportAccess) then
        doTeleportThing(cid, houseInfo.entry)
    end

    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, t[1] .. " owns house: " .. houseInfo.name .. ".")
    return true
end
 
There's not enough information here (yet :) to debug this.

1. Please post every part of the "chain" of definitions that leads to buyhouse.lus being executed.
- Specify the file names for each one
- You just have to include the relevant definitions if it's a big file. Full text if a small file.
Start at the end of \data\talkactions\talkactions.xml
There's probably a line like:
<talkaction words="!buyhouse" script="buyhouse.lua"/>

2. You need to provide more of the log information, with absolutely no changes to the text
- if those two lines above were all you got, please say so

3. You must provide the full, exact text of the command you use to run buyhouse.

4. The message above suggests that this code (at the start of buyhouse) is issuing that message:
Code:
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")

This would happen if you're leaving something off the command, or if the script that calls buyhouse drops some information that you provide in the command.

If you provide what I've asked for, we'll learn more, and maybe even solve the problem in the next cycle.
FWIW, if you only provide some of it I'm just going to ask for the rest :)
 
Last edited:
data/talkactions/talkactions.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<talkactions>
    <!-- commands -->
    <talkaction words="/ban" separator=" " script="ban.lua" />
    <talkaction words="/ipban" separator=" " script="ipban.lua" />
    <talkaction words="/unban" separator=" " script="unban.lua" />
    <talkaction words="/up" script="up.lua" />
    <talkaction words="/down" script="down.lua" />
    <talkaction words="/c" separator=" " script="teleport_creature_here.lua" />
    <talkaction words="/goto" separator=" " script="teleport_to_creature.lua" />
    <talkaction words="/owner" separator=" " script="owner.lua" />
    <talkaction words="/t" script="teleport_home.lua" />
    <talkaction words="/town" separator=" " script="teleport_to_town.lua" />
    <talkaction words="/a" separator=" " script="teleport_ntiles.lua" />
    <talkaction words="/pos" separator=" " script="position.lua" />
    <talkaction words="/info" separator=" " script="info.lua" />
    <talkaction words="/r" separator=" " script="removething.lua" />
    <talkaction words="/kick" separator=" " script="kick.lua" />
    <talkaction words="/openserver" script="openserver.lua" />
    <talkaction words="/closeserver" separator=" " script="closeserver.lua" />
    <talkaction words="/B" separator=" " script="broadcast.lua" />
    <talkaction words="/m" separator=" " script="place_monster.lua" />
    <talkaction words="/i" separator=" " script="create_item.lua" />
    <talkaction words="/s" separator=" " script="place_npc.lua" />
    <talkaction words="/addtutor" separator=" " script="add_tutor.lua" />
    <talkaction words="/removetutor" separator=" " script="remove_tutor.lua" />
    <talkaction words="/looktype" separator=" " script="looktype.lua" />
    <talkaction words="/summon" separator=" " script="place_summon.lua" />
    <talkaction words="/chameleon" separator=" " script="chameleon.lua" />
    <talkaction words="/addskill" separator=" " script="add_skill.lua" />
    <talkaction words="/mccheck" script="mccheck.lua" />
    <talkaction words="/ghost" script="ghost.lua" />
    <talkaction words="/clean" script="clean.lua" />
    <talkaction words="/hide" script="hide.lua" />
    <talkaction words="/save" script="save.lua" />

    <!-- player talkactions -->
    <talkaction words="!buyhouse" script="buyhouse.lua"/>
    <talkaction words="!leavehouse" script="leavehouse.lua"/>
    <talkaction words="!changesex" script="changesex.lua"/>
    <talkaction words="!uptime" script="uptime.lua"/>
    <talkaction words="!deathlist" script="deathlist.lua"/>
    <talkaction words="!kills" script="kills.lua"/>
    <talkaction words="!online" script="online.lua"/>
    <talkaction words="!serverinfo" script="serverinfo.lua"/>
    <talkaction words="!spells" script="spells.lua"/>
    <talkaction words="!aol" script="aol.lua"/>
    <talkaction words="!bless" script="bless.lua"/>
    <talkaction words="!addon" script="addon.lua"/>
    <talkaction words="!commands" script="commands.lua"/>

   
    <!-- test talkactions -->
    <talkaction words="!z" separator=" " script="magiceffect.lua"/>
    <talkaction words="!x" separator=" " script="animationeffect.lua"/>
</talkactions>

The !buyhouse runs this code in data/talkactions/scripts/buyhouse.lua
Code:
local config = {
    teleportAccess = 3
}

function onSay(cid, words, param, channel)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return true
    end

    local teleport = false
    local t = string.explode(param, ",")
    if(t[2]) then
        teleport = getBooleanFromString(t[2])
    end

    local house = getHouseByPlayerGUID(getPlayerGUIDByName(t[1]))
    if(not house) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[1] .. " does not own house or doesn't exists.")
        return true
    end

    local houseInfo = getHouseInfo(house)
    if(teleport and getPlayerAccess(cid) >= config.teleportAccess) then
        doTeleportThing(cid, houseInfo.entry)
    end

    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, t[1] .. " owns house: " .. houseInfo.name .. ".")
    return true
end

https://i.imgur.com/gUJ3fnu.png, Hwn I use the command ingame

I think I got everything here :P
 
I have the code for TFS 1.0, and my buyhouse.lua looks very different to yours.


The immediate issue you have is this code at the start of buyhouse:
Code:
function onSay(cid, words, param, channel)
   if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return true
end

--  more lua code after this ...

It tests if "param" (from the method signature) is an empty string. if it is, it issues that message, and exists the script.

Of course we've only explained the symptom, not the problem, but it's a start :)

If you had provided a valid parameter (I suppose this is some words after !buyhouse, but I don't actually know for sure)
this code would be executed:
Code:
local t = string.explode(param, ",")
if(t[2]) then
      teleport = getBooleanFromString(t[2])
end
It wants param to contain a string with a "," in it. It instects the part after the "," and if it finds anything other than "false" (or maybe one other special value) it will set flag "teleport" to "true".

Then it checks if the player owns a house, and if they're cool enough to be allowed to teleport. If so it teleports the player to the house. if not, it just says they own the house.



I don't know if that's what you want, but it certainly doesn't match the command. It would be fine if the command was "!teleportMeHome" :)

So ... if you just want to buy a house, I think you have the wrong script. In case you don't have the TFS 1.0 original, here it is:

PHP:
function onSay(cid, words, param)
   local housePrice = configManager.getNumber(configKeys.HOUSE_PRICE)
   if housePrice == -1 then
     return true
   end

   local player = Player(cid)
   if player:getPremiumDays() <= 0 then
     player:sendCancelMessage("You need a premium account.")
     return false
   end

   local position = player:getPosition()
   position:getNextPosition(player:getDirection())

   local house = House(getTileHouseInfo(position))
   if house == nil then
     player:sendCancelMessage("You have to be looking at the door of the house you would like to buy.")
     return false
   end

   if house:getOwnerGuid() > 0 then
     player:sendCancelMessage("This house already has an owner.")
     return false
   end

   if player:getHouse() then
     player:sendCancelMessage("You are already the owner of a house.")
     return false
   end

   local price = house:getTileCount() * housePrice
   if not player:removeMoney(price) then
     player:sendCancelMessage("You do not have enough money.")
     return false
   end

   house:setOwnerGuid(player:getGuid())
   player:sendTextMessage(MESSAGE_INFO_DESCR, "You have successfully bought this house, be sure to have the money for the rent in the bank.")
   return false
end

As you can see, it's nothing like yours, and it doesn't exit if you don't say anything after "!buyhouse"

BTW - this is why I wanted all that information. I thought there must be another script between the XML and you buyhouse.lua that was able to handle the purchase process, and knew how to use the method signature in your buyhouse.lua.
 
I have the code for TFS 1.0, and my buyhouse.lua looks very different to yours.


The immediate issue you have is this code at the start of buyhouse:
Code:
function onSay(cid, words, param, channel)
   if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return true
end

--  more lua code after this ...

It tests if "param" (from the method signature) is an empty string. if it is, it issues that message, and exists the script.

Of course we've only explained the symptom, not the problem, but it's a start :)

If you had provided a valid parameter (I suppose this is some words after !buyhouse, but I don't actually know for sure)
this code would be executed:
Code:
local t = string.explode(param, ",")
if(t[2]) then
      teleport = getBooleanFromString(t[2])
end
It wants param to contain a string with a "," in it. It instects the part after the "," and if it finds anything other than "false" (or maybe one other special value) it will set flag "teleport" to "true".

Then it checks if the player owns a house, and if they're cool enough to be allowed to teleport. If so it teleports the player to the house. if not, it just says they own the house.



I don't know if that's what you want, but it certainly doesn't match the command. It would be fine if the command was "!teleportMeHome" :)

So ... if you just want to buy a house, I think you have the wrong script. In case you don't have the TFS 1.0 original, here it is:

PHP:
function onSay(cid, words, param)
   local housePrice = configManager.getNumber(configKeys.HOUSE_PRICE)
   if housePrice == -1 then
     return true
   end

   local player = Player(cid)
   if player:getPremiumDays() <= 0 then
     player:sendCancelMessage("You need a premium account.")
     return false
   end

   local position = player:getPosition()
   position:getNextPosition(player:getDirection())

   local house = House(getTileHouseInfo(position))
   if house == nil then
     player:sendCancelMessage("You have to be looking at the door of the house you would like to buy.")
     return false
   end

   if house:getOwnerGuid() > 0 then
     player:sendCancelMessage("This house already has an owner.")
     return false
   end

   if player:getHouse() then
     player:sendCancelMessage("You are already the owner of a house.")
     return false
   end

   local price = house:getTileCount() * housePrice
   if not player:removeMoney(price) then
     player:sendCancelMessage("You do not have enough money.")
     return false
   end

   house:setOwnerGuid(player:getGuid())
   player:sendTextMessage(MESSAGE_INFO_DESCR, "You have successfully bought this house, be sure to have the money for the rent in the bank.")
   return false
end

As you can see, it's nothing like yours, and it doesn't exit if you don't say anything after "!buyhouse"

BTW - this is why I wanted all that information. I thought there must be another script between the XML and you buyhouse.lua that was able to handle the purchase process, and knew how to use the method signature in your buyhouse.lua.

I got this errorupload_2014-3-29_15-38-30.pngwhen I used the code for TFS 1.0.
 
That message is surprising.

The script executed ok for a while. It's found the player, and done some meaningful operations against the Player object, and it's also done some operations using the House object.

Then it gets to here:
PHP:
if player:getHouse() then
player:sendCancelMessage("You are already the owner of a house.")
return false
end
and it can't find that function "getHouse()" anywhere. That block of code I included just checks to see of the player already owns a house (I suppose you're only allowed one at a time). AFAIK that message says - I can't find a "getHouse()" function for object Player in the Lua code for object Player.

Unfortunately I run out of knowledge here: AFAIK I haven't found all the definitions for Lua object Player in the Lua code yet.

OTOH: If you can find out where all the Lua definitions for Player are (it has to be ALL of them), and how that code is executed on startup, I might be able take a few more steps forward.

... and FWIW: There's C++ code in the House object that's able to check if a specific playerId owns a house. This suggests there's a small Lua function that takes Player.getHouse() and calls House* Houses::getHouseByPlayerId(uint32_t playerId).
It might be worth scanning all of your TFS Lua code with Notepad++ multi-file Find looking for "getHouseByPlayerId()".
 
Back
Top