Staff Pick: Marriage Script
By
Gershon12Created: 2017/05/02 17:18:09 UTC-07:00 (7 years and 236 days ago)
Edited: 2017/05/02 17:18:09 UTC-07:00 (7 years and 236 days ago)
Likes: 2
Staff pick as of: 2017/05/02 20:16:38 UTC-07:00 (7 years and 236 days ago)
Denizen Version: Denizen 101
Script Version: 1
Description:
This script allows you to marry other players in-game.
Commands:
/marry (name)
/marry info - Your info
/marry info (player) - Lookup a players info
/marry divorce - Divorce a player
/marry tp - Teleport to a player you are married to
Download script |
View raw scriptmarry_command_handler:
type: command
debug: false
name: marry
description: Marriage
usage: /marry
script:
- choose <context.args.get[1]||null>:
- case help:
- inject locally path:help
- case accept:
- inject locally path:accept
- case deny:
- inject locally path:deny
- case decline:
- inject locally path:deny
- case divorce:
- inject locally path:divorce
- case info:
- inject locally path:info
- case tp:
- inject locally path:tp
- default:
- inject locally path:player
help:
- narrate "<&l><&a>------------- Marriage Help -------------"
- narrate "<&a>/marry (player) <&r>- <&7> Request a player to marry you"
- narrate "<&a>/marry divorce <&r>- <&7> Divorce the person you are married to"
- narrate "<&a>/marry tp <&r>- <&7> Teleport to your partner"
- narrate "<&a>/marry info <&r>- <&7> Information about your marriage"
- narrate "<&a>/marry info (player)<&r>- <&7> Marriage information about another player"
- narrate "<&l><&a>-----------------------------------------"
player:
- if <player.has_flag[partner]> {
- narrate "<&c>You are already married!"
- queue clear
}
- define target <server.match_player[<context.args.get[1]||null>]||null>
- if <def[target]> == null {
- narrate "<&c>That person is not online!"
- queue clear
}
- if <def[target].has_flag[partner]> {
- narrate "<&c>That person is already married!"
- queue clear
}
- flag <def[target]> marriage_request:<player.name> duration:1m
- define playername <def[target].name||null>
- narrate "<&a>You have requested <def[playername]> to marry you!"
- narrate "<&a><player.name> has requested to marry you!" targets:<def[target]>
- narrate "<&a>Use <&e>/marry accept <&a>or <&c>/marry deny" targets:<def[target]>
accept:
- if <player.has_flag[marriage_request].not> {
- narrate "<&c>You do not have any marriage requests!"
- queue clear
}
- define target <player.flag[marriage_request]||null>
- if <def[target]> == null {
- narrate "<&c>That person is not online!"
- queue clear
}
- if <def[target].has_flag[partner]> {
- narrate "<&c>That person is already married!"
- queue clear
}
- flag p@<def[target]> date_married:<util.date>
- flag player date_married:<util.date>
- flag p@<def[target]> partner:<player.name>
- flag player partner:<def[target]>
- flag p@<def[target]> marriage_points:0
- flag player marriage_points:0
- narrate "<&a>You are now married to <def[target]>."
- narrate "<&a>You are now married to <player.name>." targets:p@<def[target]>
- execute as_server "broadcast <&a><&l><player.name> and <def[target]> are now married!"
deny:
- if <player.has_flag[marriage_request].not> {
- narrate " <&c>You do not have any marriage requests!"
- queue clear
}
- define target <player.flag[marriage_request]||null>
- if <def[target]> == null {
- narrate "<&c>That person is not online!"
- queue clear
}
- narrate "<&a>You have declined the marriage request from <def[target]>."
- narrate " <&a><player.name> has declined your marriage request." targets:p@<def[target]>
divorce:
- if <player.has_flag[partner].not> {
- narrate "<&c>You are not married!"
- queue clear
}
- define target <player.flag[partner]||null>
- if <def[target]> == null {
- narrate "<&c>That person is not online!"
- queue clear
}
- flag p@<def[target]> partner:!
- flag player partner:!
- flag p@<def[target]> date_married:!
- flag player date_married:!
- flag p@<def[target]> marriage_points:!
- flag player marriage_points:!
- narrate "<&a>You have divorced from <def[target]>."
- narrate "<&a><player.name> has divorced from you!" targets:p@<def[target]>
info:
- narrate "<&l><&a>------------- Marriage Info -------------"
- if <context.args.get[2]||null> != null {
- define target <server.match_offline_player[<context.args.get[2]||null>]||null>
- narrate "<&a><context.args.get[2]> is married to:<&e> <def[target].flag[partner]||no one :(>"
- if <def[target].has_flag[date_married]> {
- narrate "<&a>Date married:<&e> <def[target].flag[date_married]>"
- narrate "<&a>Marriage points:<&e> <def[target].flag[marriage_points]>"
}
- narrate "<&l><&a>-----------------------------------------"
- queue clear
}
- narrate "<&a>You are married to:<&e> <player.flag[partner]||no one :(>"
- if <player.has_flag[date_married]> {
- narrate "<&a>Date married:<&e> <player.flag[date_married]>"
- narrate "<&a>Marriage points:<&e> <player.flag[marriage_points]>"
}
- narrate "<&l><&a>-----------------------------------------"
tp:
- if <player.has_flag[partner].not> {
- narrate "<&c>You are not married!"
- queue clear
}
- narrate "<&a>You have teleport to <player.flag[partner]>."
- execute as_op "tp <player.flag[partner]>"
- narrate "<&a><player.name> has teleported to you!" targets:p@<player.flag[partner]>
View History