No chat to show

This project's files are all here to explore.

Files
WeaponsSmp.sk
Code
1 994
WeaponsSmp.sk
# =====================================================================
# CORE SMP - UTILITIES & POWER SYSTEM (WITH HOMES & PVP)
# =====================================================================

options:
	max_power: 10
	def_power: 0
	min_power: -5
	no_power: true
	deal_less_damage: true
	speed_per_power: 0.02
	rtp_min: -1000
	rtp_max: 1000
	max_homes: 5

# -------------------------------------------------------
# PREFIX & MESSAGE HELPER FUNCTIONS (GRADIENT FIX)
# -------------------------------------------------------
function getPrefix() :: text:
	return "<gradient:#FF6A00:#FFD000><bold>WEAPONS</bold></gradient> <gradient:#F5F5F5:#777777><bold>SMP</bold></gradient> &8» "

function sendMsg(p: player, msg: string):
	send formatted "%getPrefix()%%{_msg}%" to {_p}

function sendBroadcast(msg: string):
	broadcast formatted "%getPrefix()%%{_msg}%"

# -------------------------------------------------------
# 1. ON LOAD & CONFIG SETUP
# -------------------------------------------------------
on load:
	send "" to console
	send "|---------------------------------|" to console
	send "|---      &6&lCoreSMP Loaded     ---|" to console
	send "|---------------------------------|" to console
	
	set {-config.no_power} to {@no_power}
	set {-config.deal_less_damage} to {@deal_less_damage}
	set {-config.speed_per_power} to {@speed_per_power}
	set {-power.weaponsmp} to nautilus shell named "&x&F&F&0&0&0&0&lᴘ&x&E&3&0&0&0&0&lᴏ&x&C&7&0&0&0&0&lᴡ&x&A&B&0&0&0&0&lᴇ&x&8&F&0&0&0&0&lʀ" with lore "&fʀɪɢʜᴛ ᴄʟɪᴄᴋ ᴛᴏ ɢᴀɪɴ &4+1&f ᴘᴏᴡᴇʀ &7(+1 Heart, Damage & Speed)" with custom model data 12345
	register new shaped recipe for {-power.weaponsmp} using enchanted golden apple, netherite ingot, enchanted golden apple, netherite ingot, nether star, netherite ingot, enchanted golden apple, netherite ingot and enchanted golden apple with id "power"

	# Load Custom Death Messages
	clear {data::deathmessages::*}
	add "&c<attacker> &7killed &c<victim>&7." to {data::deathmessages::player::*}
	add "&c<victim> &7was slain by &c<attacker>&7." to {data::deathmessages::player::*}
	add "&c<victim> &7was killed by &c<attacker>&7." to {data::deathmessages::player::*}

	add "&c<victim> &7was killed by drowning." to {data::deathmessages::drowning::*}
	add "&c<victim> &7couldn't breathe under water." to {data::deathmessages::drowning::*}
	add "&c<victim> &7thought they were a fish." to {data::deathmessages::drowning::*}
	add "&c<victim> &7drowned." to {data::deathmessages::drowning::*}

	add "&c<victim> &7was killed by starvation." to {data::deathmessages::starvation::*}
	add "&c<victim> &7ran out of food." to {data::deathmessages::starvation::*}
	add "&c<victim> &7suffered an empty stomach." to {data::deathmessages::starvation::*}
	add "&c<victim> &7starved to death." to {data::deathmessages::starvation::*}

	add "&c<victim> &7was killed by fall damage." to {data::deathmessages::fall::*}
	add "&c<victim> &7fell from a high place." to {data::deathmessages::fall::*}
	add "&c<victim> &7thought they could fly." to {data::deathmessages::fall::*}
	add "&c<victim> &7fell." to {data::deathmessages::fall::*}

	add "&c<victim> &7was killed by lava." to {data::deathmessages::lava::*}
	add "&c<victim> &7tried to swim in the deep fryer." to {data::deathmessages::lava::*}
	add "&c<victim> &7tried to swim in lava." to {data::deathmessages::lava::*}
	add "&c<victim> &7was incinerated." to {data::deathmessages::lava::*}

	add "&c<victim> &7was killed by fire." to {data::deathmessages::burning::*}
	add "&c<victim> &7was turned into ash." to {data::deathmessages::burning::*}
	add "&c<victim> &7forgot their sunscreen." to {data::deathmessages::burning::*}
	add "&c<victim> &7burned to a crisp." to {data::deathmessages::burning::*}
	add "&c<victim> &7burned." to {data::deathmessages::burning::*}

	add "&c<victim> &7was killed by an explosion." to {data::deathmessages::explosion::*}
	add "&c<victim> &7was blown to pieces." to {data::deathmessages::explosion::*}
	add "&c<victim> &7was reduced to ashes." to {data::deathmessages::explosion::*}
	add "&c<victim> &7was blown to smithereens." to {data::deathmessages::explosion::*}
	add "&c<victim> &7exploded." to {data::deathmessages::explosion::*}

	add "&c<victim> &7was killed by suffocation." to {data::deathmessages::suffocation::*}
	add "&c<victim> &7inhaled suspicious substances." to {data::deathmessages::suffocation::*}
	add "&c<victim> &7suffocated to death." to {data::deathmessages::suffocation::*}

	add "&c<victim> &7was killed by poison." to {data::deathmessages::poison::*}
	add "&c<victim> &7couldn't find the antidote." to {data::deathmessages::poison::*}
	add "&c<victim> &7took the wrong substance." to {data::deathmessages::poison::*}
	add "&c<victim> &7was poisoned." to {data::deathmessages::poison::*}

	add "&c<victim> &7withered away." to {data::deathmessages::wither::*}
	add "&c<victim> &7faded away." to {data::deathmessages::wither::*}
	add "&c<victim> &7rotted away." to {data::deathmessages::wither::*}
	add "&c<victim> &7decayed." to {data::deathmessages::wither::*}

	add "&c<victim> &7was crushed by the void" to {data::deathmessages::void::*}
	add "&c<victim> &7sliped into the void" to {data::deathmessages::void::*}
	add "&c<victim> &7fell out of the world" to {data::deathmessages::void::*}

	add "&c<victim> &7was killed." to {data::deathmessages::other::*}
	add "&c<victim> &7died." to {data::deathmessages::other::*}

