Ir para conteúdo

Featured Replies

Postado

Uma vez eu vi um sistema de trainer, que se tivesse um player dentro da sala de trainer e um outro player quisesse entrar nessa mesma sala, ao clicar na porta, ele recebe uma mensagem dizendo que a sala ja esta ocupada e ele não consegue entrar na sala. Alguém teria esse script disponível?

 

Abraços!

Postado
Spoiler

<action actionid="4211" script="trainroom.lua" />
<action actionid="4212" script="trainroom.lua" />
<action actionid="4213" script="trainroom.lua" />
<action actionid="4214" script="trainroom.lua" /> 

 

trainroom.lua

 

Spoiler

function onUse(cid, item, frompos, item2, topos)

-- <beginning> Training Room script by Alreth.
-- Version 1.0, last edited 2006-06-02 17:39

-- Beginning of editable Variabels
    aidNor = 4211 -- Action id for door where training room is north of door
    aidSou = 4212 -- Action id for door where training room is south of door
    aidWes = 4213 -- Action id for door where training room is west of door
    aidEas = 4214 -- Action id for door where training room is east of door
-- End of editable Variabels
   
    emptyRoom = true
    charPos = getPlayerPosition(cid)
   
    if (item.actionid == aidNor) then
        if (charPos.y < frompos.y) then
            othersidePos = {x=frompos.x, y=frompos.y+1, z=frompos.z}
        else
            othersidePos = {x=frompos.x, y=frompos.y-1, z=frompos.z, stackpos=253}
            things = getThingfromPos(othersidePos)
            if (things.itemid == 1) then
                if (getPlayerLevel(things.uid) > 0) then
                    emptyRoom = false
                end
            end
        end
       
    elseif (item.actionid == aidSou) then
        if (charPos.y > frompos.y) then
            othersidePos = {x=frompos.x, y=frompos.y-1, z=frompos.z}
        else
            othersidePos = {x=frompos.x, y=frompos.y+1, z=frompos.z, stackpos=253}
            things = getThingfromPos(othersidePos)
            if (things.itemid == 1) then
                if (getPlayerLevel(things.uid) > 0) then
                    emptyRoom = false
                end
            end
        end
       
    elseif (item.actionid == aidEas) then
        if (charPos.x > frompos.x) then
            othersidePos = {x=frompos.x-1, y=frompos.y, z=frompos.z}
        else
            othersidePos = {x=frompos.x+1, y=frompos.y, z=frompos.z, stackpos=253}
            things = getThingfromPos(othersidePos)
            if (things.itemid == 1) then
                if (getPlayerLevel(things.uid) > 0) then
                    emptyRoom = false
                end
            end
        end
       
    elseif (item.actionid == aidWes) then
        if (charPos.x < frompos.x) then
            othersidePos = {x=frompos.x+1, y=frompos.y, z=frompos.z}
        else
            othersidePos = {x=frompos.x-1, y=frompos.y, z=frompos.z, stackpos=253}
            things = getThingfromPos(othersidePos)
            if (things.itemid == 1) then
                if (getPlayerLevel(things.uid) > 0) then
                    emptyRoom = false
                end
            end
        end
       
    end
   
    if (emptyRoom == true) then
        doTeleportThing(cid, othersidePos)
        doSendMagicEffect(charPos, 2)
        doSendMagicEffect(frompos, 12)
        doSendMagicEffect(othersidePos, 10)
       
    else
        doPlayerSendTextMessage(cid, 22, "Esta sala ja esta ocupada.")
    end
-- <end> Training Room script by Alreth.

    return 1
end 

 

Postado
  • Autor
14 minutos atrás, Thunder Black disse:
  Ocultar conteúdo

<action actionid="4211" script="trainroom.lua" />
<action actionid="4212" script="trainroom.lua" />
<action actionid="4213" script="trainroom.lua" />
<action actionid="4214" script="trainroom.lua" /> 

 

trainroom.lua

 

  Ocultar conteúdo

function onUse(cid, item, frompos, item2, topos)

-- <beginning> Training Room script by Alreth.
-- Version 1.0, last edited 2006-06-02 17:39

-- Beginning of editable Variabels
    aidNor = 4211 -- Action id for door where training room is north of door
    aidSou = 4212 -- Action id for door where training room is south of door
    aidWes = 4213 -- Action id for door where training room is west of door
    aidEas = 4214 -- Action id for door where training room is east of door
-- End of editable Variabels
   
    emptyRoom = true
    charPos = getPlayerPosition(cid)
   
    if (item.actionid == aidNor) then
        if (charPos.y < frompos.y) then
            othersidePos = {x=frompos.x, y=frompos.y+1, z=frompos.z}
        else
            othersidePos = {x=frompos.x, y=frompos.y-1, z=frompos.z, stackpos=253}
            things = getThingfromPos(othersidePos)
            if (things.itemid == 1) then
                if (getPlayerLevel(things.uid) > 0) then
                    emptyRoom = false
                end
            end
        end
       
    elseif (item.actionid == aidSou) then
        if (charPos.y > frompos.y) then
            othersidePos = {x=frompos.x, y=frompos.y-1, z=frompos.z}
        else
            othersidePos = {x=frompos.x, y=frompos.y+1, z=frompos.z, stackpos=253}
            things = getThingfromPos(othersidePos)
            if (things.itemid == 1) then
                if (getPlayerLevel(things.uid) > 0) then
                    emptyRoom = false
                end
            end
        end
       
    elseif (item.actionid == aidEas) then
        if (charPos.x > frompos.x) then
            othersidePos = {x=frompos.x-1, y=frompos.y, z=frompos.z}
        else
            othersidePos = {x=frompos.x+1, y=frompos.y, z=frompos.z, stackpos=253}
            things = getThingfromPos(othersidePos)
            if (things.itemid == 1) then
                if (getPlayerLevel(things.uid) > 0) then
                    emptyRoom = false
                end
            end
        end
       
    elseif (item.actionid == aidWes) then
        if (charPos.x < frompos.x) then
            othersidePos = {x=frompos.x+1, y=frompos.y, z=frompos.z}
        else
            othersidePos = {x=frompos.x-1, y=frompos.y, z=frompos.z, stackpos=253}
            things = getThingfromPos(othersidePos)
            if (things.itemid == 1) then
                if (getPlayerLevel(things.uid) > 0) then
                    emptyRoom = false
                end
            end
        end
       
    end
   
    if (emptyRoom == true) then
        doTeleportThing(cid, othersidePos)
        doSendMagicEffect(charPos, 2)
        doSendMagicEffect(frompos, 12)
        doSendMagicEffect(othersidePos, 10)
       
    else
        doPlayerSendTextMessage(cid, 22, "Esta sala ja esta ocupada.")
    end
-- <end> Training Room script by Alreth.

    return 1
end 

 

Funcionou perfeitamente!

 

Muito obrigado

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo