LU
dúvida

Talkaction !promote

Por lucas502, 21 de jun. de 2012 em Scripts

otserv
tibia
script
3
1k
lucas502L
21 de junho de 2012 às 23:34

Olá galera blz?

 

Então, já usei a pesquisa do forum pra achar esse talkaction, encontrei alguns mas estes não me servem.

 

No meu server mysql, há uma coluna na tabela "players", chamada "Promotion", sendo que o valor 1 para promoted, e 0 para não promoted.

 

Ou seja, quando o comando !promote for digitado, eu quero que ao invés de trocar o valor na coluna "vocation" (como é o de todos os scripts), mudar o valor da coluna "promotion".

 

 

Não sei por que mas esse server não é setado o ID da vocação em "VOCATION" na tabela, e sim em "Promotion" (pra definir se é promovido ou não)

 

 

Atualmente meu script eh esse:

-- [( Script created by Doidin and MatheusMkalo for XTibia.com )] -- 
function onSay(cid, words, param, channel) 

local config = { 
[1] = {level = 20, valor = 20000}, 
[2] = {level = 20, valor = 20000}, 
[3] = {level = 20, valor = 20000}, 
[4] = {level = 20, valor = 20000}, 
vipsconfig = {onlyvips = "no", storagevip = 13540}, -- Apenas players vips "yes" ou "no" e o storage da vip. 
onlypremmy = "no" -- Apenas players premium accounts "yes" or "no". 
} 

if config.onlypremmy == "yes" and not isPremium(cid) then 
return doPlayerSendTextMessage(cid, 23, "Sorry, only premium players.") 
end 
if config.vipsconfig.onlyvips == "yes" and getPlayerStorageValue(cid, config.vipsconfig.storagevip) - os.time() <= 0 then 
return doPlayerSendTextMessage(cid, 23, "Sorry, only vips players.") 
end 
if config[getPlayerVocation(cid)] then 
if getPlayerLevel(cid) >= config[getPlayerVocation(cid)].level then 
if doPlayerRemoveMoney(cid, config[getPlayerVocation(cid)].valor) then 
setPlayerPromotionLevel(cid, 1) 
doPlayerSendTextMessage(cid, 22, "Congratulations, you have been successfully promoted!") 
doSendMagicEffect(cid, 14) 
else 
doPlayerSendTextMessage(cid, 23, "You need "..config[getPlayerVocation(cid)].valor.." gold coins to promote.") 
end 
else 
doPlayerSendTextMessage(cid, 23, "You need level "..config[getPlayerVocation(cid)].level.." to promote.") 
end 
else 
doPlayerSendTextMessage(cid, 23, "Sorry, you already promoted.") 
end 
return TRUE 
end

 

 

 

Mas ele vem causando muitos erros no distro, inclusive, em algumas ocasiões, alguns players trocam de vocação automaticamente de kina pra pally, e de sorc pra druid, ou mesmo até de sorc pra kina, e vice versa... (não sei pq desse erro... acho que é nessa script de promote que tá toda errada)

 

Aguardo soluções, obrigado!

Editado Junho 22 por Lucas502

LeoxtibiaL
22 de junho de 2012 às 08:35

Testa com essa minha e vê se funciona:

 

local table = {
[5] = {price = 10, minlevel = 100}, -- [vocação] -- preço da promotion (em crystal coins) e minimo de level para usar o comando
[6] = {price = 10, minlevel = 100},
[7] = {price = 10, minlevel = 100},
[8] = {price = 10, minlevel = 100}
}
local moeda = 2160 -- id da moeda (2160 é crystal coin)
function onSay(cid, words, param)
if table[getPlayerVocation(cid)] then
if getPlayerLevel(cid) >= table[getPlayerVocation(cid)].minlevel then
if doPlayerRemoveItem(cid, moeda, table[getPlayerVocation(cid)].price) == TRUE then
setPlayerPromotionLevel(cid, 1)
doSendMagicEffect(getCreaturePosition(cid),13)
doCreatureSay(cid, "Voce foi promovido!", TALKTYPE_ORANGE_1)
else
doPlayerSendTextMessage(cid, 24, "Você não tem ".. table[getPlayerVocation(cid)].price .." ".. getItemNameById(moeda) ..".")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
else
doPlayerSendTextMessage(cid, 24, "Você deve ter level ".. table[getPlayerVocation(cid)].minlevel .." ou mais para usar o comando.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
end
end

Editado Junho 22 por Leoxtibia

VildenV
22 de junho de 2012 às 13:52

Dúvida sanada, movido.