• Searching Strings
    3 replies, posted
Hi, I want to do something like this. [CODE]if ply:Nick() HAS THE STRING "HI" IN IT then do X[/CODE] What is the best, cleanest approach? (I'm trying to get an action to occur if a player's name has a clantag in it)
[code]if string.find(ply:Nick(), "HI") then x() end[/code]
Cheers
I'd also recommend doing something along the lines of wrapping Player:Nick( ) with string.lower( ) in order to ensure simple case alterations cause an error in detection, unless of course you're looking for an ExAcT cAsE-sEnSiTiVe match. [lua]local _bFind = string.find( string.lower( Player:Nick( ) ), "hi" ); if ( _bFind ) then // Logic else // Logic end[/lua] If your question has been answered, please feel free to mark the topic as solved in the top left corner next to reply to avoid confusion :-)
Sorry, you need to Log In to post a reply to this thread.