Jump to content

Como es?


Javier

Recommended Posts

Posted

Hola. Queria saber como puedo hacer para que cuando un player entra en una zona y si aprieta determinada tecla, le mande a ese player a una ubicacion determinada??

Gracias

Posted

Lo intenté así pero me dice bad argument en la linea 19.

Area = createColRectangle ( -2535.9562988281, 1498.9573974609, 300, 800 ) 
  
Radar = createRadarArea ( -2535.9562988281, 1498.9573974609, 300, 800, 255, 0, 0, 150 ) 
  
posX = 0 
posY = 0 
posZ = 0 
  
function Boat ( thePlayer, matchingDimension ) 
if (getElementType(thePlayer) == "player") then 
     outputChatBox( getPlayerName(thePlayer) .. "Estás en la Zona.Presiona F7 si queres entrar.", thePlayer, 0, 200, 0 ) 
      setElementPosition( thePlayer, posX, posY, posZ)   
    end 
end 
  
function StartKey() 
      addEventHandler ( "onColShapeHit", Area, Boat ) 
end 
bindKey(thePlayer,"F7","down", StartKey) 
  
function outBoat ( thePlayer, matchingDimension ) 
     if (getElementType(thePlayer) == "player") then 
          unbindKey(thePlayer,"F7","down", outBoat) 
    end 
end 
addEventHandler ( "onColShapeLeave", Area, outBoat ) 

Posted
'thePlayer' no esta definido, ademas de que no tiene sentido.

Porqué no tiene sentido? Me guié por el ejemplo de la wiki de dxDrawText...

Ademas esto no es definir thePlayer??

if (getElementType(thePlayer) == "player") then 

Posted

Perdona me guie por el Comentario de Castillo. Sabes todo esta en client-side no necesita definir thePlayer en el bindkey, Intenta esto:

Area = createColRectangle ( -2535.9562988281, 1498.9573974609, 300, 800 ) 
  
Radar = createRadarArea ( -2535.9562988281, 1498.9573974609, 300, 800, 255, 0, 0, 150 ) 
  
posX = 0 
posY = 0 
posZ = 0 
  
function Boat ( thePlayer, matchingDimension ) 
if (getElementType(thePlayer) == "player") then 
     outputChatBox( getPlayerName(thePlayer) .. "Estás en la Zona.Presiona F7 si queres entrar.", 0, 200, 0, false ) 
      setElementPosition( thePlayer, posX, posY, posZ)  
    end 
end 
  
function StartKey() 
      addEventHandler ( "onColShapeHit", Area, Boat ) 
end 
bindKey("F7","down", StartKey) 
  
function outBoat ( thePlayer, matchingDimension ) 
     if (getElementType(thePlayer) == "player") then 
          unbindKey("F7","down", startKey) 
    end 
end 
addEventHandler ( "onColShapeLeave", Area, outBoat ) 

Posted

Hm si, Tienes razón nunca me fijo de los eventos:

Area = createColRectangle ( -2535.9562988281, 1498.9573974609, 300, 800 ) 
  
Radar = createRadarArea ( -2535.9562988281, 1498.9573974609, 300, 800, 255, 0, 0, 150 ) 
  
posX = 0 
posY = 0 
posZ = 0 
  
function Boat ( thePlayer, matchingDimension ) 
if (getElementType(thePlayer) == "player") then 
     outputChatBox( getPlayerName(thePlayer) .. "Estás en la Zona.Presiona F7 si queres entrar.", thePlayer, 0, 200, 0, false ) 
      setElementPosition( thePlayer, posX, posY, posZ) 
    end 
end 
  
function StartKey() 
      addEventHandler ( "onColShapeHit", Area, Boat ) 
end 
bindKey(source, "F7","down", StartKey) 
  
function outBoat ( ) 
     if (getElementType(source) == "player") then 
          unbindKey(source, "F7","down", startKey) 
    end 
