Jump to content

Blip Hide


Ma5ter

Recommended Posts

Was trying to make a script that hides my blip but it doesnt hide my blip, nor did it output any chat in the chatbox.

root = getRootElement () 
players = { } 
resourceRoot = getResourceRootElement ( getThisResource () ) 
  
addCommandHandler ( hideme,  
function onResourceStart ( resource ) 
    for id, player in ipairs( getElementsByType ( "player" ) ) do 
        if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
            destroyBlipsAttachedTo ( source ) 
            outputChatBox ( "You are hidden.", source, 255, 255, 255, true ) 
        end 
    end 
end 
true, true) 
  
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

Where found you this code?

addCommandHandler ( hideme,  
function ( ) 
    for id, player in ipairs( getElementsByType ( "player" ) ) do 
    local accName = getAccountName ( getPlayerAccount ( player ) ) 
        if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
            destroyBlipsAttachedTo ( player ) 
            outputChatBox ( "You are hidden.", player, 255, 255, 255, true ) 
        end 
    end 
end) 
  
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 

or only for you:

addCommandHandler ( hideme,  
function ( thePlayer ) 
        local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
        if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
            destroyBlipsAttachedTo ( thePlayer ) 
            outputChatBox ( "You are hidden.", thePlayer, 255, 255, 255, true ) 
        end 
end) 
  
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

Code didnt work, here's the warning, also yeah I got the code from the playerblips resource since i'm still new to this.

WARNING: [gameplay]\bliphider\playerblips.lua:2: Bad arguement @ "addCommandHandler" [Expected String at argument 1, got nil] 

Link to comment
addCommandHandler("hidemyblip", 
    function(player) 
    local account = getPlayerAccount(player) 
        if not isGuestAccount(account) and isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("Admin")) then 
            for index, element in ipairs(getAttachedElements(player)) do 
                if getElementType(element) == "blip" then 
                destroyElement(element) 
                end 
            end 
        outputChatBox("You are now invisible on the radar", player) 
        end 
    end) 

Link to comment

Try This ,

addCommandHandler ( "blip", 
    function ( thePlayer ) 
        for index, element in ipairs ( getAttachedElements ( thePlayer ) ) do 
            if ( getElementType ( element ) == "blip" ) then 
                destroyElement ( element ) 
            end 
        end 
    end 
) 
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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