Roleplay Name / PVP Toggle Skript

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Swirly

Member
Aug 5, 2018
16
0
1
24
FailRP.PNG
Category: School Roleplay

Suggested name: XSchoolRP

Spigot/Skript Version: 1.8-1.14.3

What I want:
I would like a roleplay name so when a player puts in the command /rpname there would be a name in the tab suffix in yellow and a name in light gray before prefixes. Here is a screenshot to show how I would like it in chat, Don't worry about the yellow writing thats just /me.

I also would like a pvp toggle so when you do /pvp it will toggle it on and off


Ideas for commands: /rpname and /PVP

Ideas for permissions: rpname.use PVP.use

When I'd like it by: Today or Tomorrow
 
I made a skript for the /pvp part. Now, I don't really know if you want pvp to be toggled for individual people, or server-wide (as an admin command), so I made both for you :emoji_slight_smile:

Code:
# If you're an admin, type /pvp to toggle pvp. This will be toggled for everyone.

command /pvp:
    permission: pvptoggle.use
    permission message: "&cYou're not allowed to use this command!"
    trigger:
        if {pvptoggle.status} is true:
            set {pvptoggle.status} to false
            send "&aYou turned off pvp!"
        else:
            set {pvptoggle.status} to true
            send "&aYou turned on pvp!"
on damage of player:
    if attacker is a player:
        if {pvptoggle.status} is false:
            cancel event
            send "&cPVP is currently off!"


Code:
# Players can type /pvp to disable pvp for themselves only. Other players will only be able to attack that person if he has his pvp status on. Players with pvp status off can also not attack other people, even if their pvp status is on.

command /pvp:
    permission: pvptoggle.use
    permission message: "&cYou are not allowed to use this command!"
    trigger:
        if {pvptoggle.%player%} is false:
            set {pvptoggle.%player%} to true
            send "&aYour pvp status is now on! You may attack other players whose pvp status is also on."
        else:
            set {pvptoggle.%player%} to false
            send "&aYour pvp status is now off! You cannot attack other players, and vice versa."
on join:
    set {pvptoggle.%player%} to false
on damage of player:
    if attacker is a player:
        if {pvptoggle.%attacker%} is false:
            cancel event
            send "&cTo attack other players, type /pvp!"
        if {pvptoggle.%attacker%} is true:
            if {pvptoggle.%victim%} is false:
                cancel event
                send "&cThis player has their pvp status off!"
To give players permission for using the /pvp command, use pvptoggle.use.