Jump to content

[Ayuda] Blips


Recommended Posts

Hola lo que pasa es que mi Server es Survival, por lo cual quite los blips pero el server se siente solo y se desconectan, ademas es mucho problema buscar gente o amigos si no salen en el mapa :/

lo que quiero hacer es que cuando te pongas las nighvision tu blip y unicamente tu blip desaparesca del mapa.

Yo tengo este que lo que hace es que al ponertelos todos aparecen y al quitartelos desaparecen... osea les cambia el color para que sean visibles o no:

addEventHandler( "onClientResourceStart", resourceRoot, 
    function() 
    bindKey("fire", "down", theGoggle) 
    for _,blip in ipairs(getElementsByType("blip")) do 
    local r,g,b,a = getBlipColor(blip) 
    setBlipColor(blip,r,g,b,0) 
    end 
    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 
    for _,blip in ipairs(getElementsByType("blip")) do 
    local r,g,b,a = getBlipColor(blip) 
    setBlipColor(blip,255,g,b,255) 
    end 
    end 
                
    if isPedDoingTask ( getLocalPlayer (), "TASK_SIMPLE_GOGGLES_OFF" ) then 
    for _,blip in ipairs(getElementsByType("blip")) do 
    local r,g,b,a = getBlipColor(blip) 
    setBlipColor(blip,r,g,b,0) 
    end 
    end 
                        
    end 
      
    addEventHandler( "onClientResourceStop", resourceRoot, 
    function() 
    unbindKey("fire", "down", theGoggle) 
    end 
    ) 
  
addEventHandler("onClientPlayerWasted", localPlayer, 
function () 
for _,blip in ipairs(getElementsByType("blip")) do 
local r,g,b,a = getBlipColor(blip) 
setBlipColor(blip,r,g,b,0) 
end 
end 
) 
  
addEventHandler("onClientPlayerSpawn", localPlayer, 
function () 
for _,blip in ipairs(getElementsByType("blip")) do 
local r,g,b,a = getBlipColor(blip) 
setBlipColor(blip,r,g,b,0) 
end 
end 
) 

Como puedo hacer para que al ponertelos solo se desaparesca el propio para todos y no todos los blips en el map?

Link to comment

Prueba asi:

Editado: le quite el local, a ver si es lo que dice alexs

addEventHandler( "onClientResourceStart", resourceRoot, 
    function() 
    bindKey("fire", "down", theGoggle) 
    local r,g,b,a = getBlipColor(blip) 
    setBlipColor(blip,r,g,b,0) 
    end 
    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 
    local r,g,b,a = getBlipColor(blip) 
    setBlipColor(blip,255,g,b,255) 
    end 
    end 
                
    if isPedDoingTask ( getLocalPlayer (), "TASK_SIMPLE_GOGGLES_OFF" ) then 
    local r,g,b,a = getBlipColor(blip) 
    setBlipColor(blip,r,g,b,0) 
    end 
    end 
                        
    end 
      
    addEventHandler( "onClientResourceStop", resourceRoot, 
    function() 
    unbindKey("fire", "down", theGoggle) 
    end 
    ) 
  
addEventHandler("onClientPlayerWasted", localPlayer, 
function () 
local r,g,b,a = getBlipColor(blip) 
setBlipColor(blip,r,g,b,0) 
end 
end 
) 
  
addEventHandler("onClientPlayerSpawn", localPlayer, 
function () 
local r,g,b,a = getBlipColor(blip) 
setBlipColor(blip,r,g,b,0) 
end 
end 
) 

In ipairs significa multitud, eso he leido yo.

Edited by Guest
Link to comment
Prueba asi:
addEventHandler( "onClientResourceStart", resourceRoot, 
    function() 
    bindKey("fire", "down", theGoggle) 
    local blip = getElementsByType("blip") 
    local r,g,b,a = getBlipColor(blip) 
    setBlipColor(blip,r,g,b,0) 
    end 
    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 
    local blip = getElementsByType("blip") 
    local r,g,b,a = getBlipColor(blip) 
    setBlipColor(blip,255,g,b,255) 
    end 
    end 
                
    if isPedDoingTask ( getLocalPlayer (), "TASK_SIMPLE_GOGGLES_OFF" ) then 
    local blip = getElementsByType("blip") 
    local r,g,b,a = getBlipColor(blip) 
    setBlipColor(blip,r,g,b,0) 
    end 
    end 
                        
    end 
      
    addEventHandler( "onClientResourceStop", resourceRoot, 
    function() 
    unbindKey("fire", "down", theGoggle) 
    end 
    ) 
  
addEventHandler("onClientPlayerWasted", localPlayer, 
function () 
local blip = getElementsByType("blip") 
local r,g,b,a = getBlipColor(blip) 
setBlipColor(blip,r,g,b,0) 
end 
end 
) 
  
addEventHandler("onClientPlayerSpawn", localPlayer, 
function () 
local blip = getElementsByType("blip") 
local r,g,b,a = getBlipColor(blip) 
setBlipColor(blip,r,g,b,0) 
end 
end 
) 

In ipairs significa multitud, eso he leido yo.

El 'for-loop' se usa para ejecutar un código a todos los valores/elementos dentro de una tabla.

En esta parte:

local blip = getElementsByType("blip") 
local r,g,b,a = getBlipColor(blip) 
setBlipColor(blip,r,g,b,0) 

'blip' es una tabla, pero getBlipColor y setBlipColor necesitan un elemento 'blip', no una tabla.

Link to comment
Prueba asi:
addEventHandler( "onClientResourceStart", resourceRoot, 
    function() 
    bindKey("fire", "down", theGoggle) 
    local blip = getElementsByType("blip") 
    local r,g,b,a = getBlipColor(blip) 
    setBlipColor(blip,r,g,b,0) 
    end 
    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 
    local blip = getElementsByType("blip") 
    local r,g,b,a = getBlipColor(blip) 
    setBlipColor(blip,255,g,b,255) 
    end 
    end 
                
    if isPedDoingTask ( getLocalPlayer (), "TASK_SIMPLE_GOGGLES_OFF" ) then 
    local blip = getElementsByType("blip") 
    local r,g,b,a = getBlipColor(blip) 
    setBlipColor(blip,r,g,b,0) 
    end 
    end 
                        
    end 
      
    addEventHandler( "onClientResourceStop", resourceRoot, 
    function() 
    unbindKey("fire", "down", theGoggle) 
    end 
    ) 
  
addEventHandler("onClientPlayerWasted", localPlayer, 
function () 
local blip = getElementsByType("blip") 
local r,g,b,a = getBlipColor(blip) 
setBlipColor(blip,r,g,b,0) 
end 
end 
) 
  
addEventHandler("onClientPlayerSpawn", localPlayer, 
function () 
local blip = getElementsByType("blip") 
local r,g,b,a = getBlipColor(blip) 
setBlipColor(blip,r,g,b,0) 
end 
end 
) 

In ipairs significa multitud, eso he leido yo.

El 'for-loop' se usa para ejecutar un código a todos los valores/elementos dentro de una tabla.

En esta parte:

local blip = getElementsByType("blip") 
local r,g,b,a = getBlipColor(blip) 
setBlipColor(blip,r,g,b,0) 

'blip' es una tabla, pero getBlipColor y setBlipColor necesitan un elemento 'blip', no una tabla.

Es lo mismo que puse jajaja, mira bn el code, la linea que pusistes sale la misma

Editado: puede que haya entendido, hay que quitar la tabla de local, asi como lo edite?

Link to comment
  • Recently Browsing   0 members

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