pro-mos Posted March 9, 2016 Share Posted March 9, 2016 I know about the function getPlayerFromName but it requires to enter the full name of player. How can i get player name when i give the function only a part from name or a middle part in his name? Link to comment
SpecT Posted March 9, 2016 Share Posted March 9, 2016 function getPlayerFromNamePart ( name ) 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 ( tostring ( name ):lower ( ), 1, true ) then return player end end end end Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now