zm1q
New Member
- Joined
- Aug 13, 2011
- Messages
- 97
- Reaction score
- 0
Witam mam problem z tym skryptem, niby działa ale wyświetla błąd w konsoli.
-- by Xemorin --
local tbl = {
[1] = {pos= {x = 32351, y = 32228, z = 8, stackpos = 1}, prof = 'all', text2 = 'player'},
[2] = {pos= {x = 32357, y = 32228, z = 8, stackpos = 1}, prof = '1, 5', text2 = 'sorcerer'},
[3] = {pos= {x = 32359, y = 32228, z = 8, stackpos = 1}, prof = '2, 6', text2 = 'druid'},
[4] = {pos= {x = 32353, y = 32228, z = 8, stackpos = 1}, prof = '3, 7', text2 = 'paladin'},
[5] = {pos= {x = 32355, y = 32228, z = 8, stackpos = 1}, prof = '4, 8', text2 = 'knight'},
}
function onThink(interval)
local best, profe, kam = '', 0, 0
for index, options in ipairs(tbl) do
local kam = getThingFromPos(options.pos).uid
if(options.prof == 'all') then
best = db.getResult("SELECT `level`,`name` FROM `players` WHERE `group_id` < '2' AND `account_id` > '1' ORDER BY `experience` DESC LIMIT 1;")
if(best:getID() ~= -1) then
doItemSetAttribute(kam, 'description', 'Currently, the best '..options.text2..' is '..best:getDataString('name')..' ('..best:getDataInt('level')..' level)')
else
doItemSetAttribute(kam, 'description', 'Currently there are no characters')
end
doSendMagicEffect(options.pos, CONST_ME_FIREWORK_RED)
else
profe = string.explode(options.prof, ',')
best = db.getResult("SELECT `level`,`name` FROM `players` WHERE (`vocation` = '"..tonumber(profe[1]).."' OR `vocation` = '"..tonumber(profe[2]).."') AND `group_id` < '2' AND `account_id` > '1' ORDER BY `experience` DESC LIMIT 1;")
if(best:getID() ~= -1) then
doItemSetAttribute(kam, 'description', 'Currently, the best '..options.text2..' is '..best:getDataString('name')..' ('..best:getDataInt('level')..' level)')
else
doItemSetAttribute(kam, 'description', 'Currently, on a server doesn\'t play none '..options.text2)
end
doSendMagicEffect(options.pos, CONST_ME_FIREWORK_RED)
end
end
return true
end
[16:26:00.862] [Error - GlobalEvent Interface]
[16:26:00.862] data/globalevents/scripts/hof.lua
nThink
[16:26:00.862] Description:
[16:26:00.862] (luaGetThingFromPos) Tile not found
[16:26:00.862] [Error - GlobalEvent Interface]
[16:26:00.862] data/globalevents/scripts/hof.lua
nThink
[16:26:00.862] Description:
[16:26:00.862] (luaDoItemSetAttribute) Item not found
-- by Xemorin --
local tbl = {
[1] = {pos= {x = 32351, y = 32228, z = 8, stackpos = 1}, prof = 'all', text2 = 'player'},
[2] = {pos= {x = 32357, y = 32228, z = 8, stackpos = 1}, prof = '1, 5', text2 = 'sorcerer'},
[3] = {pos= {x = 32359, y = 32228, z = 8, stackpos = 1}, prof = '2, 6', text2 = 'druid'},
[4] = {pos= {x = 32353, y = 32228, z = 8, stackpos = 1}, prof = '3, 7', text2 = 'paladin'},
[5] = {pos= {x = 32355, y = 32228, z = 8, stackpos = 1}, prof = '4, 8', text2 = 'knight'},
}
function onThink(interval)
local best, profe, kam = '', 0, 0
for index, options in ipairs(tbl) do
local kam = getThingFromPos(options.pos).uid
if(options.prof == 'all') then
best = db.getResult("SELECT `level`,`name` FROM `players` WHERE `group_id` < '2' AND `account_id` > '1' ORDER BY `experience` DESC LIMIT 1;")
if(best:getID() ~= -1) then
doItemSetAttribute(kam, 'description', 'Currently, the best '..options.text2..' is '..best:getDataString('name')..' ('..best:getDataInt('level')..' level)')
else
doItemSetAttribute(kam, 'description', 'Currently there are no characters')
end
doSendMagicEffect(options.pos, CONST_ME_FIREWORK_RED)
else
profe = string.explode(options.prof, ',')
best = db.getResult("SELECT `level`,`name` FROM `players` WHERE (`vocation` = '"..tonumber(profe[1]).."' OR `vocation` = '"..tonumber(profe[2]).."') AND `group_id` < '2' AND `account_id` > '1' ORDER BY `experience` DESC LIMIT 1;")
if(best:getID() ~= -1) then
doItemSetAttribute(kam, 'description', 'Currently, the best '..options.text2..' is '..best:getDataString('name')..' ('..best:getDataInt('level')..' level)')
else
doItemSetAttribute(kam, 'description', 'Currently, on a server doesn\'t play none '..options.text2)
end
doSendMagicEffect(options.pos, CONST_ME_FIREWORK_RED)
end
end
return true
end
[16:26:00.862] [Error - GlobalEvent Interface]
[16:26:00.862] data/globalevents/scripts/hof.lua
[16:26:00.862] Description:
[16:26:00.862] (luaGetThingFromPos) Tile not found
[16:26:00.862] [Error - GlobalEvent Interface]
[16:26:00.862] data/globalevents/scripts/hof.lua
[16:26:00.862] Description:
[16:26:00.862] (luaDoItemSetAttribute) Item not found