Fala ai galera , eu gostaria de fazer uma modificaçao no script aqui
Script :
local function doPlayerSetSkill(pid, skill, amount)
local player = getPlayerByGUID(pid)
if isCreature(player) then doRemoveCreature(player, true) end
db.executeQuery("UPDATE `player_skills` SET `value` = ".. amount .." WHERE `player_id` = ".. pid .. " and `skillid` = ".. skill ..";")
return true
end
local function doPlayerSetMagic(pid, amount)
local player = getPlayerByGUID(pid)
if isCreature(player) then doRemoveCreature(player, true) end
db.executeQuery("UPDATE `players` SET `maglevel` = " .. amount .. " WHERE `id` = "..pid)
return true
end
function onTextEdit(cid, item, newText)
local skillTable = {
--[id do item] = id da skill,
[2400] = 0, -- Strenght
[2404] = 1, -- Agility
[2403] = 2, -- Vitality
[2402] = 3, -- Energy
[2401] = 4, -- Range
[2405] = 5, -- Defense
}
local maxSk ills = 100
local skillId = skillTable[item.itemid]
if not skillId then return true end
local value = tonumber(newText)
if not value or value < 0 then
doPlayerSendCancel(cid, "Por favor, insira um número válido.")
return false
end
if getPlayerPz(cid) then
doPlayerSendCancel(cid,"Voce nao pode estar de PZ")
return true
end
local guid = getPlayerGUID(cid)
local points = getPlayerMagLevel(cid)
local skill = getPlayerSkillLevel(cid, skillId)
if points < value then
doPlayerSendCancel(cid, "Você não tem points suficientes.")
return false
end
if skill >= maxSkills then
doPlayerSendCancel(cid, "Sua skill já está no máximo.")
return false
end
local newValue = math.min(skill + value, maxSkills)
doPlayerSetSkill(guid, skillId, newValue)
doPlayerSetMagic(guid, points - newValue + skill)
return false
end
O que eu quero mudar é o seguinte , se adicionar VITALITY : almenta 20 de LIFE
se mudar ENERGY , almenta 15 de mana , e se mudar AGILITY , almenta 3 de speed
e tipo , está dando esse error aqui.
[06/01/2013 12:53:45] [Error - CreatureScript Interface]
[06/01/2013 12:53:45] data/creaturescripts/scripts/skillsids.lua:onTextEdit
[06/01/2013 12:53:45] Description:
[06/01/2013 12:53:45] data/creaturescripts/scripts/skillsids.lua:48: attempt to compare nil with number
[06/01/2013 12:53:45] stack traceback:
[06/01/2013 12:53:45] data/creaturescripts/scripts/skillsids.lua:48: in function <data/creaturescripts/scripts/skillsids.lua:13>
Pergunta
tonynamoral 27
Fala ai galera , eu gostaria de fazer uma modificaçao no script aqui
Script :
O que eu quero mudar é o seguinte , se adicionar VITALITY : almenta 20 de LIFE
se mudar ENERGY , almenta 15 de mana , e se mudar AGILITY , almenta 3 de speed
e tipo , está dando esse error aqui.
Link para o comentário
https://xtibia.com/forum/topic/203534-ser%C3%A1-que-tem-como-fazer-umas-adi%C3%A7oes-aqui-e-resolver-1-bug/Compartilhar em outros sites
7 respostass a esta questão
Posts Recomendados