How to replace the code?

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

Lukhausen

Active Member
Mar 20, 2017
145
11
18
Those two lines of code cause extreme lag... how can i fix it or replace them?


code_language.skript:
show 10 "FLAME" particles at location of block over block at {property.activebuy::%loop-player%::pos1} for loop-player offset by 0, 2, 0

show a title from "&7{@price}{@money} pro m²" and subtitle "&7Wähle einen zweiten Punkt mit Linksklick aus" to {_p} for 2 seconds and 0 ticks fade in and 0 ticks fadeout
 
code_language.skript:
show 10 "FLAME" particles at location 1 meter above block at location {property.activebuy::%loop-player%::pos1} for loop-player offset by 0, 2, 0
 
Can you show us the whole script.
No Problem :emoji_slight_smile:

code_language.skript:
# {property.owner.%{_p}%} if a player owns anything or not? returns true or nothing
# {property.activebuy::%{_p}%} if a player is in the purchasig action right now or not returns true or nothing/false
# {property.property::owner::ID} returns the owner of a property
# {property.ownerid} the curren id #!DO NOT MODIFY!
# {property.property::ID::*} all the locations of property of one ID
# {property.location::%{_loc}%} returns the owned id of a location
options:
    price: 27
    money: $

command /ProPerty:
    trigger:
        ProPertyMenue(player)
        
function ProPertyMenue(p:player):
    open virtual hopper inventory named "&0ProPerty - Grundstücke" to {_p}
    wait 1 tick
    make a gui slot 0 of {_p} with light gray stained glass pane named "&7" to do nothing
    make a gui slot 2 of {_p} with light gray stained glass pane named "&8" to do nothing
    make a gui slot 4 of {_p} with light gray stained glass pane named "&0P&0ro&0Pe&0rt&0y b&0y L&0u&0k&0ha&0us&0e&0n" to do nothing
    make a gui slot 1 of {_p} with grass block named "&6Kaufe ein neues Grundstück" with lore "||&7&oKlick für weitere Informationen.||&7&oEs wird dadurch noch kein Grundstück gekauft." to close then run function ProPertyBuy({_p})
    if {property.owner.%{_p}%} is set:
        make a gui slot 3 of {_p} with grass block named "&6Verwalte deine Grundstücke" to close then run function ProPertyManage({_p})
    else:
        make a gui slot 3 of {_p} with barrier block named "&7&oVerwalte deine Grundstücke" with lore "||&cDu hast noch keine Grundstücke" to close then run function ProPertyManage({_p})

function ProPertyBuy(p:player):
    set {property.activebuy::%{_p}%} to true
    ProPertyShowMessage({_p})
    stop

function ProPertyManage(p:player):
    #Manage existing Property, sell / rent
    broadcast "something"
    stop

function ProPertyShowMessage(p:player):

    if {property.activebuy::%{_p}%::pos2} is not set:
        if {property.activebuy::%{_p}%::pos1} is not set:
            send {_p} title "&7{@price}{@money} pro m²" with subtitle "&7Wähle einen Startpunkt mit Linksklick" for 2 seconds with 0 ticks fade in and 0 ticks fade out
        else:
            send {_p} title "&7{@price}{@money} pro m²" with subtitle "&7Wähle einen zweiten Punkt mit Linksklick aus" for 2 seconds with 0 ticks fade in and 0 ticks fade out
        stop
    if {property.activebuy::%{_p}%::pos1} is not set:
        send {_p} title "&7{@price}{@money} pro m²" with subtitle "&7Wähle einen zweiten Punkt mit Rechtsklick aus" for 2 seconds with 0 ticks fade in and 0 ticks fade out
        stop
    send {_p} title "&6%({property.activebuy::%{_p}%::lenghtz}*{property.activebuy::%{_p}%::lenghtx})*{@price}%{@money}" with subtitle "&6%({property.activebuy::%{_p}%::lenghtz}*{property.activebuy::%{_p}%::lenghtx})% Quadratmeter" for 2 seconds with 0 ticks fade in and 0 ticks fade out

