Narutimmy Posted July 12, 2013 Share Posted July 12, 2013 Hola tengo este bug pero nose porque es ---FOLT addEventHandler('onColShapeHit', pCuboid1, function(source) local getOwnedBy = getElementData(pCuboid1, "ownedBy") callClientFunction(source, "NeedMsg", 6, getOwnedBy) callClientFunction(source, "NeedMsg", 1) if (getPlayerTeam(source)) then local pTeam = getPlayerTeam( source ) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea1 ) local data = getElementData(pCuboid1, "friendly") if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then callClientFunction(source, "NeedMsg", 2) else setRadarAreaFlashing( pArea1, true ) capturing = setTimer( function( ) setElementData(pCuboid1, "friendly", "yes") setElementData(pCuboid1, "ownedBy", getTeamName(pTeam)) givePlayerMoney( source, 4000 ) callClientFunction(source, "NeedMsg", 4) setRadarAreaColor( pArea1, iR, iG, iB ) setRadarAreaFlashing( pArea1, false ) outputChatBox ( "#ff0000La Base FOLT a sido Conquistada!!!", getRootElement(), 255, 255, 255, true) end, 300000, 1 ) end else callClientFunction(source, "NeedMsg", 3) end if (getPedOccupiedVehicle( source )) then callClientFunction(source, "NeedMsg", 5) end end ) Link to comment
Alexs Posted July 12, 2013 Share Posted July 12, 2013 'source' viene ya definido con los eventos, en el caso de 'onColShapeHit' representa a el colshape, pero tu lo definiste en los parámetros, cámbiale el nombre en la función para evitar confusiones. addEventHandler('onColShapeHit', pCuboid1, function(thePlayer) local getOwnedBy = getElementData(pCuboid1, "ownedBy") callClientFunction(thePlayer, "NeedMsg", 6, getOwnedBy) callClientFunction(thePlayer, "NeedMsg", 1) if (getPlayerTeam(thePlayer)) then local pTeam = getPlayerTeam( thePlayer ) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea1 ) local data = getElementData(pCuboid1, "friendly") if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then callClientFunction(thePlayer, "NeedMsg", 2) else setRadarAreaFlashing( pArea1, true ) capturing = setTimer( function( ) setElementData(pCuboid1, "friendly", "yes") setElementData(pCuboid1, "ownedBy", getTeamName(pTeam)) givePlayerMoney( thePlayer, 4000 ) callClientFunction(thePlayer, "NeedMsg", 4) setRadarAreaColor( pArea1, iR, iG, iB ) setRadarAreaFlashing( pArea1, false ) outputChatBox ( "#ff0000La Base FOLT a sido Conquistada!!!", getRootElement(), 255, 255, 255, true) end, 300000, 1 ) end else callClientFunction(thePlayer, "NeedMsg", 3) end if (getPedOccupiedVehicle( thePlayer )) then callClientFunction(thePlayer, "NeedMsg", 5) end end ) Tu jugador es ahora 'thePlayer' y 'source' es el 'colshape'. PD: Te recomiendo hacer una revisión de 'thePlayer' para saber si es un jugador y evitar errores en el debug, ya que el primer parámetro de ese evento representa a cualquier elemento que entre al 'colshape'. Link to comment
Narutimmy Posted July 12, 2013 Author Share Posted July 12, 2013 'source' viene ya definido con los eventos, en el caso de 'onColShapeHit' representa a el colshape, pero tu lo definiste en los parámetros, cámbiale el nombre en la función para evitar confusiones. addEventHandler('onColShapeHit', pCuboid1, function(thePlayer) local getOwnedBy = getElementData(pCuboid1, "ownedBy") callClientFunction(thePlayer, "NeedMsg", 6, getOwnedBy) callClientFunction(thePlayer, "NeedMsg", 1) if (getPlayerTeam(thePlayer)) then local pTeam = getPlayerTeam( thePlayer ) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea1 ) local data = getElementData(pCuboid1, "friendly") if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then callClientFunction(thePlayer, "NeedMsg", 2) else setRadarAreaFlashing( pArea1, true ) capturing = setTimer( function( ) setElementData(pCuboid1, "friendly", "yes") setElementData(pCuboid1, "ownedBy", getTeamName(pTeam)) givePlayerMoney( thePlayer, 4000 ) callClientFunction(thePlayer, "NeedMsg", 4) setRadarAreaColor( pArea1, iR, iG, iB ) setRadarAreaFlashing( pArea1, false ) outputChatBox ( "#ff0000La Base FOLT a sido Conquistada!!!", getRootElement(), 255, 255, 255, true) end, 300000, 1 ) end else callClientFunction(thePlayer, "NeedMsg", 3) end if (getPedOccupiedVehicle( thePlayer )) then callClientFunction(thePlayer, "NeedMsg", 5) end end ) Tu jugador es ahora 'thePlayer' y 'source' es el 'colshape'. PD: Te recomiendo hacer una revisión de 'thePlayer' para saber si es un jugador y evitar errores en el debug, ya que el primer parámetro de ese evento representa a cualquier elemento que entre al 'colshape'. En este caso ahora si no entendi mucho, me puede ayudar un poco mas? Link to comment
Alexs Posted July 12, 2013 Share Posted July 12, 2013 El código que te deje ya debería funcionar, solo quite 'source' de los parámetros y lo cambie por 'thePlayer'. Link to comment
Narutimmy Posted July 14, 2013 Author Share Posted July 14, 2013 El código que te deje ya debería funcionar, solo quite 'source' de los parámetros y lo cambie por 'thePlayer'. No Funciono Link to comment
MTA Team 0xCiBeR Posted July 14, 2013 MTA Team Share Posted July 14, 2013 Algun error? Link to comment
MTA Team 0xCiBeR Posted July 14, 2013 MTA Team Share Posted July 14, 2013 Copiaste el codigo de Alexs? Proba este haber: addEventHandler('onColShapeHit', pCuboid1, function(jugador) local getOwnedBy = getElementData(pCuboid1, "ownedBy") callClientFunction(jugador, "NeedMsg", 6, getOwnedBy) callClientFunction(jugador, "NeedMsg", 1) if (getPlayerTeam(jugador)) then local pTeam = getPlayerTeam( jugador ) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea1 ) local data = getElementData(pCuboid1, "friendly") if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then callClientFunction(jugador, "NeedMsg", 2) else setRadarAreaFlashing( pArea1, true ) capturing = setTimer( function( ) setElementData(pCuboid1, "friendly", "yes") setElementData(pCuboid1, "ownedBy", getTeamName(pTeam)) givePlayerMoney( jugador, 4000 ) callClientFunction(jugador, "NeedMsg", 4) setRadarAreaColor( pArea1, iR, iG, iB ) setRadarAreaFlashing( pArea1, false ) outputChatBox ( "#ff0000La Base FOLT a sido Conquistada!!!", getRootElement(), 255, 255, 255, true) end, 300000, 1 ) end else callClientFunction(jugador, "NeedMsg", 3) end if (getPedOccupiedVehicle( jugador )) then callClientFunction(jugador, "NeedMsg", 5) end end ) Link to comment
Narutimmy Posted July 14, 2013 Author Share Posted July 14, 2013 Copiaste el codigo de Alexs? Proba este haber: addEventHandler('onColShapeHit', pCuboid1, function(jugador) local getOwnedBy = getElementData(pCuboid1, "ownedBy") callClientFunction(jugador, "NeedMsg", 6, getOwnedBy) callClientFunction(jugador, "NeedMsg", 1) if (getPlayerTeam(jugador)) then local pTeam = getPlayerTeam( jugador ) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea1 ) local data = getElementData(pCuboid1, "friendly") if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) and ( data == "yes" ) then callClientFunction(jugador, "NeedMsg", 2) else setRadarAreaFlashing( pArea1, true ) capturing = setTimer( function( ) setElementData(pCuboid1, "friendly", "yes") setElementData(pCuboid1, "ownedBy", getTeamName(pTeam)) givePlayerMoney( jugador, 4000 ) callClientFunction(jugador, "NeedMsg", 4) setRadarAreaColor( pArea1, iR, iG, iB ) setRadarAreaFlashing( pArea1, false ) outputChatBox ( "#ff0000La Base FOLT a sido Conquistada!!!", getRootElement(), 255, 255, 255, true) end, 300000, 1 ) end else callClientFunction(jugador, "NeedMsg", 3) end if (getPedOccupiedVehicle( jugador )) then callClientFunction(jugador, "NeedMsg", 5) end end ) Pues aun sale pero no daña el scrip creo Link to comment
Recommended Posts