marcelao777
New Member
- Joined
- Sep 9, 2011
- Messages
- 81
- Reaction score
- 0
My script buyskill removes the item the 9971 from bp but not add the skill, i use tfs 0.2.11pl2 mystic spirit client 9.1
my buyskill.lua
help
my buyskill.lua
function onSay(cid, words, param, channel)
local x = {
item = 9971, -- Item que vai ser removido
quantidade = 1, -- Quantidade vai ser removido
quantidadeskill = 1, -- Quantidade que o player irá comprar
limiteskill = 349 -- Se o limite for 350, faz 350-1(quantidade de skill) = 349
}
local xml = {
item = 9971, -- Item para poder comprar
quantidade = 3, -- Quantidade de item que vai gastar
quantidademl = 1, -- Quantidade que o player irá comprar
limitedeml = 199 -- Se o limite for 200, faz 200-1(quantidade de ml) = 199
}
local pid = getPlayerGUID(cid) -- Não mecha
local id = {
["skillclub"] = 1, -- Não mecha
["skillsword"]= 2, -- Não mecha
["skillaxe"] = 3, -- Não mecha
["skilldistance"] = 4, -- Não mecha
["skillshielding"] = 5 -- Não mecha
}
local voc = {
["skillclub"] = {4, 8, 9, 10}, -- Vocações que irá comprar club
["skillsword"] = {4, 8}, -- Vocações que irá comprar sword
["skillaxe"] = {4, 8}, -- Vocações que irá comprar axe
["skilldistance"] = {3, 7}, -- Vocações que irá comprar distance
["skillshielding"] = {4, 8, 9, 10} -- Vocações que irá comprar shielding
}
local vocml = {1, 2, 11, 5, 6, 12} -- Vocações que irá comprar magic level
local pz = "sim"
if(pz == "sim") and (getTilePzInfo(getCreaturePosition(cid)) == false) then
doPlayerSendCancel(cid, "Você precisa estar em protection zone pra poder comprar.")
return true
end
if (param == '') then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Como usar: !comprar skillclub.")
return true
end
if (param == 'magiclevel') then
if getPlayerMagLevel(cid) <= xml.limitedeml then
if isInArray(vocml, getPlayerVocation(cid)) == true then
if doPlayerRemoveItem(cid, xml.item, xml.quantidade) then
doRemoveCreature(cid, true)
db.executeQuery("UPDATE `players` SET `maglevel` = `maglevel` + ".. xml.quantidademl .." WHERE `id` = ".. pid .. "")
else
doPlayerSendCancel(cid, "Você não tem 3 Barras de ouro.")
end
else
doPlayerSendCancel(cid, "Voce não pode comprar magic level.")
end
else
doPlayerSendCancel(cid, "Você chegou no limite de magic level.")
end
return true
end
if(id[param:lower()]) then
if(getPlayerSkill(cid, id[param:lower()]) <= x.limiteskill) then
if isInArray(voc[param:lower()], getPlayerVocation(cid)) == true then
if doPlayerRemoveItem(cid, x.item, x.quantidade) then
doRemoveCreature(cid, true)
db.executeQuery("UPDATE `player_skills` SET `value` = `value` + ".. x.quantidadeskill .." WHERE `player_id` = ".. pid .. " and `skillid` = ".. id[param:lower()] ..";")
else
doPlayerSendCancel(cid, "Você não tem 1 Barra de ouro.")
end
else
doPlayerSendCancel(cid, "Voce não pode comprar este skill.")
end
else
doPlayerSendCancel(cid, "Você chegou no limite de skill.")
end
else
doPlayerSendCancel(cid, "Skill desconhecida.")
end
return true
end
help