Arrumei o bug pra você e dei uma arrumada no 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 maxSkills = 100
local skillId = skillTable[item.itemid]
local guid = getPlayerGUID(cid)
local points = getPlayerMagLevel(cid)
local skill = getPlayerSkillLevel(cid, skillId)
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
elseif getPlayerPz(cid) then
doPlayerSendCancel(cid, "Você não pode estar em PZ.") return false
elseif points < value then
doPlayerSendCancel(cid, "Você não tem points suficientes.") return false
elseif 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
Sobre as adições, explique um pouco melhor, não entendi o que você quer, ao certo.




info
Grupo: Visconde
Registrado: 21/09/10
Posts: 319
Reputação: +27
Char no Tibia: lest sarif
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 endO 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.