every second:
    loop all players:
        if {property.activebuy::%loop-player%} is true:
            ProPertyShowMessage(loop-player)
            {property.activebuy::%loop-player%::pos2} is set
            show 30 "FLAME" particles at location of block over block at {property.activebuy::%loop-player%::pos2} for loop-player offset by 0, 3, 0
            {property.activebuy::%loop-player%::pos1} is set
            show 30 "FLAME" particles at location of block over block at {property.activebuy::%loop-player%::pos1} for loop-player offset by 0, 3, 0
            set action bar of loop-player to "&6Preis pro Quadratmeter&7:&6 {@price}{@money} &7- &6zum Kaufen /kaufen tippen"
            loop blocks in radius 20 around loop-player:
                if {property.owner.%rounded x coordinate of loop-block%.%rounded z coordinate of loop-block%} is not set:
                    block over loop-block is air
                    loop-block is not air
                    show 1 "Villager Happy" particles at location of block over loop-block for loop-player offset by 0, 0, 0

function ProPertyCalculate(p:player):
    if z coordinate of {property.activebuy::%{_p}%::pos1} is bigger than z coordinate of {property.activebuy::%{_p}%::pos2}:
        set {property.activebuy::%{_p}%::lenghtz} to z coordinate of {property.activebuy::%{_p}%::pos1} - z coordinate of {property.activebuy::%{_p}%::pos2} +1
    if z coordinate of {property.activebuy::%{_p}%::pos1} is smaller than z coordinate of {property.activebuy::%{_p}%::pos2}:
        set {property.activebuy::%{_p}%::lenghtz} to z coordinate of {property.activebuy::%{_p}%::pos2} - z coordinate of {property.activebuy::%{_p}%::pos1} +1
    if z coordinate of {property.activebuy::%{_p}%::pos1} is equal to z coordinate of {property.activebuy::%{_p}%::pos2}:
        set {property.activebuy::%{_p}%::lenghtz} to 1
    if x coordinate of {property.activebuy::%{_p}%::pos1} is bigger than x coordinate of {property.activebuy::%{_p}%::pos2}:
        set {property.activebuy::%{_p}%::lenghtx} to x coordinate of {property.activebuy::%{_p}%::pos1} - x coordinate of {property.activebuy::%{_p}%::pos2} +1
    if x coordinate of {property.activebuy::%{_p}%::pos1} is smaller than x coordinate of {property.activebuy::%{_p}%::pos2}:
        set {property.activebuy::%{_p}%::lenghtx} to x coordinate of {property.activebuy::%{_p}%::pos2} - x coordinate of {property.activebuy::%{_p}%::pos1} +1
    if x coordinate of {property.activebuy::%{_p}%::pos1} is equal to x coordinate of {property.activebuy::%{_p}%::pos2}:
        set {property.activebuy::%{_p}%::lenghtx} to 1
    ProPertyShowMessage({_p})

on rightclick:
    distance between player and target block is smaller than 4
    {property.activebuy::%player%} is true
    cancel event
    set {property.activebuy::%player%::pos1} to location of target block
    ProPertyCalculate(player)

on leftclick:
    distance between player and target block is smaller than 4
    {property.activebuy::%player%} is true
    set {property.activebuy::%player%::pos2} to location of target block
    cancel event
    ProPertyCalculate(player)
    
