Narutimmy Posted July 11, 2013 Share Posted July 11, 2013 Bueno borre el otro porque arregle unas cosas... ahora nose que pasa que al ponerte las gafas (Activar la Funcion) se va hasta el else y no pasa por lo primero function toggleInvis ( source ) if ( source and getElementType ( source ) == "player" ) then setPlayerNametagShowing ( source, false ) local attachedElements = getAttachedElements ( source ) for ElementKey, ElementValue in ipairs ( attachedElements ) do if ( getElementType ( ElementValue ) == "blip" ) then destroyElement ( ElementValue ) end end outputChatBox ( "#FFFF00*INFO* #00FF00Invisible Enabled", source, 0, 255, 0, true ) else setPlayerNametagShowing ( source, true ) local r, g, b = getTeamColor(getPlayerTeam(player)) local blip = createBlipAttachedTo(player, 0, 2, r, g, b, 255, 1) outputChatBox ( "#FFFF00*INFO* #00FF00Invisible Disable", source, 0, 255, 0, true ) end end addEvent('goooogles', true) addEventHandler('goooogles', root, toggleInvis) Link to comment
Castillo Posted July 11, 2013 Share Posted July 11, 2013 Como que se va hasta el "else"? el "else" lo estas usando para hacer otra cosa si el elemento no existe o no es un jugador. Link to comment
Narutimmy Posted July 11, 2013 Author Share Posted July 11, 2013 Como que se va hasta el "else"? el "else" lo estas usando para hacer otra cosa si el elemento no existe o no es un jugador. como puedo optener el blip del jugador? Intente con esto pero no me sirvio local attachedElements = getAttachedElements ( source ) for ElementKey, ElementValue in ipairs ( attachedElements ) do if ( getElementType ( ElementValue ) == "blip" ) then destroyElement ( ElementValue ) end Link to comment
Castillo Posted July 11, 2013 Share Posted July 11, 2013 Con eso deberia funcionar. Mostrame como ejecutas este evento: "goooogles". Link to comment
Narutimmy Posted July 11, 2013 Author Share Posted July 11, 2013 Con eso deberia funcionar. Mostrame como ejecutas este evento: "goooogles". addEventHandler( "onClientResourceStart", resourceRoot, function() bindKey("fire", "down", theGoggle) end ) function theGoggle() local weaponID = getPedWeapon (getLocalPlayer ()) if weaponID == 44 then setTimer (playerGoggles, 50, 0 ) end end function playerGoggles() if isPedDoingTask ( getLocalPlayer (), "TASK_SIMPLE_GOGGLES_ON" ) then triggerServerEvent("goooogles", localPlayer) end end if isPedDoingTask ( getLocalPlayer (), "TASK_SIMPLE_GOGGLES_OFF" ) then triggerServerEvent("goooogles", source) end addEventHandler( "onResourceStop", resourceRoot, function() unbindKey("fire", "down", theGoggle) end ) Link to comment
Castillo Posted July 11, 2013 Share Posted July 11, 2013 Lo suponia, quita 'source' del nombre de la funcion: function toggleInvis ( source ) Link to comment
Narutimmy Posted July 11, 2013 Author Share Posted July 11, 2013 Lo suponia, quita 'source' del nombre de la funcion: function toggleInvis ( source ) Nose que pasa... al ponerse la Gafas ya muestra el mensaje pero el quitarselas no se activa la otra funcion Cl: addEventHandler( "onClientResourceStart", resourceRoot, function() bindKey("fire", "down", theGoggle) end ) function theGoggle() local weaponID = getPedWeapon (getLocalPlayer ()) if weaponID == 44 then setTimer (playerGoggles, 50, 0 ) end end function playerGoggles() if isPedDoingTask ( getLocalPlayer (), "TASK_SIMPLE_GOGGLES_ON" ) then triggerServerEvent("goooogles", localPlayer) end end if isPedDoingTask ( getLocalPlayer (), "TASK_SIMPLE_GOGGLES_OFF" ) then triggerServerEvent("off", localPlayer) end addEventHandler( "onResourceStop", resourceRoot, function() unbindKey("fire", "down", theGoggle) end ) sv function toggleInvis ( ) if ( source and getElementType ( source ) == "player" ) then setPlayerNametagShowing ( source, false ) local attachedElements = getAttachedElements ( source ) for ElementKey, ElementValue in ipairs ( attachedElements ) do if ( getElementType ( ElementValue ) == "blip" ) then destroyElement ( ElementValue ) end end outputChatBox ( "#FFFF00*INFO* #00FF00Invisible Enabled", source, 0, 255, 0, true ) end end addEvent('goooogles', true) addEventHandler('goooogles', root, toggleInvis) function toggleInvis2 ( ) setPlayerNametagShowing ( source, true ) local r, g, b = getTeamColor(getPlayerTeam(player)) local blip = createBlipAttachedTo(player, 0, 2, r, g, b, 255, 1) outputChatBox ( "#FFFF00*INFO* #00FF00Invisible Disable", source, 0, 255, 0, true ) end addEvent('off', true) addEventHandler('off', root, toggleInvis2) Link to comment
Castillo Posted July 11, 2013 Share Posted July 11, 2013 local r, g, b = getTeamColor(getPlayerTeam(player)) local blip = createBlipAttachedTo(player, 0, 2, r, g, b, 255, 1) outputChatBox ( "#FFFF00*INFO* #00FF00Invisible Disable", source, 0, 255, 0, true ) Tu elemento es 'source' no 'player'. Link to comment
Narutimmy Posted July 12, 2013 Author Share Posted July 12, 2013 local r, g, b = getTeamColor(getPlayerTeam(player)) local blip = createBlipAttachedTo(player, 0, 2, r, g, b, 255, 1) outputChatBox ( "#FFFF00*INFO* #00FF00Invisible Disable", source, 0, 255, 0, true ) Tu elemento es 'source' no 'player'. Ahora me sale esto y al ponerse las Gafas desaparecen todos los blips, yo quiero que solo se borre el blip del jugador... que nadie mas lo vea en el map, pero el si a ellos EDIT: amm Ahi un super bug... al ponerte y quitarte las Gafas la funcion entra en un ciclo infinito.. ocacionando que el host se sature y se apague Link to comment
Recommended Posts