74

Storage Dos Points

Por 7401131, 16 de jun. de 2011 em Scripts

otserv
tibia
script
17
2.6k
20 de junho de 2011 às 12:47
Agora sim ele esta funcionando corretamente, aa se eu quiser pois mais que esses itens e so eu continuar a tabela neeh?

 

Sim.

 

E no caso eu quero por no script para aparecer o nome do player que compro item no look como ficaria?

 

local items = {
["boots of haste"] = {id = 2525, count = 1, points = 20},
["dwarven shield"] = {id = 2525, count = 1, points = 1}
}
-- ["nome do item"] = {id = id do item, count = quantidade que vai comprar, points = preço.}


function onSay(cid, words, param)
if not param or param == "" then
return doPlayerSendTextMessage(cid, 27, "You have "..getPoints(cid).." points.")
end

local tab = items[param]
if tab then
if getPoints(cid) >= tab.points then
doItemSetAttribute(doPlayerAddItem(cid, tab.id, tab.count),"description","Esse item for obtido por "..getPlayerName(cid)..".")
doPlayerSendTextMessage(cid, 27, "You buy "..tab.count.." "..getItemNameById(tab.id).." for "..tab.points.." points, will now remain "..getPoints(cid).." points.")
doPlayerSendTextMessage(cid, 27, "You will be kicked in 5 seconds.")
addEvent(addPoints, 5000, cid, -tab.points)
end
end
return true
end

function getPoints(cid)
return tonumber(db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. ";"):getDataString("premium_points"))
end

function addPoints(cid, points)

local acc = getPlayerAccountId(cid)
local pp = getPoints(cid)

if isCreature(cid) then
doRemoveCreature(cid)
end

db.executeQuery("UPDATE `accounts` SET `premium_points` = ".. pp + points .." WHERE `id` = " .. acc .. ";")
end

 

Já arrumei o errinho do tab nesse script. Tava com erro porque não fui eu quem fez o script.

 

Até.

74011317
20 de junho de 2011 às 14:08

Vlw cara deu certinho. vo dar seu rep++....

VOCE PODERIA ME AJUDAR NESSES SCRIPTS?

http://www.xtibia.com/forum/topic/158634-comando-voc/page__p__1046113#entry1046113

 

http://www.xtibia.com/forum/topic/158629-matar-monster-abrir-porta/page__p__1046094#entry1046094