Hey, I want to search for a word in a Message(PlayerChatEvent) but I don't know how. I would have done something like PHP: if(str_contain("Hey")){} but that doesn't exist. Do you have a way to do it? EDIT: Found a way
PHP: // This is in PlayerChatEvent, so $message = $event->getMessage();$word1 = "hey"; $search = strpos($message, $word1); if ($search === false) { // Word $word1 not found in $message } else { // Word found in $message, the Position of it is $search }
Exactly... This is a forum for get help, but the 90% of times you only get people saying "Learn PHP".
yes, @shoghicp translated PHP bin file, so we don't think everything about PHP is there. somethings changed, like when he told us don't do ?> (PHP close tag) with the API.
strpos is a PHP function, not PM API. Because it is true Trivia: I never said that before. ^_^ PM is mostly OOP, so learning for web development won't work.
Does the API have its own language?, No. So learn PHP before learning the API or you won't understand the API.
Can we stop arguing about this and stop telling people to learn PHP, if you came to the forums looking for help and all you got was "Go learn PHP and the PocketMine API" you would be pretty pissed.
Yes it is annoying when people spam it for no reason. I used to get annoyed by it too. But if @PEMapModder and @Gamecrafter hadn't tell me to "Learn PHP" and provided links to my problems I wouldnt know some of the stuff i know today