Jump to content

PvP Money transfer Skript (Killer gets Victims Money)


Skramonk

Recommended Posts

Hi Everyone!

I'm a very new Skripter who still has a lot to read and a lot to learn!

My current dilemma is creating a PvP system where a Player can kill another player and take some of their money for killing them. The amount taken is shown to both the killer and victim. The amount taken is constant, until a victim has less than the amount, in which case their account is drained to zero - the killer gets the remaining money, but if they kill a player with $0 they get nothing! In other words:

Player kills victim with $600, Player gets $500, victim loses $500.

Player kills same victim (now with $100), Player gets $100, Victim loses $100

Player kills same victim again (now with $0), Player gets $0, Victim has nothing to lose so stays at $0.

I would like to maybe implement that killing a player takes a Percentage of their balance, that way it ecourages killing rich players and ignoring poor ones.

Killing player with $1000 gives $750, Killing player with $10 gives $7.50 and so on...

I was wondering if a skript similar to this exists or if anyone is willing to make one or send me the groundwork for such a skript.

Thanks everyone!

Link to comment
Share on other sites

  • 2 weeks later...

You could try something like this:

options:
	# Config! #
	constant: 75 # this number is the percentage of your balance a player will take
	round: up # this value can be set to either up, down, or none
	void: true # set this value to false if you don't want players to lose money if they die of natural causes (hunger, fall dmg, etc)

on death:
	victim is a player
	{@void} = false:
		attacker is a player
		set {_amount} to (player's balance * 0.{@constant})
		"{@round}" = "up":
			set {_amount} to ceil({_amount})
		"{@round}" = "down":
			set {_amount} to floor({_amount})
		remove {_amount} from victim's balance
		add {_amount} to attacker's balance
		send "&a&l! &fYou killed &a%victim% &fand recieved &6$%{_amount}%&f!" to attacker
		send "&c&l! &fYou died to &c%attacker% &fand lost &6$%{_amount}%&f!" to victim
	else:
		set {_amount} to (player's balance * 0.{@constant})
		"{@round}" = "up":
			set {_amount} to ceil({_amount})
		"{@round}" = "down":
			set {_amount} to floor({_amount})
		remove {_amount} from victim's balance
		attacker is a player:
			add {_amount} to attacker's balance
			send "&a&l! &fYou killed &a%victim% &fand recieved &6$%{_amount}%&f!" to attacker
			send "&c&l! &fYou died to &c%attacker% &fand lost &6$%{_amount}%&f!" to victim
		else:
			send "&c&l! &fYou died and lost &6$%{_amount}%&f!" to victim

You can change the values up the top for ease of use.

If this helped like (💙) the comment! It doesn't seem like much but it motivates me to help more!

Minecraft Ranks
[DEFAULT] - 9th October 2020
[PRO] - 21st November 2020
[PATRON] - 27th October 2021

Proficiency
Python - 8 Years
C/C++ - 5 Years
Skript - 4 Years
Javascript - 3 Year
Java - 1 Year

Links
Discord - kegnh#1234

 
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...