Jump to content

[RESOLVIDO] Ajuda com gatescript


Recommended Posts

Estou com esse gatescript ( script de portão ) so que queria trocar addComandHandler por BindKey ja tentei de varias formas mais não consegui alguem poderia mim ajudar ?

function createTheGate () 
  
         myGate1 = createObject ( 10184, 322.79998779297, -1189.0999755859, 78.199996948242, 0, 0, 310 ) 
  
  
      end 
  
      addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) 
  
  
  
  
  
function openMyGate ( player ) 
     local accName = getAccountName ( getPlayerAccount ( player ) ) 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
 moveObject ( myGate1, 2500, 322.79998779297, -1189.0999755859, 83.199996948242 ) 
    end 
 end 
 addCommandHandler("stronger1",openMyGate) 
  
  
function movingMyGateBack ( player ) 
     local accName = getAccountName ( getPlayerAccount ( player ) ) 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
 moveObject ( myGate1, 2500, 322.79998779297, -1189.0999755859, 78.199996948242 ) 
    end 
 end 
 addCommandHandler("stronger2",movingMyGateBack) 

Edited by Guest
Link to comment
bindKey ( JOGADOR_AQUI, BOTAO, "down", openMyGate ) 

Você terá que fazer isso (↑) com todos os jogadores (substituindo JOGADOR_AQUI pela variável do player e BOTAO pelo botão desejado) quando o script iniciar e também quando um jogador entrar no servidor (pois ele não terá a key bindada, sendo necessario usar a função novamente ).

Veja os exemplos da wiki, deve lhe ajudar :P

Link to comment

Tentei ja varios tipos so que não conseguir

function createTheGate () 
  
         myGate1 = createObject ( 10184, 322.79998779297, -1189.0999755859, 78.199996948242, 0, 0, 310 ) 
  
  
      end 
  
      addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) 
  
  
  
  
  
function openMyGate ( player ) 
     local accName = getAccountName ( getPlayerAccount ( player ) ) 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
 moveObject ( myGate1, 2500, 322.79998779297, -1189.0999755859, 83.199996948242 ) 
    end 
 end 
  
  
 addEventHandler( "onResourceStart", resourceRoot, 
    function () 
        for _,player in ipairs(getElementsByType"player") do 
            bindKey(player, "2", "down", openMyGate) 
            bindKey(player, "3", "down", movingMyGateBack) 
        end 
    end 
) 
  
addEventHandler( "onPlayerJoin", root, 
    function () 
        for _,player in ipairs(getElementsByType"player") do 
            bindKey(player, "2", "down", openMyGate) 
            bindKey(player, "3", "down", movingMyGateBack) 
        end 
    end 
) 
  
  
  
function movingMyGateBack ( player ) 
     local accName = getAccountName ( getPlayerAccount ( player ) ) 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
 moveObject ( myGate1, 2500, 322.79998779297, -1189.0999755859, 78.199996948242 ) 
    end 
 end 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...