Jump to content

Ignore


WhoAmI

Recommended Posts

function getPlayerFromNamePart(name) 
    local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil 
    if name then 
        for _, player in ipairs(getElementsByType("player")) do 
            local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() 
            if name_:find(name, 1, true) then 
                return player 
            end 
        end 
    end 
end 
  
addCommandHandler ( "ignore", 
    function ( player, cmd, nick ) 
        if ( tostring ( nick ) ) then 
            local ignored =  getPlayerFromNamePart(nick ) 
            if ( isElement ( ignored ) and getElementType ( ignored ) == "player" ) then 
                local ignorowani = getElementData ( player, "ignorowani" ) 
                if ( ignorowani [ ignored ] ) then 
                    ignorowani [ ignored ] = nil 
                    outputChatBox ( "unignored", player, 255, 255, 255, true ) 
                else 
                    ignorowani [ ignored ] = true 
                    outputChatBox ( "ignored", player, 255, 255, 255, true ) 
                end 
                setElementData ( player, "ignorowani", ignorowani ) 
            else 
                outputChatBox ( "no player", player, 255, 0, 0, true ) 
            end 
        else 
            outputChatBox ( "no nick", player, 255, 0, 0, true ) 
        end 
    end 
) 

Idk how does your system works but anyway you'll need to use https://wiki.multitheftauto.com/wiki/Ge ... omNamePart .

EDIT: Seems I'm a little late. :D

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