Jump to content

Need Help with Skript (tpa request type of skript)


Biggdr

Recommended Posts

So i want the ability to do /battle <rank>
but i want the rank to = permission
the whole base idea is to send a battle request to a player with a specific permission (yes everyone with that permission would get that same battle request) and for the person who WAS requested to have the ability to accept or deny the battle request. 
If they player that got requested accepts it, both the players (one that got requested and requester) with get teleported somewhere.
Any idea how i can go about this? 
Example: player1: /battle water
player2: "you have received a battle request, do you want to accept?"
player2: *accepts*
both players: get teleported to arena

Link to comment
Share on other sites

Hey hey! To implement the /battle command in Skript, where the rank is equivalent to a permission, and players can send and accept battle requests, you can use Skript variables, commands, and events. Here's an example of how you can achieve this:

command /battle <string>:
    permission: battle.request
    trigger:
        if player has permission "%arg 1%":
            send "Sending a battle request to all players with the rank %arg 1%!"
            loop all players:
                if loop-player has permission "%arg 1%":
                    send "You have received a battle request from %player%, type /acceptbattle to accept!"
                    set {_battleRequest} to player

command /acceptbattle:
    trigger:
        if {_battleRequest} is set:
            teleport player to arena
            teleport {_battleRequest} to arena
            send "You accepted the battle request from %{_battleRequest}%!"
            set {_battleRequest} to null
        else:
            send "You have no pending battle requests!"

In the above code, the /battle command takes a <string> argument representing the desired rank. It first checks if the player executing the command has the permission battle.request (you can modify it to match your desired permission node). If they have the permission, it sends a battle request to all players who have the same rank (permission).

When a player receives a battle request, they can use the /acceptbattle command to accept it. If there is a pending battle request stored in the variable {_battleRequest}, both players (the requester and the player who accepts) are teleported to the arena location. The {_battleRequest} variable is then reset to null. If there are no pending battle requests, the player will receive a message indicating that.

Please note that you may need to customize the teleportation and arena location based on your server setup.

Feel free to adjust and modify the code to fit your specific needs. Let me know if you have any further questions or requirements!

If I helped you at all please consider boosting my account with the follow button!
Minehut ♥ [VIP] 12/19/2020 - Present

I am either extremely active or not lol.

 

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...