# -------------------------------------------------------
# 2. POWER & GUI FUNCTIONS
# -------------------------------------------------------
function openTpaMenu(p: player):
	set {_gui} to chest inventory with 3 rows named "Teleport Request"
	set {_slot} to 0
	loop 27 times:
		set slot {_slot} of {_gui} to gray stained glass pane named " "
		add 1 to {_slot}
	set slot 11 of {_gui} to lime wool named "<#FFD000>Accept"
	set slot 15 of {_gui} to red wool named "<#F00000>Deny"
	open {_gui} to {_p}

function executeTeleport(p: player):
	if {request::player::%{_p}'s uuid%} is set:
		set {_other} to {request::player::%{_p}'s uuid%}
		set {_here} to false
		delete {request::player::%{_p}'s uuid%}
	else if {requesthere::player::%{_p}'s uuid%} is set:
		set {_other} to {requesthere::player::%{_p}'s uuid%}
		set {_here} to true
		delete {request::player::%{_p}'s uuid%}
	
	play sound "entity.player.levelup" to {_other}
	play sound "entity.player.levelup" to {_p}
	sendMsg({_p}, "&7Teleport accepted.")
	
	if {_here} is true:
		set {_teleporter} to {_p}
		set {_destination} to {_other}
	else:
		set {_teleporter} to {_other}
		set {_destination} to {_p}
	
	set {_loc} to location of {_teleporter}
	play sound "entity.enderman.teleport" to {_teleporter}
	
	loop 5 times:
		play sound "entity.enderman.teleport" to {_teleporter}
		sendMsg({_teleporter}, "&7Teleporting in <#FFD000>%6 - loop-value% &7seconds. Do not move!")
		sendMsg({_destination}, "&7Player teleporting to you in <#FFD000>%6 - loop-value% &7seconds.")
		if distance between {_loc} and location of {_teleporter} > 0.5:
			sendMsg({_teleporter}, "<#F00000>Teleport cancelled because you moved!")
			sendMsg({_destination}, "<#F00000>Teleport cancelled because the other player moved!")
			stop
		wait 1 second

	teleport {_teleporter} to {_destination}
	sendMsg({_teleporter}, "&7Teleported successfully!")
	sendMsg({_destination}, "&7Player has been teleported to you!")

function invalid_command_message_weaponsmp(p: player):
	send "&cUsage:" to {_p}
	send "&c/power - Check your power" to {_p}
	send "&c/withdraw <amount> - Withdraw your power" to {_p}
	send "&c/pvp - Toggle your PvP status" to {_p}
	send "&c/home <name> - Teleport to your home" to {_p}
	send "&c/sethome <name> - Set a home" to {_p}
	send "&c/delhome <name> - Delete a home" to {_p}
	send "&c/homes - List your homes" to {_p}
	send "&c/rtp - Random teleport" to {_p}
	send "&c/rtpdebug - Toggle RTP debug mode" to {_p}
	send "&c/weaponsmp setpower <player> <amount> - Set player's power" to {_p}
	send "&c/weaponsmp reload - Reload config" to {_p}

function update_power_message(p: player):
	set {_uuid} to {_p}'s uuid
	
	set {_maxHealth} to 10 + {power::%{_uuid}%}
	set {_p}'s max health to {_maxHealth}
	
	set {_speedBonus} to {power::%{_uuid}%} * {-config.speed_per_power}
	set {_finalSpeed} to 0.2 + {_speedBonus}
	if {_finalSpeed} < 0.05:
		set {_finalSpeed} to 0.05
	set walk speed of {_p} to {_finalSpeed}
	
	if {power::%{_uuid}%} > 0:
		send "&x&F&F&0&0&0&0&lʏ&x&F&6&0&0&0&0&lᴏ&x&E&C&0&0&0&0&lᴜ&x&E&3&0&0&0&0&lʀ &x&D&0&0&0&0&0&lɴ&x&C&7&0&0&0&0&lᴇ&x&B&E&0&0&0&0&lᴡ &x&A&B&0&0&0&0&lᴘ&x&A&2&0&0&0&0&lᴏ&x&9&8&0&0&0&0&lw&x&8&F&0&0&0&0&lᴇ&x&8&F&0&0&0&0&lʀ &x&8&F&0&0&0&0&lɪ&x&8&F&0&0&0&0&ls &x&8&F&0&0&0&0&l(&x&8&F&0&0&0&0&l+%{power::%{_uuid}%}%&x&8&F&0&0&0&0&l)" to {_p}
	else if {power::%{_uuid}%} <= 0:
		send "&x&F&F&0&0&0&0&lʏ&x&F&5&0&0&0&0&lᴏ&x&E&B&0&0&0&0&lᴜ&x&E&0&0&0&0&0&lʀ &x&C&C&0&0&0&0&lɴ&x&C&2&0&0&0&0&lᴇ&x&B&8&0&0&0&0&lᴇ&x&B&8&0&0&0&0&lᴡ &x&A&3&0&0&0&0&lᴘ&x&9&9&0&0&0&0&lᴏ&x&8&F&0&0&0&0&lw&x&8&F&0&0&0&0&lᴇ&x&8&F&0&0&0&0&lʀ &x&8&F&0&0&0&0&lɪ&x&8&F&0&0&0&0&ls &x&8&F&0&0&0&0&l(%{power::%{_uuid}%}%&x&8&F&0&0&0&0&l)" to {_p}

function infoGUI(p: player):
	set {_gui} to chest inventory with 3 rows named formatted getPrefix()
	set slot 13 of {_gui} to {-power.weaponsmp}
	open {_gui} to {_p}

# -------------------------------------------------------
# 3. COMMANDS
# -------------------------------------------------------
command /pvp:
	cooldown: 5 seconds
	cooldown message: "<#F00000>You can toggle PvP again soon."
	trigger:
		set {_uuid} to player's uuid
		if {pvp::%{_uuid}%} is not set:
			set {pvp::%{_uuid}%} to true
		
		if {pvp::%{_uuid}%} is true: