Jump to content

getPlayerByName help!??!


Recommended Posts

Right guys,

If I do a command to blowveh using getPlayerByName and you have to be exact with the name e.g blowveh Lloydlogan,

Instead of blowveh Lloyd , what function could I use instead of getPlayerByName?

I tried getPlayerByPartialNick, but it doesn't work???

Thanks Lloyd logan

Link to comment

You may use this function I made for my server:

function getPlayerFromPartOfName ( playerName ) 
    local playerFound = false 
    if ( playerName and type ( playerName ) == "string" ) then  
        if ( getPlayerFromName ( playerName ) ) then 
            return getPlayerFromName ( playerName ) 
        end 
  
        for index, player in ipairs ( getElementsByType ( "player" ) ) do 
            if ( getPlayerName ( player ):lower ( ):find ( playerName:lower ( ), 1, true ) ) then 
                playerFound = player 
                break 
            end 
        end 
    end 
  
    return playerFound 
end 

Link to comment
You may use this function I made for my server:

[lua]function getPlayerFromPartOfName ( playerName )

    local playerFound = false

    if ( playerName and type ( playerName ) == "string" ) then

        if ( getPlayerFromName ( playerName ) ) then

            return getPlayerFromName ( playerName )

        end

 

        for index, player in ipairs ( getElementsByType ( "player" ) ) do

            if ( getPlayerName ( player ):lower ( ):find ( playerName:lower ( ), 1, true ) ) then

                playerFound = player

                break

            end

        end

    end

 

    return playerFound

end

I am confused, how do I put this into my blowveh resource , and if you want I will pm you the resource?

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