KR

Item Que Dá Vip.

Por krudan, 09 de jul. de 2011 em Archived

script
8
933
krudanK
09 de julho de 2011 às 11:06

Olá pessoal.

 

Estou com um problema... queria um Item que quando nós usarmos ele sei lá algo assim, ele vai lhe dar VIP Days. Se alguem tiver ai, me ajuda.

 

 

Eu ja vi um cara dando esse script, mas não estou conseguindo achar. Vlw ai pela ajuda.

coyotestarkC
09 de julho de 2011 às 11:40

eu fiz isso no meu wodbo mas nao sei cmo é seu ot. mas eu fiz assim fui no NPC vip seller de meu ot w procurei o script de dar vip a part.

e deu certo tenta ae

meubkM
09 de julho de 2011 às 11:57

qual seu sistema de vip ?

krudanK
09 de julho de 2011 às 18:59

qual seu sistema de vip ?

 

Eu uso essa aki:

http://www.xtibia.com/forum/topic/151189-vip-system-by-mock-100/

 

Tbm esse pro item ir pra conta;

 

-- ### CONFIG ###

-- message send to player by script "type" (types you can check in "global.lua")

SHOP_MSG_TYPE = 19

-- time (in seconds) between connections to SQL database by shop script

SQL_interval = 15

-- ### END OF CONFIG ###

function onThink(interval, lastExecution)

local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'login';")

if(result_plr:getID() ~= -1) then

while(true) do

id = tonumber(result_plr:getDataInt("id"))

action = tostring(result_plr:getDataString("action"))

delete = tonumber(result_plr:getDataInt("delete_it"))

cid = getCreatureByName(tostring(result_plr:getDataString("name")))

if isPlayer(cid) == TRUE then

local itemtogive_id = tonumber(result_plr:getDataInt("param1"))

local itemtogive_count = tonumber(result_plr:getDataInt("param2"))

local container_id = tonumber(result_plr:getDataInt("param3"))

local container_count = tonumber(result_plr:getDataInt("param4"))

local add_item_type = tostring(result_plr:getDataString("param5"))

local add_item_name = tostring(result_plr:getDataString("param6"))

local received_item = 0

local full_weight = 0

if add_item_type == 'container' then

container_weight = getItemWeightById(container_id, 1)

if isItemRune(itemtogive_id) == TRUE then

items_weight = container_count * getItemWeightById(itemtogive_id, 1)

else

items_weight = container_count * getItemWeightById(itemtogive_id, itemtogive_count)

end

full_weight = items_weight + container_weight

else

full_weight = getItemWeightById(itemtogive_id, itemtogive_count)

if isItemRune(itemtogive_id) == TRUE then

full_weight = getItemWeightById(itemtogive_id, 1)

else

full_weight = getItemWeightById(itemtogive_id, itemtogive_count)

end

end

local free_cap = getPlayerFreeCap(cid)

if full_weight <= free_cap then

if add_item_type == 'container' then

local new_container = doCreateItemEx(container_id, 1)

local iter = 0

while iter ~= container_count do

doAddContainerItem(new_container, itemtogive_id, itemtogive_count)

iter = iter + 1

end

received_item = doPlayerAddItemEx(cid, new_container)

else

local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)

received_item = doPlayerAddItemEx(cid, new_item)

end

if received_item == RETURNVALUE_NOERROR then

doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')

db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")

db.executeQuery("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")

else

doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. Please make place for this item in your backpack/hands and wait about '.. SQL_interval ..' seconds to get it.')

end

else

doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. It weight is '.. full_weight ..' oz., you have only '.. free_cap ..' oz. free capacity. Put some items in depot and wait about '.. SQL_interval ..' seconds to get it.')

end

end

if not(result_plr:next()) then

break

end

end

result_plr:free()

end

return TRUE

end

 

 

Ajuda aki!

Editado Julho 9 por DawnOT

meubkM
10 de julho de 2011 às 10:58

é uma action, tag:

<action itemid="ID  DO ITEM" event="script" value="NOME DO ARQUIVO.lua"/>

 

na pasta scripts em um arquivo.lua :

 

function onUse(cid, item)
local days = 10 -- dias que vai ganhar usando o item
vip.addVipByAccount(getPlayerAccount(cid), days)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Foram adicionados "..days.." dias de vip a "..getCreatureName(cid)..".")
return true
end

Editado Julho 15 por xotservx

krudanK
10 de julho de 2011 às 18:33

Poh vlw :D

 

Mas se liga:

 

coci.png

 

actions.lua:

 

<action itemid="6501" event="script" value="7day.lua"/>

 

 

7day.lua:

 

function onUse(cid, item)

local days = 7 -- dias que vai ganhar usando o item

doPlayerAddVipDays(cid, days)

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Foram adicionados "..days.." dias de vip a "..getCreatureName(cid)..".")

return true

end

 

Editado Julho 14 por DawnOT

meubkM
15 de julho de 2011 às 08:10

testa o de cima , eu atualizei.

2 meses depois...
billstorckB
07 de setembro de 2011 às 03:02

Se a sua duvida nao foi sanada tente este:

Vá até data/actions/scripts/faça uma cópia qualquer e coloque o noem desejado.

function onUse(cid, words, param, channel)

if doPlayerRemoveItem(cid,6512,1) then

vip.addVipByAccount(getPlayerAccount(getPlayerByName(getPlayerName(cid))) ,vip.getDays(2))

doPlayerSendTextMessage(cid,25,"Você recebeu 2 dias de vip.")

end

return TRUE

end

Depois vá em data/actions/actions.xml e adicione a TAG:

<action itemid="6512" script="nomescript.lua"/>

Se você já resolveu o problema bom (y) mais tem várias pessoas que talvez estão precisando disso intao postei.

Para mudar os dias que você quer que o item entregue ao player mude nessa linha:

vip.addVipByAccount(getPlayerAccount(getPlayerByName(getPlayerName(cid))) ,vip.getDays(2))
De 2 para 10 por exemplo.

Editado Setembro 7 por Billstorck