command /kaufen:
    trigger:
        if {property.activebuy::%player%} is true:
            if {property.activebuy::%player%::pos1} is set:
                if {property.activebuy::%player%::pos2} is set:
                    #KNETECHECK
                    
                    

                    if {property.ownerid} is not set:
                        set {property.ownerid} to 1
                    else:
                        increase {property.ownerid} by 1
                    message "[DEV] &7Property Number: %{property.ownerid}%"
                    set {property.property::owner::%{property.ownerid}%} to player
                    message "[DEV] &7Planned Owner: %{property.property::owner::%{property.ownerid}%}%"
                    
                    #Lists all the X coordinates of the ProPerty into {_xcords::*}
                    if x coordinate of {property.activebuy::%player%::pos1} is smaller than x coordinate of {property.activebuy::%player%::pos2}:
                        set {_c} to 0
                        loop {property.activebuy::%player%::lenghtx} times:
                            add ((x coordinate of {property.activebuy::%player%::pos1}) + {_c}) to {_xcords::*}
                            add 1 to {_c}
                    if x coordinate of {property.activebuy::%player%::pos1} is greater than x coordinate of {property.activebuy::%player%::pos2}:
                        set {_c} to 0
                        loop {property.activebuy::%player%::lenghtx} times:
                            add ((x coordinate of {property.activebuy::%player%::pos1}) + {_c}) to {_xcords::*}
                            remove 1 from {_c}
                    if x coordinate of {property.activebuy::%player%::pos1} is equal to x coordinate of {property.activebuy::%player%::pos2}:
                        add (x coordinate of {property.activebuy::%player%::pos1}) to {_xcords::*}
                            
                    #Lists all the Z coordinates of the ProPerty into {_zcords::*}
                    if z coordinate of {property.activebuy::%player%::pos1} is smaller than z coordinate of {property.activebuy::%player%::pos2}:
                        set {_c} to 0
                        loop {property.activebuy::%player%::lenghtz} times:
                            add ((z coordinate of {property.activebuy::%player%::pos1}) + {_c}) to {_zcords::*}
                            add 1 to {_c}
                    if z coordinate of {property.activebuy::%player%::pos1} is greater than z coordinate of {property.activebuy::%player%::pos2}:
                        set {_c} to 0
                        loop {property.activebuy::%player%::lenghtz} times:
                            add ((z coordinate of {property.activebuy::%player%::pos1}) + {_c}) to {_zcords::*}
                            remove 1 from {_c}
                    if z coordinate of {property.activebuy::%player%::pos1} is equal to z coordinate of {property.activebuy::%player%::pos2}:
                        add (z coordinate of {property.activebuy::%player%::pos1}) to {_zcords::*}
                    
                    set {_c} to 0
                    loop {_xcords::*}:
                        loop {_zcords::*}:
                            set {_loc} to location of {property.activebuy::%player%::pos1}
                            set x coordinate of {_loc} to loop-value-1
                            set y coordinate of {_loc} to 0
                            set z coordinate of {_loc} to loop-value-2
                            add {_loc} to {property.property::%{property.ownerid}%::*}
                            set {property.location.%{_loc}%} to {property.ownerid}
                            broadcast "&c set {property.location::%{_loc}%} to %{property.ownerid}%"
                            broadcast "[DEV]&7 Registered %{_loc}% for ID %{property.ownerid}%"
                            add 1 to {_c}
                    add {property.ownerid} to {property.owner.%player%::*}
                            
                    message "[DEV]&7 Registered Property %{property.ownerid}% for %{property.property::owner::%{property.ownerid}%}%!"
                    message "[DEV]&7 LOC: {property.location.%{_loc}%} %{property.location.%{_loc}%}%"
                    delete {property.activebuy::*}
                else:
                    message "&cDu hast keine 2. Position markiert!"
                    stop
            else:
                message "&cDu hast keine 1. Position markiert!"
                stop
        else:
            message "&cDu hast kein Grundstück markiert, verwende /ProPerty um eines zu wählen!"
            stop
            
on quit:
    delete {property.activebuy::*}
    
on join:
    delete {property.activebuy::*}
    
on teleport:
    delete {property.activebuy::*}
            
on break:
    set {_loc} to location of block
    set y coordinate of {_loc} to 0
    broadcast "[DEV]&7 Owned by %{property.property::owner::%{property.location.%{_loc}%}%}%"
    
command /info:
    trigger:
        set {_loc} to location of target block
        set y coordinate of {_loc} to 0
        message "ID: %{property.location.%{_loc}%}%"
        send player title "&a&lSkript Title Demo" with subtitle "&7Edit them as you wish!" for 2 seconds with 0 ticks fade in and 0 ticks fade out
 
Status
Not open for further replies.