Skip to content

Create admpw.ktscript #3

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Overfake
Copy link

A script that can be used and customized to troll your players if you see someone who is xraying close to bedrock why not type the command /admpw username_of_xrayer fall 10
it will make username_of_xrayer fall 10 blocs, its an exemple to show you what you can do and how

A script that can be used and customized to troll your players if you see someone who is xraying close to bedrock why not type the command /admpw username_of_xrayer fall 10
it will make username_of_xrayer fall 10 blocs, its an exemple to show you what you can do and how
@randombyte-developer
Copy link
Owner

Cool, thanks! Also can you explain admpw here, it sounds like admin password. Good use of commands, but I will probably change the command execution to using Sponge's methods to remove a block. I guess that's more efficient.

@Overfake
Copy link
Author

Okay here all the explainations :

registerCommand("admpw")  //create a command /admpw (i.e : adminpower)     
permission("admpw.perm") //require admpw permission
arguments(player("player"),string("cmd"),integer("nbtimes"))//need 3 arguments a player, a command type and a number

action(onlyPlayers = false) //can be used in the minecraft server terminal

val p = argument<Player>("player")//retreiving in val p the player argument
val cmd = argument<String>("cmd")

if(cmd.equals("fall"))//if the command is "fall" then 
val command = "execute @a[name=${p.name}] ~ ~ ~ setblock ~ ~-1 ~ air" //the command means : replace with air, just under the player named p.name.
for (x in 0..nbtimes)  // means it will be done nbtimes (the integer argument)
delayTicks(1+(x*3)) // this is very strange but I have a good explanation here : 
// you need to wait for the player to fall before being able to dig further ...
// but delayTicks seems to be working this way : 
// if you call it twice with the same delay it won't work
// you need to wait once and the second time you need to wait longer enough to make it acctually wait
Server.console.executeCommand(command) // executes the command in val command

I hope it helped

@randombyte-developer
Copy link
Owner

Ah, sorry. I meant the pure name admpw. I think admin.troll fits better. I appreciate your effort!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants