Sanzenkai
Member
- Joined
- Aug 25, 2023
- Messages
- 31
- Reaction score
- 13
Hello, currently on my server I have a system that the player uses a scroll to change vocation for talkaction to avoid miss click on the item and things like that, and there were many players using this scroll on top of other vocations that gain less or more HP/MP per level and ended up with less HP/MP than they should (As an alternative, I put the parchment to be used only at LVL 1, but it generated some complaints), I would like to know if it is possible for someone to help me by reformulating this talkaction so that he checks the vocation in vocations.xml calculates the HP/MP that the player should have with that level and applies it to the character, I hope it's not too much to ask, thanks in advance.
LUA:
function onSay(cid,words,param,channel)
local t = {
["!asuma"] = {item = 11456, amount = 1, voc = 62, outfit = 312, msg = "Parabens voce virou um Asuma."},
["!boruto"] = {item = 829, amount = 1, voc = 52, outfit = 343, msg = "Parabens voce virou um Boruto."},
["!chino"] = {item = 11468, amount = 1, voc = 107, outfit = 353, msg = "Parabens voce virou uma Chino."}
}
if not t[words] then
doPlayerSendCancel(cid, "Desculpe, mas nao existe esta vocacao") return true
end
local var = t[words]
local sagastor = 578744
if getPlayerLevel(cid) > 1 then
doPlayerSendCancel(cid, "Desculpe, mas voce precisa ser level 1.") return true
end
if getPlayerVocation(cid) == var.voc then
doPlayerSendCancel(cid, "Desculpe, mas voce ja esta com esta vocacao") return true
elseif not doPlayerRemoveItem(cid, var.item,var.amount) then
doPlayerSendCancel(cid, "Desculpe, mas voce nao tem o pergaminho") return true
end
doPlayerSetVocation(cid,var.voc)
doCreatureChangeOutfit(cid, {lookType = var.outfit})
setPlayerStorageValue(cid, sagastor, ":"..var.outfit..",:"..getPlayerVocation(cid))
doPlayerSendTextMessage(cid, 22, var.msg)
return true
end