Anyelberth Posted July 23, 2013 Posted July 23, 2013 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
StanMarsh Posted July 23, 2013 Posted July 23, 2013 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...
AlvareZ_ Posted July 24, 2013 Posted July 24, 2013 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)
Anyelberth Posted July 25, 2013 Author Posted July 25, 2013 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í?
AlvareZ_ Posted July 25, 2013 Posted July 25, 2013 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)
Anyelberth Posted July 25, 2013 Author Posted July 25, 2013 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...
AlvareZ_ Posted July 25, 2013 Posted July 25, 2013 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)
Alexs Posted July 25, 2013 Posted July 25, 2013 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'?
Alexs Posted July 25, 2013 Posted July 25, 2013 quiere que al darle el dinero ya no le de mas. Entonces usa alguna variable, elementData o 'killTimer' en client-side, ese 'cancelEvent' ahí no tiene sentido.
AlvareZ_ Posted July 26, 2013 Posted July 26, 2013 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)
Alexs Posted July 26, 2013 Posted July 26, 2013 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.
Recommended Posts