on join: set the join message to "Oh look, %player% joined! :)"on quit: set the quit message to "Oh no, %player% left! :("on first join: wait 1 second send "Welcome to the server!" to player
Add conditions directly after the event line to filter when the event triggers:
on inventory click: event-slot is the helmet slot of player # Check that player clicked their head slot. inventory action is place all or nothing player has permission "skript.example.helmet" cursor slot of player is custom helmets # Check if the item is in our custom alias. cancel the event set {_old helmet} to the helmet of player set the helmet of player to the cursor slot of player set the cursor slot of player to {_old helmet}
You can create interactive menus using inventory events:
command /chestmenu: permission: skript.example.menu trigger: set {_menu} to a new chest inventory with 1 row named "Simple Menu" set slot 4 of {_menu} to stone named "Button" # Slots are numbered 0, 1, 2... open {_menu} to playeron inventory click: # Listen for players clicking in an inventory. name of event-inventory is "Simple Menu" # Make sure it's our menu. cancel event if index of event-slot is 4: # The button slot. send "You clicked the button." else: send "You didn't click the button."
Here’s a real example from the Skript source demonstrating event filtering and conditions:
## This example allows players to wear specified blocks as hats.# Listens for the clicking in the head slot and, if the player has permission, puts the item on their head.#aliases: # An alias for our allowed hat items. custom helmets = iron block, gold block, diamond blockon inventory click: event-slot is the helmet slot of player # Check that player clicked their head slot. inventory action is place all or nothing player has permission "skript.example.helmet" cursor slot of player is custom helmets # Check if the item is in our custom alias. cancel the event set {_old helmet} to the helmet of player set the helmet of player to the cursor slot of player set the cursor slot of player to {_old helmet}