• find player function
    4 replies, posted
Here is what i have, [CODE] function TOKEN.findPlayer(name) for k,v in pairs(player.GetAll()) do if string.find(name,v:Nick()) then return v end end return false end [/CODE] How would i make it recognize "EzGunz" as the player "EzGunzBlazzinn" ? or "TheS" as the player "ShankyTheSloth"? EDITED
Also, convert both strings to lower case before checking.
[CODE] function TOKEN.findPlayer(name) for k,v in pairs(player.GetAll()) do if string.find(string.lower( v:Nick() ), string.lower( name )) then return v end end return false end [/CODE] I don't think this is how you do it but how would i check if the return is = to 1? Sorry i'm still handling this lua stuff. Thanks for the help aswell
You would just check if the return exists -- your code looks fine.
Sorry, you need to Log In to post a reply to this thread.