end 
addEventHandler ( "onColShapeLeave", Area, outBoat ) 

Posted
Hm si, Tienes razón nunca me fijo de los eventos:
Area = createColRectangle ( -2535.9562988281, 1498.9573974609, 300, 800 ) 
  
Radar = createRadarArea ( -2535.9562988281, 1498.9573974609, 300, 800, 255, 0, 0, 150 ) 
  
posX = 0 
posY = 0 
posZ = 0 
  
function Boat ( thePlayer, matchingDimension ) 
if (getElementType(thePlayer) == "player") then 
     outputChatBox( getPlayerName(thePlayer) .. "Estás en la Zona.Presiona F7 si queres entrar.", thePlayer, 0, 200, 0, false ) 
      setElementPosition( thePlayer, posX, posY, posZ) 
    end 
end 
  
function StartKey() 
      addEventHandler ( "onColShapeHit", Area, Boat ) 
end 
bindKey(source, "F7","down", StartKey) 
  
function outBoat ( ) 
     if (getElementType(source) == "player") then 
          unbindKey(source, "F7","down", startKey) 
    end 
end 
addEventHandler ( "onColShapeLeave", Area, outBoat ) 

No defines 'source'.

Posted
Area = createColRectangle ( -2535.9562988281, 1498.9573974609, 300, 800 ) 
  
Radar = createRadarArea ( -2535.9562988281, 1498.9573974609, 300, 800, 255, 0, 0, 150 ) 
  
posX = 0 
posY = 0 
posZ = 0 
  
function Boat ( thePlayer, matchingDimension ) 
if (getElementType(thePlayer) == "player") then 
     outputChatBox( getPlayerName(thePlayer) .. "Estás en la Zona.Presiona F7 si queres entrar.", thePlayer, 0, 200, 0, false ) 
      setElementPosition( thePlayer, posX, posY, posZ) 
    end 
end 
  
function StartKey(source) 
      addEventHandler ( "onColShapeHit", Area, Boat ) 
end 
bindKey(source, "F7","down", StartKey) 
  
function outBoat ( source ) 
     if (getElementType(source) == "player") then 
          unbindKey(source, "F7","down", startKey) 
    end 
end 
addEventHandler ( "onColShapeLeave", Area, outBoat ) 

Posted
Area = createColRectangle ( -2535.9562988281, 1498.9573974609, 300, 800 ) 
  
Radar = createRadarArea ( -2535.9562988281, 1498.9573974609, 300, 800, 255, 0, 0, 150 ) 
  
posX = 0 
posY = 0 
posZ = 0 
  
function Boat ( thePlayer, matchingDimension ) 
if (getElementType(thePlayer) == "player") then 
     outputChatBox( getPlayerName(thePlayer) .. "Estás en la Zona.Presiona F7 si queres entrar.", thePlayer, 0, 200, 0, false ) 
      setElementPosition( thePlayer, posX, posY, posZ) 
    end 
end 
  
function StartKey(source) 
      addEventHandler ( "onColShapeHit", Area, Boat ) 
end 
bindKey(source, "F7","down", StartKey) 
  
function outBoat ( source ) 
     if (getElementType(source) == "player") then 
          unbindKey(source, "F7","down", startKey) 
    end 
end 
addEventHandler ( "onColShapeLeave", Area, outBoat ) 

Sigue sin estar definido, 'bindKey' esta fuera de esa función.

Posted
Area = createColRectangle ( -2535.9562988281, 1498.9573974609, 300, 800 ) 
  
Radar = createRadarArea ( -2535.9562988281, 1498.9573974609, 300, 800, 255, 0, 0, 150 ) 
  
posX = 0 
posY = 0 
posZ = 0 
  
function Boat ( source ) 
bindKey(source, "F7","down", 
function(source, matchingDimension) 
if (getElementType(source) == "player") then 
     outputChatBox( getPlayerName(source) .. "Estás en la Zona.Presiona F7 si queres entrar.", source, 0, 200, 0, false ) 
      setElementPosition(source, posX, posY, posZ) 
end 
end) 
end 
addEventHandler ( "onColShapeHit", Area, Boat ) 
  
