Ir para conteúdo

[TFS 0.4/0.3.6] Aviso de bless ao sair da zona de proteção.


Mudrock

Posts Recomendados

.Informações

Versão testada: 8.60
TFS: 0.4 / 0.3.6
Função: Ao sair de uma zona de proteção, caso o player esteja sem bless, ele manda uma mensagem na tela avisando que está sem bless.

.Em "Data/creaturescripts/scripts", copie e cole um arquivo.LUA e renomeie para checkBless.lua, apague tudo e cole:

function onThink(cid, lastExecution, thinkInterval)
    if(getTilePzInfo(getCreaturePosition(cid))) == false and getPlayerStorageValue(cid, 23333) <= 0 then
       for b = 1,5 do
           if getPlayerBlessing(cid, b) == false then
	      setPlayerStorageValue(cid, 23333, 1)
	      return doPlayerSendTextMessage(cid, 22, "Você não tem todas as bless, tome cuidado.")
           end
        end
    elseif (getTilePzInfo(getCreaturePosition(cid))) == true and getPlayerStorageValue(cid, 23333) == 1 then
	setPlayerStorageValue(cid, 23333, -1)
    end
   return true
end

.Em "Data/creaturescripts", abra o creaturescripts.xml e adicione:

<event type="think" name="checkBless" event="script" value="checkBless.lua"/>

.Novamente em "Data/creaturescripts/scripts", abra o arquivo login.lua e adicione:

registerCreatureEvent(cid, "checkBless")

Créditos: ScythePanthom and wakon

Link para o comentário
Compartilhar em outros sites

  • 1 year later...

@mudrock Boa tarde mano , sera que teria como por um intervalo nesse seu script? tipo de 30 segundos , para que o player nao fique entrando e saindo da area de proteçao e fique toda hora aparecendo a mensagem? vlw desde de ja =):.

Link para o comentário
Compartilhar em outros sites

  <globalevent name="Bless" interval="30000" script="bless.lua"/>


function onThink(interval, lastExecution)
local players = {}
for _, cid in pairs(getPlayersOnline()) do
if getPlayerBlessing(cid, 1) and getPlayerBlessing(cid, 2) and getPlayerBlessing(cid, 3) and getPlayerBlessing(cid, 4) and getPlayerBlessing(cid, 5) then
table.insert(players, cid)
elseif (getTilePzInfo(getCreaturePosition(cid))) == false then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"VOCE NAO TEM BLESS CUIDADO.")
end
end
return TRUE
end 

 

tente assim por globalevents e mais pratico.

 

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...