Jump to content

Ayuda Con Zona


Recommended Posts

Chicos. . . Como Aria Acá Para Que Salga un OutputChatBox Que Diga cuando Un Player sale de la Zona Espesifica, y Cuando Entra...?

setTimer (ZoneTime, 9000, 0)  
DineroCol = createColCuboid (1874.13, 1322.1, 22.73, 55, 55, 55) 
  
function ZoneTime () 
  local allPlayersInCol = getElementsWithinColShape (DineroCol, "player") 
  for i,v in ipairs (allPlayersInCol) do 
    givePlayerMoney (v, 300) 
  end 
end 

Link to comment
Chicos. . . Como Aria Acá Para Que Salga un OutputChatBox Que Diga cuando Un Player sale de la Zona Espesifica, y Cuando Entra...?
setTimer (ZoneTime, 9000, 0)  
DineroCol = createColCuboid (1874.13, 1322.1, 22.73, 55, 55, 55) 
  
function ZoneTime () 
  local allPlayersInCol = getElementsWithinColShape (DineroCol, "player") 
  for i,v in ipairs (allPlayersInCol) do 
    givePlayerMoney (v, 300) 
  end 
end 

addEventHandler ( 'onColShapeLeave', pColshape,  
                    function ( pLeaveElement ) 
                        if getElementType( pLeaveElement ) == 'player' then 
                        outputChatBox("#ff0000Has salido de la Zona Verde!", getRootElement(), 255, 0, 0, true ) 
                       
                     end 
                end) 
  
 addEventHandler ( 'onColShapeHit', pColshape,  
                    function ( pHitElement ) 
                        if getElementType( pHitElement ) == 'player' then    
                          outputChatBox("#ff0000Has entrado a Zona Verde!", getRootElement(), 255, 0, 0, true )      
                   end 
            end)        

Sin testear...

Link to comment
setTimer (ZoneTime, 9000, 0) 
DineroCol = createColCuboid (1874.13, 1322.1, 22.73, 55, 55, 55) 
  
function ZoneTime () 
  local allPlayersInCol = getElementsWithinColShape (DineroCol, "player") 
  for i,v in ipairs (allPlayersInCol) do 
    givePlayerMoney (v, 300) 
  end 
end 
  
function onHit(hitElement, matchingDimension) 
outputChatBox("Bienvenido a la zona de Dinero ".. getPlayerName(hitElement) .."!", getRootElement(), 255, 0, 0, true ) 
end 
addEventHandler("onColShapeHit", DineroCol, onHit) 
  
function onLeave(leaveElement, matchingDimension) 
outputChatBox("El Juegador ".. getPlayerName(leaveElement) .." Deja lo zona de Dinero!", getRootElement(), 255, 0, 0, true ) 
end 
addEventHandler("onColShapeLeave", DineroCol, onLeave) 

Link to comment

hey, y Como Aria Para Que El setTime Sea Alazar? Pense En Esto:

  
  
local Times = 
    { 
        { 80000, 0 }, 
        { 455555, 0 }, 
        { 4545455, 0 }, 
    } 
  
