Jump to content

Acesso a NPC's com Medal!

Rate this topic


Recommended Posts

Olá, esse script foi eu quem desenvolvi, então por favor, dicas podem me dizer... mas funcional eu sei que está. Testando em TFS 0.4 e OTX.

Básicamente, esse sistema funciona assim, você utiliza essa medal no lugar no colar, e te deixa passar pela porta, caso contrário, você não consegue passar, pode ser usado para vender no shop, e dentro desse local acessado com a medal os npcs comprarem os items mais caros apenas que os outros não compram... ai fica a critério de vocês hahaha

Action\scripts

function onUse(cid, item, toPos)

configdoor1 = {
       [1] = {x=951,y=1170,z=6},
       [2] = {x=953,y=1170,z=6}
}
configdoor2 = {
       [1] = {x=960,y=1174,z=6},
       [2] = {x=958,y=1174,z=6}
}
configdoor3 = {
       [1] = {x=962,y=1168,z=6},
       [2] = {x=960,y=1168,z=6}
}

if item.uid == 34345 then
    if getPlayerStorageValue(cid, 5785) ~= 1 and item.uid == 34345 then
       doPlayerSendTextMessage(cid,25,'Você precisa equipar sua Medal of Honour primeiro!')
       doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
       return false
       end 
       if getPlayerStorageValue(cid, 57851)==1 and item.uid == 34345 then
         doTeleportThing(cid, configdoor1[2])
         doPlayerSendTextMessage(cid,25,'Até breve, Não perca sua Medal of Honour!')
         doSendMagicEffect(getPlayerPosition(cid), 10)
         setPlayerStorageValue(cid, 57851, 0)
         return true
         end
       if getPlayerStorageValue(cid, 5785) == 1 and item.uid == 34345 then
       doPlayerSendTextMessage(cid,25,'Bem vindo ao Shop VIP!')
       doTeleportThing(cid, configdoor1[1])
       doSendMagicEffect(getPlayerPosition(cid), 10)
       setPlayerStorageValue(cid, 57851, 1)
       return true
       end 
end

if item.uid == 34346 then

if getPlayerStorageValue(cid, 5785) ~= 1 and item.uid == 34346 then
       doPlayerSendTextMessage(cid,25,'Você precisa equipar sua Medal of Honour primeiro!')
       doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
       return false
       end 
       if getPlayerStorageValue(cid, 57852)==1 and item.uid == 34346 then
         doTeleportThing(cid, configdoor2[2])
         doPlayerSendTextMessage(cid,25,'Até breve, Não perca sua Medal of Honour!')
         doSendMagicEffect(getPlayerPosition(cid), 10)
         setPlayerStorageValue(cid, 57852, 0)
         return true
         end
       if getPlayerStorageValue(cid, 5785) == 1 and item.uid == 34346 then
       doPlayerSendTextMessage(cid,25,'Bem vindo ao Shop VIP!')
       doTeleportThing(cid, configdoor2[1])
       doSendMagicEffect(getPlayerPosition(cid), 10)
       setPlayerStorageValue(cid, 57852, 1)
       return true
       end  
end


if item.uid == 34347 then
if getPlayerStorageValue(cid, 5785) ~= 1 and item.uid == 34347 then
       doPlayerSendTextMessage(cid,25,'Você precisa equipar sua Medal of Honour primeiro!')
       doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
       return false
       end 
       if getPlayerStorageValue(cid, 57853)==1 and item.uid == 34347 then
         doTeleportThing(cid, configdoor3[2])
         doPlayerSendTextMessage(cid,25,'Até breve, Não perca sua Medal of Honour!')
         doSendMagicEffect(getPlayerPosition(cid), 10)
         setPlayerStorageValue(cid, 57853, 0)
         return true
         end
       if getPlayerStorageValue(cid, 5785) == 1 and item.uid == 34347 then
       doPlayerSendTextMessage(cid,25,'Bem vindo ao Shop VIP!')
       doTeleportThing(cid, configdoor3[1])
       doSendMagicEffect(getPlayerPosition(cid), 10)
       setPlayerStorageValue(cid, 57853, 1)
       return true
       end
end   
    return true
end

POS[1] = local na frente da porta, (entrada)

POS[2] = local na frente da porta, (saida)

 

Movements\scripts

function onEquip(cid, item, slot, boolean)
	
	if getPlayerSlotItem(cid, 2).itemid == 5785 and getPlayerStorageValue(cid, 5785) ~= 1 then
	   setPlayerStorageValue(cid, 5785, 1)
	   doPlayerSendTextMessage(cid,25,'Medal of Honour equipada! agora você pode acessar a área do Shop VIP.')
       doSendMagicEffect(getPlayerPosition(cid), 28)
     end
	return true
end
                
function onDeEquip(cid, item, slot, boolean)
configdoor1 = {
       [1] = {x=951,y=1170,z=6},
       [2] = {x=953,y=1170,z=6}
}
configdoor2 = {
       [1] = {x=960,y=1174,z=6},
       [2] = {x=958,y=1174,z=6}
}
configdoor3 = {
       [1] = {x=962,y=1168,z=6},
       [2] = {x=960,y=1168,z=6}
}
    if getPlayerSlotItem(cid, 2).itemid ~= 5785 and getPlayerStorageValue(cid, 5785) == 1 and getPlayerStorageValue(cid, 57851)==1 then
       setPlayerStorageValue(cid, 5785, -1) 
       setPlayerStorageValue(cid, 57851, 0)   
       doPlayerSendTextMessage(cid,25,'Medal of Honour retirada! Expulso do Shop.')
       doTeleportThing(cid,configdoor1[2])
       doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)  
       return true
       else if getPlayerSlotItem(cid, 2).itemid ~= 5785 and getPlayerStorageValue(cid, 5785) == 1 and getPlayerStorageValue(cid, 57852)==1 then
            setPlayerStorageValue(cid, 5785, -1) 
            setPlayerStorageValue(cid, 57852, 0)   
            doPlayerSendTextMessage(cid,25,'Medal of Honour retirada! Expulso do Shop.')
            doTeleportThing(cid,configdoor2[2])
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)  
            return true
            else if  getPlayerSlotItem(cid, 2).itemid ~= 5785 and getPlayerStorageValue(cid, 5785) == 1 and getPlayerStorageValue(cid, 57853)==1 then
                 setPlayerStorageValue(cid, 5785, -1) 
                 setPlayerStorageValue(cid, 57853, 0)   
                 doPlayerSendTextMessage(cid,25,'Medal of Honour retirada! Expulso do Shop.')
                 doTeleportThing(cid,configdoor3[2])
                 doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)  
                 return true
                 end
            end
       end
    return true
end

Mesma configuração.

 

As linhas de action e movements .xml fica por conta de vocês!

 

Abrs,

Link to comment
https://xtibia.com/forum/topic/235094-acesso-a-npcs-com-medal/
Share on other sites

×
×
  • Create New...