Lloyd Logan Posted August 8, 2012 Share Posted August 8, 2012 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
Castillo Posted August 8, 2012 Share Posted August 8, 2012 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
Lloyd Logan Posted August 8, 2012 Author Share Posted August 8, 2012 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
Castillo Posted August 8, 2012 Share Posted August 8, 2012 Well, instead of using: getPlayerFromName ( playerName ) in your script, you use: getPlayerFromPartOfName ( playerName ) Link to comment
Lloyd Logan Posted August 8, 2012 Author Share Posted August 8, 2012 Thanks a lot guys Couldn't have done it without you !! Link to comment
Castillo Posted August 9, 2012 Share Posted August 9, 2012 You're welcome. P.S: How exactly Alexs helped . Link to comment
Lloyd Logan Posted August 9, 2012 Author Share Posted August 9, 2012 You're welcome.P.S: How exactly Alexs helped . 1. No Problem 2. When i say thanks i am usually talking to you as you always help me, (Teach me LUA, you are so good at it!!!) 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