Jump to content

[Ayuda] Blips con NighVision


Narutimmy

Recommended Posts

getCameraGoggleEffect 

fijate si eso anda

Eso no sirve,... Ya pasé por allí

Prueba con ésto:

Client side:

addEventHandler( "onClientResourceStart", resourceRoot, 
        function() 
        bindKey("fire", "down", theGoggle) 
        end 
    ) 
  
function theGoggle() 
        local weaponID = getPedWeapon (getLocalPlayer ()) 
                -- Puedes poner 44 o 45, ya sea nightvision o infrared vision 
        if weaponID == 44 then 
        setTimer (playerGoggles, 50, 0 ) 
        end 
end 
  
function playerGoggles() 
  
                if isPedDoingTask ( getLocalPlayer (), "TASK_SIMPLE_GOGGLES_ON" ) then 
                    -- Aqui vas a poner lo que va a suceder 
                end 
         
                if isPedDoingTask ( getLocalPlayer (), "TASK_SIMPLE_GOGGLES_OFF" ) then 
                                       -- Aqui vas a eliminar lo que sucedió 
                end 
                 
    end 

este s el scrip que muestra los blips, como lo uso?

-- needs configurable blip colors, and team support 
root = getRootElement () 
color = { 0, 255, 0 } 
players = {} 
resourceRoot = getResourceRootElement ( getThisResource () ) 
  
function onResourceStart ( resource ) 
    for id, player in ipairs( getElementsByType ( "player" ) ) do 
        if ( players[player] ) then 
            createBlipAttachedTo ( player, 0, 2, players[source][1], players[source][2], players[source][3] ) 
        else 
            createBlipAttachedTo ( player, 0, 2, color[1], color[2], color[3] ) 
        end 
    end 
end 
  
function onPlayerSpawn ( spawnpoint ) 
    if ( players[source] ) then 
        createBlipAttachedTo ( source, 0, 2, players[source][1], players[source][2], players[source][3] ) 
    else 
        createBlipAttachedTo ( source, 0, 2, color[1], color[2], color[3] ) 
    end 
end 
  
function onPlayerQuit () 
    destroyBlipsAttachedTo ( source ) 
end 
  
function onPlayerWasted ( totalammo, killer, killerweapon ) 
    destroyBlipsAttachedTo ( source ) 
end 
  
function setBlipsColor ( source, commandName, r, g, b ) 
    if ( tonumber ( b ) ) then 
        color = { tonumber ( r ), tonumber ( g ), tonumber ( b ) } 
        for id, player in ipairs( getElementsByType ( "player" ) ) do 
            destroyBlipsAttachedTo ( player ) 
            if ( players[player] ) then 
                createBlipAttachedTo ( player, 0, 2, players[source][1], players[source][2], players[source][3] ) 
            else 
                createBlipAttachedTo ( player, 0, 2, color[1], color[2], color[3] ) 
            end 
        end 
    end 
end 
  
function setBlipColor ( source, commandName, r, g, b ) 
    if ( tonumber ( b ) ) then 
        destroyBlipsAttachedTo ( source ) 
        players[source] = { tonumber ( r ), tonumber ( g ), tonumber ( b ) } 
        createBlipAttachedTo ( source, 0, 2, players[source][1], players[source][2], players[source][3] ) 
    end 
end 
  
addCommandHandler ( "setblipscolor", setBlipsColor ) 
addCommandHandler ( "setblipcolor", setBlipColor ) 
addEventHandler ( "onResourceStart", resourceRoot, onResourceStart ) 
addEventHandler ( "onPlayerSpawn", root, onPlayerSpawn ) 
addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) 
addEventHandler ( "onPlayerWasted", root, onPlayerWasted ) 
  
function destroyBlipsAttachedTo(player) 
    local attached = getAttachedElements ( player ) 
    if ( attached ) then 
        for k,element in ipairs(attached) do 
            if getElementType ( element ) == "blip" then 
                destroyElement ( element ) 
            end 
        end 
    end 
end 

Link to comment
Trata de hacer lo de los blips por client, no por server y luego lo unes con mi script.

Y usa el Alpha lo puedes cambiar en 0 y ponerlo en 255

Intente esto pero no funciono :/

---google 
  
addEventHandler( "onResourceStart", resourceRoot, 
        function() 
        bindKey("fire", "down", theGoggle) 
        end 
    ) 
  
function theGoggle() 
        local weaponID = getPedWeapon (getLocalPlayer ()) 
                -- Puedes poner 44 o 45, ya sea nightvision o infrared vision 
        if weaponID == 44 then 
        setTimer (playerGoggles, 50, 0 ) 
        end 
end 
  
function playerGoggles() 
  
                if isPedDoingTask ( getLocalPlayer (), "TASK_SIMPLE_GOGGLES_ON" ) then 
                    -- Aqui vas a poner lo que va a suceder 
                    destroyBlipsAttachedTo ( source ) 
                end 
        
                if isPedDoingTask ( getLocalPlayer (), "TASK_SIMPLE_GOGGLES_OFF" ) then 
                                       -- Aqui vas a eliminar lo que sucedió 
                                        
                   createBlipAttachedTo ( source, 0, 2, color[1], color[2], color[3] ) 
                end 
                
    end 

Link to comment
Pruebalo así, talvez funcione bien,... debes hacerlo con la visión nocturna (weapon id 44)
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,r,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 
) 

Fuunciono casi perfecto >.< tengo un pequeño bug... si mueren con las gafas puestas aun pueden ver los blips

Link to comment

Prueba esto:

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,r,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",resourceRoot, 
function() 
for _,blip in ipairs(getElementsByType("blip")) do 
setBlipColor(blip,0,0,0,0) 
end 
) 

Link to comment
Prueba esto:
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,r,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",resourceRoot, 
function() 
for _,blip in ipairs(getElementsByType("blip")) do 
setBlipColor(blip,0,0,0,0) 
end 
) 

También que lo use en el evento onClientPlayerSpawn, para evitar cualquier bug.

tengo un problema al agregar lo que puso xperia deja de funcionar :/

Link to comment
Prueba esto:
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,r,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",resourceRoot, 
function() 
for _,blip in ipairs(getElementsByType("blip")) do 
setBlipColor(blip,0,0,0,0) 
end 
) 

También que lo use en el evento onClientPlayerSpawn, para evitar cualquier bug.

tengo un problema al agregar lo que puso xperia deja de funcionar :/

le faltaba un end :3

Link to comment
  • Recently Browsing   0 members

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