Help with coordinates

  • 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 community!

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

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Danillka

New Member
Apr 19, 2023
5
0
1
In skript i need send in chat coordinates of player

command calldoctor [<player>] [<number>]:
aliases: cd
permission: calldoctor.use
trigger:
if arg-1 is not set:
send "&cUsage: /calldoctor ник сумма"
if arg-1 is not online:
send "&cPlayer is not online."
if arg-1 is player:
send "&aYour coordinates: here."
if players have permission "doctor":
send "&c"
 
In skript i need send in chat coordinates of player

command calldoctor [<player>] [<number>]:
aliases: cd
permission: calldoctor.use
trigger:
if arg-1 is not set:
send "&cUsage: /calldoctor ник сумма"
if arg-1 is not online:
send "&cPlayer is not online."
if arg-1 is player:
send "&aYour coordinates: here."
if players have permission "doctor":
send "&c"


I am not sure what arg-2 number is or if it has nothing to do with this. Ok a few things here need to be fixed to make this easy for you.

First if you want arg-1 to always be set (Again i am not sure but it seems so in your code) you can remove the square brackets like this

Secondly I recommend adding a description so your not looking at this a week later wondering what that is.

Thirdly you can use Usage: if you require an arg so you don't have to do the check. it will do it for you

Code:
command calldoctor <player> [<number>]:
    description: Does a thing
    usage: "&cUsage: /calldoctor ник сумма"
    aliases: calldoctor.use
    permission: calldoctor.use

Fourthly since arg-1 is type player. arg-1 will always be a player or it will send usage message.

Fifthly unless arg-1 is type offline player it won't work with offline players (not 100% sure)

Lastly here is how you get the coords of a player


Code:
command calldoctor <player> [<number>]:
    description: Does a thing
    usage: "&cUsage: /calldoctor ник сумма"
    aliases: calldoctor.use
    permission: calldoctor.use
    trigger: 
        if arg-1 does not have permission "doctor" :
            set {currentpos::*} to player's location
            send  "&aYour coordinates: here. %{currentpos::*}%"
        if arg-1 does has permission "doctor" :
            send  "&c %{currentpos::*}%"

Please note i assumed you want to send the list of player locations that did that command to the person with doctor permission. if not the code will look like this


Code:
command calldoctor <player> [<number>]:
    description: Does a thing
    usage: "&cUsage: /calldoctor ник сумма"
    aliases: calldoctor.use
    permission: calldoctor.use
    trigger: 
        if arg-1 does not have permission "doctor" :
            set {_currentpos} to player's location
            send  "&aYour coordinates: here. %{_currentpos}%"
 
bruh i cant do this. I want make doctor for server and i dont know how, i have plan, pls someone help:emoji_frowning:
1. Player (who need help) type in chat /calldoctor
2. Players with permission doctor send in chat message " *nickname player who need help* need help, he's coordinates *xyz* " help pls!!
 
bruh i cant do this. I want make doctor for server and i dont know how, i have plan, pls someone help:emoji_frowning:
1. Player (who need help) type in chat /calldoctor
2. Players with permission doctor send in chat message " *nickname player who need help* need help, he's coordinates *xyz* " help pls!!

Ok. I am not here to write your code for you. but i will point you a little further in the correct direction. Let's break the problem down into smaller bits so we can take it on one at a time

  1. We need a command that allows players to do /calldoctor

    Code:
    command calldoctor:
        description: calls a doctor if your injured
        permission: calldoctor.use
         trigger:


  2. We need that command to get the coordinates of that player

    Code:
    set {_currentpos} to player's location



  3. We need that command to send an alert to all players with a specific permission

    Ok this one is a bit harder i assume it will be your first loop so we will walk trough it. here is a video if you don't understand me
Code:
[CODE]loop all players:
              if loop-player has permission "server.doctor":
                  send "Player has requested help at %{_currentpos}%" to loop-player
[/CODE]

Ok at this point i did 99% of the work for you not you gotta put it together and fix indentation as i struggle a bit with tabs on this website

Here are my sources so you can have an easier time

Basically similar Video
How to edit coords. to show the format of the thing
Loop tutorial. how I learned