Skip to content

SimpleForm

LSpace edited this page Jul 18, 2024 · 2 revisions
public function sendSimpleForm(Player $player): void {
        $form = (new SimpleForm("Welcome to the Server!", "Do you like this server?", function (Player $player, $data) {
            if($data === null) return;
            switch($data) {
                case 0:
                    $player->sendMessage("You clicked Yes!");
                    break;
                case 1:
                    $player->sendMessage("You clicked No!");
                    break;
            }
        }))
        ->addButton("Yes")
        ->addButton("No");
        $player->sendForm($form);
    }

If you want to attach an image to the Form, do the following:

Example:

->addButton("Yes","https://www.flaticon.com/free-icon/succes_12029181");
->addButton("No","textures\png\image.png");

Clone this wiki locally