CS

[Pedido] Sistema De Owner Para Equips (Só Para Items Vip)

Por cs007, 01 de abr. de 2012 em Scripts

otserv
tibia
11
1.9k
cs007C
01 de abril de 2012 às 17:57

Olá pessoal eu achei um sistema de owner para equipes do MatheusMkalo, tem como passar esse mod só para determinados items? valeu

 

Link

http://www.xtibia.com/forum/topic/158486-sistema-de-owner-para-equips/

BeekiB
01 de abril de 2012 às 19:41

esse sistema de owner do MatheusMkalo é praticamente uma função, ou seja você faz uma quest e poem essa função ela adicionar o Nome do Player no item, até

cs007C
02 de abril de 2012 às 20:35

Uhm =/ Não tem como dar uma modificada para quando receber o item do shop é só essa pessoa pode usar?

 

Ninguém sabe se pode fazer algum tipo de modificação? valeu

jhon992J
03 de abril de 2012 às 10:27

Uma dica que te dou é usar esse sisteminha:

http://www.xtibia.co...p-items-system/

Assim apenas vips poderão usar armas vips.

 

E me passa o teu globalevent que receber o item do site que eu tento adaptar com o script de owner.

Editado Abril 3 por Jhon992

cs007C
03 de abril de 2012 às 13:46

Não é só para VIPs usar as armas é sim somente que fez a doação.

=)

 

 

shop.lua

-- FIXED BY Cybermaster && Kekox © OTLand.net
-- ### 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 = 30
-- ### 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("param3"))
			    local itemtogive_count = tonumber(result_plr:getDataInt("param2"))
			    local container_id = tonumber(result_plr:getDataInt("param1"))
			    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(container_id, itemtogive_count)
					    if isItemRune(container_id) == TRUE then
					    full_weight = getItemWeightById(container_id, 1)
				    else
					    full_weight = getItemWeightById(container_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(container_id, itemtogive_count)
					    doItemSetAttribute(new_item, "description", "This item can only be used by the player ".. getPlayerName(cid) .."!")
					    doItemSetAttribute(new_item, "aid", getPlayerGUID(cid)+10000)
					    received_item = doPlayerAddItemEx(cid, new_item)
				    end
				    if received_item == RETURNVALUE_NOERROR then
					    doPlayerSave(cid, true)
					    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from 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 Prison Break 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 Spider 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

jhon992J
03 de abril de 2012 às 14:30

Primeiro implementa o sistema de owner do @Mateus.

Depois troca esse seu código por este:

-- FIXED BY Cybermaster && Kekox © OTLand.net
-- ### 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 = 30
-- ### 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("param3"))
							    local itemtogive_count = tonumber(result_plr:getDataInt("param2"))
							    local container_id = tonumber(result_plr:getDataInt("param1"))
							    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(container_id, itemtogive_count)
											    if isItemRune(container_id) == TRUE then
											    full_weight = getItemWeightById(container_id, 1)
									    else
											    full_weight = getItemWeightById(container_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(container_id, itemtogive_count)
											    received_item = doPlayerAddItemEx(cid, new_item)
									    end
									    if received_item == RETURNVALUE_NOERROR then
                                                   setItemOwner(received_item, cid)
											    doPlayerSave(cid, true)
											    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from 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 Prison Break 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 Spider 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
en

 

Fais um backup antes, pq eu não testei.

cs007C
04 de abril de 2012 às 13:25

Oks veio vou testar e hoje ainda dou a resposta se funcionou. valeu

cs007C
10 de abril de 2012 às 19:29

Veio nem funcionou e ainda ficou entregando o item varias vezes sem parar x,x te como arrumar? valeu =)

 

Ninguém?

 

Quando o item do shop chega ele da erro na lib mas não na linha que eu adicionei a função mas em outra linha e fica entregando o item varias vezes...aaaah até com quest ele da esse erro creio que o problema sejá na lib

Editado Abril 15 por cs007

2 semanas depois...
cs007C
22 de abril de 2012 às 20:23

Alguém ajuda? não e nada de mais para quem sabe de scripts;

jhon992J
23 de abril de 2012 às 09:53

Dei uma olhada novamente e ao meu ver era pra estar funcionando perfeitamente. Qual erro aparece no executavel do ot?

cs007C
26 de abril de 2012 às 03:00

Quando liga não da erro só da erro no aquivo 050-functions Só que o erro não foi na linha que fui adicionado a função(estou sem o ot para testar aqui) é ele ficou entregando o item varias vezes. vou ver se coloco o server no meu pc dinovo. valeu

 

Erro e nessa linha.

 

na function

 

return getItemDescriptions(uid).name

Editado Abril 26 por cs007