I made House Auction/Sell-Buy system in ACC maker. Its script from ym NPC:
How can I check is player online or not? If he is online NPC should change storage_id value in game. If he isnt online NPC should change storage_id value in database by SQL command.
2. How NPC can set guild ID/nick?
When i added code after "function onThink()" in my NPC:
and run TFS i see error:
What is wrong? Guild commands work fine on TFS 0.2.6?
Code:
function onThink()
dofile("./config.lua")
env = assert(luasql.mysql())
con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
cur = assert(con:execute("SELECT `cid`, `houseid` FROM `house_add_in_game`;"))
row = cur:fetch({}, "a")
while row do
housecid = row.cid
houseid = row.houseid
--if player online
--bank = getPlayerStorageValue(housecid,300)
--bank = bank - 1
--setPlayerStorageValue(housecid,300, bank)
--else
--tutaj ma zmieniac w bazie danych dane
--end
--if kase odjeto z konta
setHouseOwner(houseid, housecid)
assert(con:execute("DELETE FROM `house_add_in_game` WHERE `houseid` = '" .. houseid .. "' ;"))
assert(con:execute("UPDATE `houses` SET `owner` = '" .. housecid .. "' WHERE `id` = '" .. houseid .. "';"))
--if kase odjeto z konta END
row = cur:fetch (row, "a")
end
con:close()
env:close()
end
2. How NPC can set guild ID/nick?
When i added code after "function onThink()" in my NPC:
Code:
doPlayerSetGuildId("4", "1")
Code:
data/npc/sctripts/banko.lua:9: attempt to call global 'doPlayerSetGuildId' (a nil value)