function outBoat ( source ) 
     if (getElementType(source) == "player") then 
          unbindKey(source, "F7","down", startKey) 
    end 
end 
addEventHandler ( "onColShapeLeave", Area, outBoat ) 

Posted
Area = createColRectangle ( -2535.9562988281, 1498.9573974609, 300, 800 ) 
  
Radar = createRadarArea ( -2535.9562988281, 1498.9573974609, 300, 800, 255, 0, 0, 150 ) 
  
posX = 0 
posY = 0 
posZ = 0 
  
function Boat ( source ) 
bindKey(source, "F7","down", 
function(source, matchingDimension) 
if (getElementType(source) == "player") then 
     outputChatBox( getPlayerName(source) .. "Estás en la Zona.Presiona F7 si queres entrar.", source, 0, 200, 0, false ) 
      setElementPosition(source, posX, posY, posZ) 
end 
end) 
end 
addEventHandler ( "onColShapeHit", Area, Boat ) 
  
function outBoat ( source ) 
     if (getElementType(source) == "player") then 
          unbindKey(source, "F7","down", startKey) 
    end 
end 
addEventHandler ( "onColShapeLeave", Area, outBoat ) 

No estoy seguro de que sea buena idea llamar al jugador igual que al colShape y eso hace que al salir la tecla no se desbindee ya que eliminaste la función 'startKey'.

Posted

A mi me funciona perfectamente, Solo que estaba mal el output, Bueno en difinitivo es:

Area = createColRectangle ( -2535.9562988281, 1498.9573974609, 300, 800 ) 
  
Radar = createRadarArea ( -2535.9562988281, 1498.9573974609, 300, 800, 255, 0, 0, 150 ) 
  
posX = 0 
posY = 0 
posZ = 0 
  
function Boat ( source ) 
bindKey(source, "F7","down", 
function(source, matchingDimension) 
if (getElementType(source) == "player") then 
      setElementPosition(source, posX, posY, posZ) 
end 
end) 
outputChatBox( getPlayerName(source) .. "Estás en la Zona.Presiona F7 si queres entrar.", source, 0, 200, 0, false ) 
end 
addEventHandler ( "onColShapeHit", Area, Boat ) 
  
function outBoat ( source ) 
     if (getElementType(source) == "player") then 
          unbindKey(source, "F7","down", startKey) 
    end 
end 
addEventHandler ( "onColShapeLeave", Area, outBoat ) 

Posted
A mi me funciona perfectamente

Linea 22:

          unbindKey(source, "F7","down", startKey) 

Eso daría error constantemente por que 'startKey' no existe en tu código.

Posted (edited)
Area = createColRectangle ( -2535.9562988281, 1498.9573974609, 300, 800 ) 
  
Radar = createRadarArea ( -2535.9562988281, 1498.9573974609, 300, 800, 255, 0, 0, 150 ) 
  
posX = 0 
posY = 0 
posZ = 0 
  
function startKey (thePlayer) 
      setElementPosition(thePlayer, posX, posY, posZ) 
end 
  
function Boat ( thePlayer ) 
   if (getElementType(thePlayer) == "player") then 
    bindKey(thePlayer, "F7","down", starKey ) 
    outputChatBox( getPlayerName(thePlayer) .. "Estás en la Zona.Presiona F7 si queres entrar.", thePlayer, 0, 200, 0, false ) 
  end 
end 
addEventHandler ( "onColShapeHit", Area, Boat ) 
  
function outBoat ( thePlayer ) 
     if (getElementType(thePlayer) == "player") then 
          unbindKey(thePlayer, "F7","down", startKey) 
    end 
end 
addEventHandler ( "onColShapeLeave", Area, outBoat ) 

Edited by Guest
  • Recently Browsing   0 members

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