Targeted player without looking through the blocks

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

  • LOOKING FOR A VERSION OF SKRIPT?

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

Status
Not open for further replies.

ElgerElg

New Member
Mar 18, 2022
8
0
1
Hi SKriptors! I have a problem. I want to make the player check through "if targeted player is set" but it turns out that you can look at the player through the blocks and it will work. I want to remove it but do not get any options in the head, and those that I thought did not work (such as targeted block is not set). Sorry to help, thanks in advance :emoji_slight_smile::emoji_blush:

Use skript: 2.6 alpha
Server version: 1.12.2

Yes, I know that the support is discontinued on the new versions, but you have to sit on this version. :emoji_confounded:
 
Hi. You could loop blocks between player and target entity, and check if loop-block isn't air or water or lava. Alternatively, you could also be more specific by moving a location forwards by .2 or some small number like that, and checking if there's a block at that location.
 
Hi. You could loop blocks between player and target entity, and check if loop-block isn't air or water or lava. Alternatively, you could also be more specific by moving a location forwards by .2 or some small number like that, and checking if there's a block at that location.
Can you write a code please? :emoji_cold_sweat:
 
First idea:
Code:
loop blocks between player and target entity:
  stop if loop-block isn't air or lava or water
Second:
Code:
loop 50 times:
  set {_loc} to location 1.6 blocks above player's location
  set {_loc} to location 0.1 blocks in front of {_loc}
  stop if {_loc} isn't air or water or lava

Untested since I'm writing this at school right now.
 
First idea:
Code:
loop blocks between player and target entity:
  stop if loop-block isn't air or lava or water
Second:
Code:
loop 50 times:
  set {_loc} to location 1.6 blocks above player's location
  set {_loc} to location 0.1 blocks in front of {_loc}
  stop if {_loc} isn't air or water or lava

Untested since I'm writing this at school right now.
Tnanh you! I will try it! Also if something wrong I will write.
[doublepost=1676822874,1676577156][/doublepost]
First idea:
Code:
loop blocks between player and target entity:
  stop if loop-block isn't air or lava or water
Second:
Code:
loop 50 times:
  set {_loc} to location 1.6 blocks above player's location
  set {_loc} to location 0.1 blocks in front of {_loc}
  stop if {_loc} isn't air or water or lava

Untested since I'm writing this at school right now.
Hello! So this not working. :emoji_frowning:
[doublepost=1676916711][/doublepost]Have you another ideas?
 
Could you post the full code?
Sure. Check this. This script maybe a little stupid hah :emoji_grinning:
Code:
on any movement:
    if player has permission "op":
        stop
    if targeted player has permission "op":
        stop
    if player is not op:
        if targeted player is set:
            if targeted block exist:
                if targeted block is air:
                    if targeted player has permission "alreadyhasrole.scp166":
                        if player doesn't have permission "alreadyhasrole.admin" or "alreadyhasrole.intruder" or "alreadyhasrole.scp066" or "alreadyhasrole.scp049" or "alreadyhasrole.scp008" or "alreadyhasrole.scp008-2" or "alreadyhasrole.scp049" or "alreadyhasrole.scp049-2" or "alreadyhasrole.scp343" or "alreadyhasrole.scp096" or "alreadyhasrole.scp106" or "alreadyhasrole.scp682" or "alreadyhasrole.scp035" or "alreadyhasrole.scp343" or "alreadyhasrole.scp076-2": 
                            if distance between the player and targeted player is smaller than 3:
                                if {scp166loveplayer::%player%} is false:
                                    if {alreadylook::%player%} is not set:
                                        if {scp166loveplayer::%player%} is op:
                                            stop
                                        set {alreadylook::%player%} to true
                                        set {scp166player::%player%} to targeted player
                                        wait 1 tick
                                        message "&c&7[&c&l!&7] &fU looked at %{scp166player::%player%}%" to player
                                        message "&c&7[&c&l!&7] &fOn you looked %player%" to {scp166player::%player%}[/CODE}
[doublepost=1677096032,1677095819][/doublepost]Where
Code:
if targeted block exist: 
if targeted block is air:
this I trying a check on targeted block. Also your solutions tried and they didn't work :emoji_frowning:
 
I wanted to see the code to see where you were implementing it. Specifically, the second option would take place of lines 9 and 10.
Line 10 prevents the code from being run, since target block won't return anything if it's air. Line 9 also only runs *if* there's a target block, which it sounds like isn't the goal here.
Oh, and when it comes to the second option, I made a bit of a mistake that likely led to it not working. It would be the block at {_loc}, not just {_loc}. Edited version:
Code:
loop 50 times:
  set {_loc} to location 1.6 blocks above player's location
  set {_loc} to location 0.1 blocks in front of {_loc}
  stop if block at {_loc} isn't air or water or lava
Are there any errors? Forgot to ask that initially.
 
I wanted to see the code to see where you were implementing it. Specifically, the second option would take place of lines 9 and 10.
Line 10 prevents the code from being run, since target block won't return anything if it's air. Line 9 also only runs *if* there's a target block, which it sounds like isn't the goal here.
Oh, and when it comes to the second option, I made a bit of a mistake that likely led to it not working. It would be the block at {_loc}, not just {_loc}. Edited version:
Code:
loop 50 times:
  set {_loc} to location 1.6 blocks above player's location
  set {_loc} to location 0.1 blocks in front of {_loc}
  stop if block at {_loc} isn't air or water or lava
Are there any errors? Forgot to ask that initially.
Hi. Anyway, putting your code I can still "fall in love" through walls. Maybe I’m doing something wrong. :emoji_frowning:
 
Status
Not open for further replies.