tonynamoral 27 Postado Janeiro 6, 2013 Share Postado Janeiro 6, 2013 (editado) fala ai galera , eu tenho 1 script aqui , que está entrando em conflito com o outro. Error : [06/01/2013 21:20:41] [Error - CreatureScript Interface] [06/01/2013 21:20:41] data/creaturescripts/scripts/skillsids.lua:onTextEdit [06/01/2013 21:20:41] Description: [06/01/2013 21:20:41] data/creaturescripts/scripts/skillsids.lua:29: attempt to index local 'skillId' (a nil value) [06/01/2013 21:20:41] stack traceback: [06/01/2013 21:20:41] data/creaturescripts/scripts/skillsids.lua:29: in function <data/creaturescripts/scripts/skillsids.lua:15> Primeiro SCRIPT : Skillsids.lua 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] = {id = 0, count = 1, add = "none"}, -- Strenght [2404] = {id = 1, count = 3, add = "speed"}, -- Agility [2403] = {id = 2, count = 20, add = "health"}, -- Vitality [2402] = {id = 3, count = 15, add = "mana"}, -- Energy [2401] = {id = 4, count = 1, add = "none"}, -- Range [2405] = {id = 5, count = 1, add = "none"}, -- Defense } local maxSkills = 100 local skillId = skillTable[item.itemid] local guid = getPlayerGUID(cid) local points = getPlayerMagLevel(cid) local skill = getPlayerSkillLevel(cid, skillId.id) 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) if skillId.add == "none" then elseif skillId.add == "speed" then doChangeSpeed(cid, getCreatureSpeed(cid)+(value*skillId.count)) elseif skillId.add == "health" then setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+(value*skillId.count)) elseif skillId.add == "mana" then setCreatureMaxMana(cid, getCreatureMaxMana(cid)+(value*skillId.count)) end doPlayerSetSkill(guid, skillId.id, newValue) doPlayerSetMagic(guid, points - newValue + skill) return false end Eu gostaria que voces podessem me falar qual é o error e solucionar pra eu *--* Editado Janeiro 7, 2013 por tonynamoral Link para o comentário https://xtibia.com/forum/topic/203594-galera-me-ajuda-2-scripts-meus-estao-entrando-em-conflito/ Compartilhar em outros sites More sharing options...
0 MaXwEllDeN 89 Postado Janeiro 7, 2013 Share Postado Janeiro 7, 2013 Dá uma olhada no que eu fiz: local maxSkills = 100 local skillTable = { --[id do item] = id da skill, [2400] = {id = 0, count = 1, add = "none"}, -- Strenght [2404] = {id = 1, count = 3, add = "speed"}, -- Agility [2403] = {id = 2, count = 20, add = "health"}, -- Vitality [2402] = {id = 3, count = 15, add = "mana"}, -- Energy [2401] = {id = 4, count = 1, add = "none"}, -- Range [2405] = {id = 5, count = 1, add = "none"}, -- Defense } 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 skillId = skillTable[item.itemid] if not skillId then return true end local guid = getPlayerGUID(cid) local points = getPlayerMagLevel(cid) local skill = getPlayerSkillLevel(cid, skillId.id) 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) if skillId.add == "none" then return false elseif skillId.add == "speed" then doChangeSpeed(cid, getCreatureSpeed(cid)+(value*skillId.count)) elseif skillId.add == "health" then setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+(value*skillId.count)) elseif skillId.add == "mana" then setCreatureMaxMana(cid, getCreatureMaxMana(cid)+(value*skillId.count)) end doPlayerSetSkill(guid, skillId.id, newValue) doPlayerSetMagic(guid, points - newValue + skill) return false end Sugiro que você leia esse Tópico: Boas Práticas Para Programar Link para o comentário https://xtibia.com/forum/topic/203594-galera-me-ajuda-2-scripts-meus-estao-entrando-em-conflito/#findComment-1432777 Compartilhar em outros sites More sharing options...
0 tonynamoral 27 Postado Janeiro 7, 2013 Autor Share Postado Janeiro 7, 2013 Funfo , TY Link para o comentário https://xtibia.com/forum/topic/203594-galera-me-ajuda-2-scripts-meus-estao-entrando-em-conflito/#findComment-1432812 Compartilhar em outros sites More sharing options...
0 caotic 393 Postado Janeiro 7, 2013 Share Postado Janeiro 7, 2013 Tópico movido para a seção de dúvidas e pedidos resolvidos. Link para o comentário https://xtibia.com/forum/topic/203594-galera-me-ajuda-2-scripts-meus-estao-entrando-em-conflito/#findComment-1432879 Compartilhar em outros sites More sharing options...
Pergunta
tonynamoral 27
fala ai galera , eu tenho 1 script aqui , que está entrando em conflito com o outro.
Error :
Primeiro SCRIPT : Skillsids.lua
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] = {id = 0, count = 1, add = "none"}, -- Strenght
[2404] = {id = 1, count = 3, add = "speed"}, -- Agility
[2403] = {id = 2, count = 20, add = "health"}, -- Vitality
[2402] = {id = 3, count = 15, add = "mana"}, -- Energy
[2401] = {id = 4, count = 1, add = "none"}, -- Range
[2405] = {id = 5, count = 1, add = "none"}, -- Defense
}
local maxSkills = 100
local skillId = skillTable[item.itemid]
local guid = getPlayerGUID(cid)
local points = getPlayerMagLevel(cid)
local skill = getPlayerSkillLevel(cid, skillId.id)
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)
if skillId.add == "none" then
elseif skillId.add == "speed" then
doChangeSpeed(cid, getCreatureSpeed(cid)+(value*skillId.count))
elseif skillId.add == "health" then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+(value*skillId.count))
elseif skillId.add == "mana" then
setCreatureMaxMana(cid, getCreatureMaxMana(cid)+(value*skillId.count))
end
doPlayerSetSkill(guid, skillId.id, newValue)
doPlayerSetMagic(guid, points - newValue + skill)
return false
end
Eu gostaria que voces podessem me falar qual é o error e solucionar pra eu *--*
Editado por tonynamoralLink para o comentário
https://xtibia.com/forum/topic/203594-galera-me-ajuda-2-scripts-meus-estao-entrando-em-conflito/Compartilhar em outros sites
3 respostass a esta questão
Posts Recomendados