So I'm working on a plugin that checks the item name and then checks for a certian word, this piece of code doesnt work, but doesnt throw any errors. Anyways here: PHP: if($it->getNamedTag() == $it->getName()."\nWhatEverYouWantToNameThisItem"){
dawg, then it checks for just "YourItemName", im trying to check it for a certain word, but have other words in the item name
What do you mean with other words in the Item name? Like this? Name1\n Word2\n Word3 Or do u have an array with words?
Than use this: PHP: $words = "Word1\n Word2"; //$words = $item->getName();$word = "Word1"if( strpos( $words, $word ) !== false ) { //Word is in the Name!}
No. I tried to post it with more details PHP: $words = $item->getName(); //The item name$word = "Word1" //Word u want to search in the Item nameif( strpos( $words, $word ) !== false ) { //Checks if the the word in $word is in the item name ($words) //Word is in the Name!}
Yes, but the method is the same. Also, if anyone creating a plugin doesn't know what an if/strpos statement does they need to go back to learning basic PHP.
gonne be honest here, i never even studied php, i just looked at plugins and the functions and how they work
That's fine - a lot of people do that, but it'll help you a lot in the future if you just go back to the basics and learn PHP properly.