- Fórum
- OTServ
- Recursos
- Scripting
- Actions e Talkactions
- Donate Shop InGame V2.0
LU
action
Donate Shop InGame V2.0
Por LuckinhaSan, 06 de abr. de 2013 em Actions e Talkactions
shop
system
otserv
ingame
tibia
script
1
1.1k
Por LuckinhaSan, 06 de abr. de 2013 em Actions e Talkactions
info
Grupo: Conde
Registrado: 03/09/11
Posts: 703
Reputação: +191
Gênero: Masculino
Char no Tibia: Mirade
Olá, estava sendo trabalhado, um sistema de alavanca que permite que você compre donates no jogo com alavanca.
Leia o tópico antigo para obter informações sobre este script e como configurá-lo.
É o mesmo sistema, mas agora você pode escolher "true" ou "false", se você quer que custe premium points ou um item.
Update 2.0:
Aqui está o código -
local t = {
[1938] = {100,"arcane staff",2453},
[1939] = {100,"magic plate armor",2472},
}
local config = {
cost = 2160, --- Id do custo do item, se você usar o "true"
useitem = true, --- Se em false, então, vai custar premium points, se em treue, então use o "cost item"
amount = 10 --- Quanto ele vai custar, neste caso 10cc
}
function onUse(cid,item,fromPosition,itemEx,toPosition)
local v = t[item.uid]
local points = 0
local qry = db.getResult(string.format("SELECT premium_points FROM accounts WHERE id = %d", getPlayerAccountId(cid)))
if qry:getID() ~= -1 then
points = qry:getDataInt("premium_points")
qry:free()
end
if config.useitem == true then
if doPlayerRemoveItem(cid,config.cost,config.amount) then
doPlayerAddItem(cid,v[3])
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have buy a " .. v[2] .. " for "..config.amount.." "..getItemNameById(config.cost).."!")
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You need at least "..config.amount.." "..getItemNameById(config.cost).." to buy "..getItemNameById(v[3]).."!")
end
else
if points > v[1] then
doPlayerAddItem(cid,v[3])
db.executeQuery('UPDATE accounts SET premium_points=premium_points-'..v[1]..' WHERE id=' .. getPlayerAccountId(cid))
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have buy a " .. v[2] .. " for "..v[1].." points! Your current balance is "..getPremiumPoints(cid).." points!")
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You need at least "..v[1].." points to buy a "..v[2].."! Your current balance is "..getPremiumPoints(cid).." points! ")
end
end
if getPlayerFreeCap(cid) < (getItemWeightById(v[3])) then
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You need " .. getItemWeightById(v[3]) .. ".00 oz in order to get the item")
end
return true
end
function getPremiumPoints(cid)
local res = db.getResult('select `premium_points` from accounts where name = \''..getPlayerAccount(cid)..'\'')
if(res:getID() == -1) then
return 0
end
local ret = res:getDataInt("premium_points")
res:free()
return tonumber(ret)
end[/code]
Link Do Tópico Antigo - [Action] Shop System InGame
Créditos - _CorneX_