Tonyx97 Posted October 17, 2012 Share Posted October 17, 2012 (edited) Hola a todos tengo un problema, al ejecutar esta funcion se repite el mensage como tantos criminales haya en la zona, ejemplo, si estoy solo dentro de la Col entonces sale 1 mensage, si hay 2 criminales en la Col salen 2 mensages. TODO funciona correctamente excepto por lo de que salen 2 mensages si hay 2 criminales en la zona o 3 entonces 3 mensages, los getElementData no son ni lo de los markers tampoco, sera algo de playerCrims o algo de eso. GRACIAS POR LEER Zone = createColCuboid ( 0, 0, 0, 271, 268, 50 ) countdownCount = 0 deTimer = setTimer ( ejemplo, 60000, 0 ) function ejemplo () local criminalTeam = getTeamFromName ("Criminal") if criminalTeam then local playersCrims = getPlayersInTeam ( criminalTeam ) for playerKey, playerCriminals in ipairs ( playersCrims ) do local detectionCriminal = isElementWithinColShape ( playerCriminals, Zone ) if detectionCriminal then local Leave = getElementData ( playerCriminals, "CanNotLeave" ) local Drugs = getElementData ( playerCriminals, "Drugs" ) if Leave == true and Drugs == false then local R, G, B, A = getMarkerColor( markerStore ) local R2, G2, B2, A2 = getMarkerColor( markerOffice ) if (R == 255 and G == 0 and B == 0 and R2 == 255 and G2 == 0 and B2 == 0) then countdownCount = countdownCount + 1 if (countdownCount >= 0 and countdownCount < 3) then sendMensageMarkersTaken ( "Test count "..countdownCount.."/3 Ejem", 0, 255, 0 ) elseif (countdownCount == 3) then sendMensageMarkersTaken ( "Complete Test", 0, 255, 0 ) killTimer ( deTimer ) outputChatBox ("Testing 2", playerCriminals, 0, 255, 0) setElementData ( playerCriminals, "Drugs", true ) setElementData ( playerCriminals, "CanNotLeave", false ) end end end end end end end function sendMensageMarkersTaken ( message, color1, color2, color3 ) local mesgPlayers = getElementsByType("player") for index, playerIntoZone in ipairs(mesgPlayers) do local detection = isElementWithinColShape ( playerIntoZone, Zone ) if detection then outputChatBox ( message, playerIntoZone, color1, color2, color3 ) end end end) Edited October 17, 2012 by Guest Link to comment
Renkon Posted October 17, 2012 Share Posted October 17, 2012 Que outputChatBox hace eso, exactamente? el de sendMensage o el otro Link to comment
Tonyx97 Posted October 17, 2012 Author Share Posted October 17, 2012 Que outputChatBox hace eso, exactamente? el de sendMensage o el otro La unica llamada que hay, esta sendMensageMarkersTaken llama a mandar un mensage Link to comment
Renkon Posted October 17, 2012 Share Posted October 17, 2012 hay otro: outputChatBox ("Testing 2", playerCriminals, 0, 255, 0) Pero a ver, ahi te digo Link to comment
Tonyx97 Posted October 17, 2012 Author Share Posted October 17, 2012 hay otro:outputChatBox ("Testing 2", playerCriminals, 0, 255, 0) Pero a ver, ahi te digo ah sii, ese es uno normal. hagamos como que no existe Link to comment
Renkon Posted October 17, 2012 Share Posted October 17, 2012 local detection = isElementWithinColShape ( playerIntoZone, DSZone ), NO DEBERÍA ser 'Zone' el colshape? Link to comment
Tonyx97 Posted October 17, 2012 Author Share Posted October 17, 2012 local detection = isElementWithinColShape ( playerIntoZone, DSZone ), NO DEBERÍA ser 'Zone' el colshape? si es verdad perdona, eso esta bien en mi script esque lo cambie todo... Link to comment
Tonyx97 Posted October 17, 2012 Author Share Posted October 17, 2012 Alguien sabe la solucion? Link to comment
Plate Posted October 17, 2012 Share Posted October 17, 2012 Prova haci mira message = "LO QUE VOS QUIERAS PONER" Zone = createColCuboid ( 0, 0, 0, 271, 268, 50 ) countdownCount = 0 deTimer = setTimer ( ejemplo, 60000, 0 ) function ejemplo () local criminalTeam = getTeamFromName ("Criminal") if criminalTeam then local playersCrims = getPlayersInTeam ( criminalTeam ) for playerKey, playerCriminals in ipairs ( playersCrims ) do local detectionCriminal = isElementWithinColShape ( playerCriminals, Zone ) if detectionCriminal then local Leave = getElementData ( playerCriminals, "CanNotLeave" ) local Drugs = getElementData ( playerCriminals, "Drugs" ) if Leave == true and Drugs == false then local R, G, B, A = getMarkerColor( markerStore ) local R2, G2, B2, A2 = getMarkerColor( markerOffice ) if (R == 255 and G == 0 and B == 0 and R2 == 255 and G2 == 0 and B2 == 0) then countdownCount = countdownCount + 1 if (countdownCount >= 0 and countdownCount < 3) then sendMensageMarkersTaken ( "Test count "..countdownCount.."/3 Ejem", 0, 255, 0 ) elseif (countdownCount == 3) then sendMensageMarkersTaken ( "Complete Test", 0, 255, 0 ) killTimer ( deTimer ) outputChatBox ("Testing 2", playerCriminals, 0, 255, 0) setElementData ( playerCriminals, "Drugs", true ) setElementData ( playerCriminals, "CanNotLeave", false ) end end end end end end end function sendMensageMarkersTaken ( message, color1, color2, color3 ) local mesgPlayers = getElementsByType("player") for index, playerIntoZone in ipairs(mesgPlayers) do local detection = isElementWithinColShape ( playerIntoZone, Zone ) if detection then outputChatBox ( message, playerIntoZone, color1, color2, color3 ) end end end) la proxima solamente postea la parte del error porfavor Link to comment
Tonyx97 Posted October 18, 2012 Author Share Posted October 18, 2012 No me refiero a eso renkon, quiero que daca 60 segundos repita el mensaje pero con 1 mas osea, primer minuto 1/3 segundo minuto 2/3 y por ultimo 3/3 Link to comment
Renkon Posted October 18, 2012 Share Posted October 18, 2012 Lo unico que se me ocurre, es que uses un boolean declarado como 'true', y pongas en el sendMessage, if boolean then y adentro pones boolean = false, y luego ejecutas lo otro Con un Timer de 60 segundos asu vez o de quizas menos lo vuelves true nuevamente. Porque no encuentro un error Link to comment
Recommended Posts