Jump to content

[Ayuda]Nigh Vision Bug


Recommended Posts

Posted

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 :S

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) 

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted

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.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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 

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted

Con eso deberia funcionar. Mostrame como ejecutas este evento: "goooogles".

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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 
    ) 
  

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted

Lo suponia, quita 'source' del nombre de la funcion:

function toggleInvis ( source ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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) 

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted
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'.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

2i6.png

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 :(

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

  • Recently Browsing   0 members

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