addEventHandler ("onResourceStart", getRootElement(), 
function() 
local azar = math.random ( #Times ) 
setTimer (ZoneTime, unpack ( Times [ azar ]) 
  
end) 
  
DineroCol = createColCuboid ( 1874.13 , 1322.1 , 22,73 , 55 , 55 , 55 ) 
  
función ZoneTime ( ) 
  locales allPlayersInCol = getElementsWithinColShape ( DineroCol, "player" ) 
  para i, v en ipairs ( allPlayersInCol ) hacer 
    givePlayerMoney ( v, 300 ) 
  final 
final 
  
función onHit ( hitElement, matchingDimension ) 
outputChatBox ( "Bienvenido a la zona de Dinero" .. GetPlayerName ( hitElement ) .. "" , getRootElement ( ) , 255 , 0 , 0 , cierto ) 
final 
AddEventHandler ( "onColShapeHit" , DineroCol, onHit ) 
  
función OnLeave ( leaveElement, matchingDimension ) 
outputChatBox ( "El Juegador" .. GetPlayerName ( leaveElement ) .. "Deja lo zona de Dinero" , getRootElement ( ) , 255 , 0 , 0 , cierto ) 
final 
AddEventHandler ( "onColShapeLeave" , DineroCol, OnLeave ) 

Seria Así?

Link to comment

Intenta esto, No estoy seguro nunca e trabajado con tablas

times = { 
         { 80000, 1 } 
         { 455555, 1 } 
         { 4545455, 1 } 
       } 
  
addEventHandler ("onResourceStart", getRootElement(), 
function() 
local azar = math.random ( #times )  
setTimer (ZoneTime, unpack ( times [ azar ] )) 
end) 

Link to comment
Intenta esto, No estoy seguro nunca e trabajado con tablas
times = { 
         { 80000, 1 } 
         { 455555, 1 } 
         { 4545455, 1 } 
       } 
  
addEventHandler ("onResourceStart", getRootElement(), 
function() 
local azar = math.random ( #times )  
setTimer (ZoneTime, unpack ( times [ azar ] )) 
end) 

Te Faltaron Las Comas. . . El Mio Funciono ...

EDIT:

Pero Tengo Un Error o Algo, Es Que Cuando Da El Dinero, Luego de dar el dinero, se tarda 1 Minuto y buelve a dar el dinero, Este Problema Esta Desde antes y despues De El Random...

Entonces Para Eso Creo que Pense

removeEventHandler y addEventHandler Denuevo, Creo yo...

Algo Como...

  
times = { 
         { 80000, 1 }, 
         { 455555, 1 }, 
         { 4545455, 1 }, 
       } 
  
addEventHandler ("onResourceStart", getRootElement(), 
function tims() 
local azar = math.random ( #times )  
setTimer (ZoneTime, unpack ( times [ azar ] )) 
removeEventHandler("onResourceStart", getRootElement(), tims) 
addEventHandler ("onResourceStart", getRootElement(), tims) 
end) 
  

Creo que estoy Equivocado...

Link to comment
setTimer (ZoneTime, 9000, 0) 
DineroCol = createColCuboid (1874.13, 1322.1, 22.73, 55, 55, 55) 
  
function ZoneTime () 
  local allPlayersInCol = getElementsWithinColShape (DineroCol, "player") 
  for i,v in ipairs (allPlayersInCol) do 
   local dinero = givePlayerMoney (v, 300) 
  if (dinero) then 
 cancelEvent() 
  end 
end 
end 
  
function onHit(hitElement, matchingDimension) 
outputChatBox("Bienvenido a la zona de Dinero ".. getPlayerName(hitElement) .."!", getRootElement(), 255, 0, 0, true ) 
end 
addEventHandler("onColShapeHit", DineroCol, onHit) 
  
function onLeave(leaveElement, matchingDimension) 
outputChatBox("El Juegador ".. getPlayerName(leaveElement) .." Deja lo zona de Dinero!", getRootElement(), 255, 0, 0, true ) 
end 
addEventHandler("onColShapeLeave", DineroCol, onLeave) 

Link to comment
setTimer (ZoneTime, 9000, 0) 
DineroCol = createColCuboid (1874.13, 1322.1, 22.73, 55, 55, 55) 
  
function ZoneTime () 
  local allPlayersInCol = getElementsWithinColShape (DineroCol, "player") 
  for i,v in ipairs (allPlayersInCol) do 
   local dinero = givePlayerMoney (v, 300) 
  if (dinero) then 
 cancelEvent() 
  end 
end 
end 
  
function onHit(hitElement, matchingDimension) 
outputChatBox("Bienvenido a la zona de Dinero ".. getPlayerName(hitElement) .."!", getRootElement(), 255, 0, 0, true ) 
end 
addEventHandler("onColShapeHit", DineroCol, onHit) 
  
function onLeave(leaveElement, matchingDimension) 
outputChatBox("El Juegador ".. getPlayerName(leaveElement) .." Deja lo zona de Dinero!", getRootElement(), 255, 0, 0, true ) 
end 
addEventHandler("onColShapeLeave", DineroCol, onLeave) 

Para que el 'cancelEvent'?

Link to comment

Prueba esto.

Timer = setTimer (ZoneTime, 9000, 0) 
DineroCol = createColCuboid (1874.13, 1322.1, 22.73, 55, 55, 55) 
  
function ZoneTime () 
  local allPlayersInCol = getElementsWithinColShape (DineroCol, "player") 
  for i,v in ipairs (allPlayersInCol) do 
   givePlayerMoney (v, 300) 
   if isTimer ( Timer ) then  
   killTimer ( Timer ) 
      end 
   end 
end 
  
function onHit(hitElement, matchingDimension) 
outputChatBox("Bienvenido a la zona de Dinero ".. getPlayerName(hitElement) .."!", getRootElement(), 255, 0, 0, true ) 
end 
addEventHandler("onColShapeHit", DineroCol, onHit) 
  
function onLeave(leaveElement, matchingDimension) 
outputChatBox("El Juegador ".. getPlayerName(leaveElement) .." Deja lo zona de Dinero!", getRootElement(), 255, 0, 0, true ) 
end 
addEventHandler("onColShapeLeave", DineroCol, onLeave) 

Link to comment
Prueba esto.
Timer = setTimer (ZoneTime, 9000, 0) 
DineroCol = createColCuboid (1874.13, 1322.1, 22.73, 55, 55, 55) 
  
function ZoneTime () 
  local allPlayersInCol = getElementsWithinColShape (DineroCol, "player") 
  for i,v in ipairs (allPlayersInCol) do 
   givePlayerMoney (v, 300) 
   if isTimer ( Timer ) then  
   killTimer ( Timer ) 
      end 
   end 
end 
  
function onHit(hitElement, matchingDimension) 
outputChatBox("Bienvenido a la zona de Dinero ".. getPlayerName(hitElement) .."!", getRootElement(), 255, 0, 0, true ) 
end 
addEventHandler("onColShapeHit", DineroCol, onHit) 
  
function onLeave(leaveElement, matchingDimension) 
outputChatBox("El Juegador ".. getPlayerName(leaveElement) .." Deja lo zona de Dinero!", getRootElement(), 255, 0, 0, true ) 
end 
addEventHandler("onColShapeLeave", DineroCol, onLeave) 

Así ya no dará dinero hasta que se reinicie el recurso.

Link to comment
  • Recently Browsing   0 members

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