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

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved How can I use less ram

Discussion in 'Skript' started by MrSnowy, Sep 9, 2021.

Thread Status:
Not open for further replies.
  1. MrSnowy

    MrSnowy New Member

    Joined:
    Sep 7, 2021
    Messages:
    9
    Likes Received:
    0
    I have a gens skript which is working perfectly fine and everything is good, the only problem is, is that it uses too much ram and I can't start my server because of it. Can anyone tell how I can make it take less ram? Thank you. The skript is probably not professional because I am just a beginner at skripting. Please tell me if I can make it take less ram and if so how. This is code:
    Code (Text):
    1. command /wheatgen:
    2.     permission: op
    3.     permission message: "&4You are not allowed to do that!"
    4.     trigger:
    5.         give player hay block named "&eWheat Gen"
    6.      
    7. command /pumpkingen:
    8.     permission: op
    9.     permission message: "&4You are not allowed to do that!"
    10.     trigger:
    11.         give player pumpkin named "&6Pumpkin Gen"
    12.      
    13. command /coalgen:
    14.     permission: op
    15.     permission message: "&4You are not allowed to do that!"
    16.     trigger:
    17.         give player coal block named "&8Coal Gen"
    18.      
    19. command /irongen:
    20.     permission: op
    21.     permission message: "&4You are not allowed to do that!"
    22.     trigger:
    23.         give player iron block named "&fIron Gen"
    24.      
    25. command /goldgen:
    26.     permission: op
    27.     permission message: "&4You are not allowed to do that!"
    28.     trigger:
    29.         give player gold block named "&6Gold Gen"
    30.  
    31. command /lapisgen:
    32.     permission: op
    33.     permission message: "&4You are not allowed to do that!"
    34.     trigger:
    35.         give player lapis block named "&9Lapis Gen"
    36.  
    37. command /redstonegen:
    38.     permission: op
    39.     permission message: "&4You are not allowed to do that!"
    40.     trigger:
    41.         give player redstone block named "&cRedstone Gen"
    42.      
    43. command /diamondgen:
    44.     permission: op
    45.     permission message: "&4You are not allowed to do that!"
    46.     trigger:
    47.         give player diamond block named "&bDiamond Gen"
    48.  
    49. command /emeraldgen:
    50.     permission: op
    51.     permission message: "&4You are not allowed to do that!"
    52.     trigger:
    53.         give player emerald block named "&2Emerald Gen"
    54.      
    55. command /obsidiangen:
    56.     permission: op
    57.     permission message: "&4You are not allowed to do that!"
    58.     trigger:
    59.         give player obsidian named "&8Obsidian Gen"
    60.      
    61. command /gencapreset [<player>]:
    62.     permission: op
    63.     permission message: "&4You can't execute this command!"
    64.     trigger:
    65.         if arg-1 is set:
    66.             if arg-1 is a player:
    67.                 send "&bYou have reset %arg-1% &bgenacp" to player
    68.                 set {gens::%arg-1's uuid%} to 0
    69.      
    70. command /gens <player>:
    71.     trigger:
    72.         if arg-1 is set:
    73.             send "&b%arg-1% &bplaced %{gens::%arg-1's uuid%}% &bgens!" to player
    74.         else:
    75.             send "&bYou have placed %{gens::%player's uuid%}% &bgens!" to player
    76.  
    77. on place of hay block:
    78.     if name of player's held item contains "&eWheat Gen":
    79.         if {gens::%player's uuid%} < 10:
    80.             set {%event-block%.owner} to player
    81.             add 1 to {gens::%player's uuid%}
    82.             add location of event-block to {placed::gens::%player's uuid%::*}
    83.             send action bar "&bYou placed a wheat gen!" to player
    84.         else:
    85.             cancel event
    86.             send action bar "&cYou have reached the max gens you can place!" to player
    87.      
    88. on left click on hay block:
    89.     Loop all players:
    90.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    91.             if player is sneaking:
    92.                 if {%event-block%.owner} is set:
    93.                     if {%event-block%.owner} is not player:
    94.                         cancel event
    95.                         send action bar "&cYou are not the owner of this gen!" to player
    96.                     else:
    97.                         cancel event
    98.                         set event-block to air
    99.                         remove 1 from {gens::%player's uuid%}
    100.                         remove location of event-block from {placed::gens::%player's uuid%::*}
    101.                         send action bar "&cYou broke a wheat gen!" to player
    102.                         give player hay block named "&eWheat Gen"
    103.             else:
    104.                 cancel event
    105.                 send action bar "&bTo break a gen you need to be shifting." to player
    106.          
    107. on right click on hay block:
    108.     Loop all players:
    109.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    110.             if player is sneaking:
    111.                 if {%event-block%.owner} is set:
    112.                     if {%event-block%.owner} is not player:
    113.                         send action bar "&cYou are not the owner of this gen!" to player
    114.                     else if player's balance >= 500:
    115.                         wait 10 ticks
    116.                         set event-block to pumpkin
    117.                         send action bar "&bYou upgraded a gen!" to player
    118.                     else:
    119.                         send action bar "&bYou need %500 - player's balance%&a$ &bmore to upgrade the gen" to player
    120. on place of pumpkin:
    121.     if name of player's held item contains "&6Pumpkin Gen":
    122.         if {gens::%player's uuid%} < 10:
    123.             set {%event-block%.owner} to player
    124.             add 1 to {gens::%player's uuid%}
    125.             add location of event-block to {placed::gens::%player's uuid%::*}
    126.             send action bar "&bYou placed a pumpkin gen!" to player
    127.         else:
    128.             cancel event
    129.             send action bar "&cYou have reached the max gens you can place!" to player
    130.      
    131. on left click on pumpkin:
    132.     Loop all players:
    133.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    134.             if player is sneaking:
    135.                 if {%event-block%.owner} is set:
    136.                     if {%event-block%.owner} is not player:
    137.                         cancel event
    138.                         send action bar "&cYou are not the owner of this gen!" to player
    139.                     else:
    140.                         cancel event
    141.                         set event-block to air
    142.                         remove 1 from {gens::%player's uuid%}
    143.                         remove location of event-block from {placed::gens::%player's uuid%::*}
    144.                         send action bar "&cYou broke a pumpkin gen!" to player
    145.                         give player pumpkin named "&6Pumpkin Gen"
    146.             else:
    147.                 cancel event
    148.                 send action bar "&bTo break a gen you need to be shifting." to player
    149.              
    150. on right click on pumpkin:
    151.     Loop all players:
    152.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    153.             if player is sneaking:
    154.                 if {%event-block%.owner} is set:
    155.                     if {%event-block%.owner} is not player:
    156.                         send action bar "&cYou are not the owner of this gen!" to player
    157.                     else:
    158.                         wait 10 ticks
    159.                         set event-block to coal block
    160.                         send action bar "&bYou upgraded a gen!" to player
    161.          
    162. on place of coal block:
    163.     if name of player's held item contains "&8Coal Gen":
    164.         if {gens::%player's uuid%} < 10:
    165.             set {%event-block%.owner} to player
    166.             add 1 to {gens::%player's uuid%}
    167.             add location of event-block to {placed::gens::%player's uuid%::*}
    168.             send action bar "&bYou placed a coal gen!" to player
    169.         else:
    170.             cancel event
    171.             send action bar "&cYou have reached the max gens you can place!" to player
    172.      
    173. on left click on coal block:
    174.     Loop all players:
    175.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    176.             if player is sneaking:
    177.                 if {%event-block%.owner} is set:
    178.                     if {%event-block%.owner} is not player:
    179.                         cancel event
    180.                         send action bar "&cYou are not the owner of this gen!" to player
    181.                     else:
    182.                         cancel event
    183.                         set event-block to air
    184.                         remove 1 from {gens::%player's uuid%}
    185.                         remove location of event-block from {placed::gens::%player's uuid%::*}
    186.                         send action bar "&cYou broke a coal gen!" to player
    187.                         give player coal block named "&8Coal Gen"
    188.             else:
    189.                 cancel event
    190.                 send action bar "&bTo break a gen you need to be shifting." to player
    191.  
    192. on right click on coal block:
    193.     Loop all players:
    194.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    195.             if player is sneaking:
    196.                 if {%event-block%.owner} is set:
    197.                     if {%event-block%.owner} is not player:
    198.                         send action bar "&cYou are not the owner of this gen!" to player
    199.                     else:
    200.                         wait 10 ticks
    201.                         set event-block to iron block
    202.                         send action bar "&bYou upgraded a gen!" to player
    203.          
    204. on place of iron block:
    205.     if name of player's held item contains "&fIron Gen":
    206.         if {gens::%player's uuid%} < 10:
    207.             set {%event-block%.owner} to player
    208.             add 1 to {gens::%player's uuid%}
    209.             add location of event-block to {placed::gens::%player's uuid%::*}
    210.             send action bar "&bYou placed an iron gen!" to player
    211.         else:
    212.             cancel event
    213.             send action bar "&cYou have reached the max gens you can place!" to player
    214.          
    215. on left click on iron block:
    216.     Loop all players:
    217.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    218.             if player is sneaking:
    219.                 if {%event-block%.owner} is set:
    220.                     if {%event-block%.owner} is not player:
    221.                         cancel event
    222.                         send action bar "&cYou are not the owner of this gen!" to player
    223.                     else:
    224.                         cancel event
    225.                         set event-block to air
    226.                         remove 1 from {gens::%player's uuid%}
    227.                         remove location of event-block from {placed::gens::%player's uuid%::*}
    228.                         send action bar "&cYou broke an iron gen!" to player
    229.                         give player iron block named "&fIron Gen"
    230.             else:
    231.                 cancel event
    232.                 send action bar "&bTo break a gen you need to be shifting." to player
    233.          
    234. on right click on iron block:
    235.     Loop all players:
    236.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    237.             if player is sneaking:
    238.                 if {%event-block%.owner} is set:
    239.                     if {%event-block%.owner} is not player:
    240.                         send action bar "&cYou are not the owner of this gen!" to player
    241.                     else:
    242.                         wait 10 ticks
    243.                         set event-block to gold block
    244.                         send action bar "&bYou upgraded a gen!" to player
    245.              
    246. on place of gold block:
    247.     if name of player's held item contains "&6Gold Gen":
    248.         if {gens::%player's uuid%} < 10:
    249.             set {%event-block%.owner} to player
    250.             add 1 to {gens::%player's uuid%}
    251.             add location of event-block to {placed::gens::%player's uuid%::*}
    252.             send action bar "&bYou placed a gold gen!" to player
    253.         else:
    254.             cancel event
    255.             send action bar "&cYou have reached the max gens you can place!" to player
    256.          
    257. on left click on gold block:
    258.     Loop all players:
    259.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    260.             if player is sneaking:
    261.                 if {%event-block%.owner} is set:
    262.                     if {%event-block%.owner} is not player:
    263.                         cancel event
    264.                         send action bar "&cYou are not the owner of this gen!" to player
    265.                     else:
    266.                         cancel event
    267.                         set event-block to air
    268.                         remove 1 from {gens::%player's uuid%}
    269.                         remove location of event-block from {placed::gens::%player's uuid%::*}
    270.                         send action bar "&cYou broke a gold gen!" to player
    271.                         give player gold block named "&6Gold Gen"
    272.             else:
    273.                 cancel event
    274.                 send action bar "&bTo break a gen you need to be shifting." to player
    275.      
    276. on right click on gold block:
    277.     Loop all players:
    278.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    279.             if player is sneaking:
    280.                 if {%event-block%.owner} is set:
    281.                     if {%event-block%.owner} is not player:
    282.                         send action bar "&cYou are not the owner of this gen!" to player
    283.                     else:
    284.                         wait 10 ticks
    285.                         set event-block to lapis block
    286.                         send action bar "&bYou upgraded a gen!" to player
    287.  
    288. on place of lapis block:
    289.     if name of player's held item contains "&9Lapis Gen":
    290.         if {gens::%player's uuid%} < 10:
    291.             set {%event-block%.owner} to player
    292.             add 1 to {gens::%player's uuid%}
    293.             add location of event-block to {placed::gens::%player's uuid%::*}
    294.             send action bar "&bYou placed a lapis gen!" to player
    295.         else:
    296.             cancel event
    297.             send action bar "&cYou have reached the max gens you can place!" to player
    298.          
    299. on left click on lapis block:
    300.     Loop all players:
    301.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    302.             if player is sneaking:
    303.                 if {%event-block%.owner} is set:
    304.                     if {%event-block%.owner} is not player:
    305.                         cancel event
    306.                         send action bar "&cYou are not the owner of this gen!" to player
    307.                     else:
    308.                         cancel event
    309.                         set event-block to air
    310.                         remove 1 from {gens::%player's uuid%}
    311.                         remove location of event-block from {placed::gens::%player's uuid%::*}
    312.                         send action bar "&cYou broke a lapis gen!" to player
    313.                         give player lapis block named "&9Lapis Gen"
    314.             else:
    315.                 cancel event
    316.                 send action bar "&bTo break a gen you need to be shifting." to player
    317.              
    318. on right click on lapis block:
    319.     Loop all players:
    320.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    321.             if player is sneaking:
    322.                 if {%event-block%.owner} is set:
    323.                     if {%event-block%.owner} is not player:
    324.                         send action bar "&cYou are not the owner of this gen!" to player
    325.                     else:
    326.                         wait 10 ticks
    327.                         set event-block to redstone block
    328.                         send action bar "&bYou upgraded a gen!" to player
    329.                      
    330. on place of redstone block:
    331.     if name of player's held item contains "&cRedstone Gen":
    332.         if {gens::%player's uuid%} < 10:
    333.             set {%event-block%.owner} to player
    334.             add 1 to {gens::%player's uuid%}
    335.             add location of event-block to {placed::gens::%player's uuid%::*}
    336.             send action bar "&bYou placed a redstone gen!" to player
    337.         else:
    338.             cancel event
    339.             send action bar "&cYou have reached the max gens you can place!" to player
    340.          
    341. on left click on redstone block:
    342.     Loop all players:
    343.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    344.             if player is sneaking:
    345.                 if {%event-block%.owner} is set:
    346.                     if {%event-block%.owner} is not player:
    347.                         cancel event
    348.                         send action bar "&cYou are not the owner of this gen!" to player
    349.                     else:
    350.                         cancel event
    351.                         set event-block to air
    352.                         remove 1 from {gens::%player's uuid%}
    353.                         remove location of event-block from {placed::gens::%player's uuid%::*}
    354.                         send action bar "&cYou broke a redstone gen!" to player
    355.                         give player redstone block named "&cRedstone Gen"
    356.             else:
    357.                 cancel event
    358.                 send action bar "&bTo break a gen you need to be shifting." to player
    359.          
    360. on right click on redstone block:
    361.     Loop all players:
    362.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    363.             if player is sneaking:
    364.                 if {%event-block%.owner} is set:
    365.                     if {%event-block%.owner} is not player:
    366.                         send action bar "&cYou are not the owner of this gen!" to player
    367.                     else:
    368.                         wait 10 ticks
    369.                         set event-block to diamond block
    370.                         send action bar "&bYou upgraded a gen!" to player
    371.                      
    372. on place of diamond block:
    373.     if name of player's held item contains "&bDiamond Gen":
    374.         if {gens::%player's uuid%} < 10:
    375.             set {%event-block%.owner} to player
    376.             add 1 to {gens::%player's uuid%}
    377.             add location of event-block to {placed::gens::%player's uuid%::*}
    378.             send action bar "&bYou placed a diamond gen!" to player
    379.         else:
    380.             cancel event
    381.             send action bar "&cYou have reached the max gens you can place!" to player
    382.  
    383. on left click on diamond block:
    384.     Loop all players:
    385.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    386.             if player is sneaking:
    387.                 if {%event-block%.owner} is set:
    388.                     if {%event-block%.owner} is not player:
    389.                         cancel event
    390.                         send action bar "&cYou are not the owner of this gen!" to player
    391.                     else:
    392.                         cancel event
    393.                         set event-block to air
    394.                         remove 1 from {gens::%player's uuid%}
    395.                         remove location of event-block from {placed::gens::%player's uuid%::*}
    396.                         send action bar "&cYou broke a diamond gen!" to player
    397.                         give player diamond block named "&bDiamond Gen"
    398.             else:
    399.                 cancel event
    400.                 send action bar "&bTo break a gen you need to be shifting." to player
    401.  
    402. on right click on diamond block:
    403.     Loop all players:
    404.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    405.             if player is sneaking:
    406.                 if {%event-block%.owner} is set:
    407.                     if {%event-block%.owner} is not player:
    408.                         send action bar "&cYou are not the owner of this gen!" to player
    409.                     else:
    410.                         wait 10 ticks
    411.                         set event-block to emerald block
    412.                         send action bar "&bYou upgraded a gen!" to player
    413.  
    414. on place of emerald block:
    415.     if name of player's held item contains "&2Emerald Gen":
    416.         if {gens::%player's uuid%} < 10:
    417.             set {%event-block%.owner} to player
    418.             add 1 to {gens::%player's uuid%}
    419.             add location of event-block to {placed::gens::%player's uuid%::*}
    420.             send action bar "&bYou placed an emerald gen!" to player
    421.         else:
    422.             cancel event
    423.             send action bar "&cYou have reached the max gens you can place!" to player
    424.          
    425. on left click on emerald block:
    426.     Loop all players:
    427.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    428.             if player is sneaking:
    429.                 if {%event-block%.owner} is set:
    430.                     if {%event-block%.owner} is not player:
    431.                         cancel event
    432.                         send action bar "&cYou are not the owner of this gen!" to player
    433.                     else:
    434.                         cancel event
    435.                         set event-block to air
    436.                         remove 1 from {gens::%player's uuid%}
    437.                         remove location of event-block from {placed::gens::%player's uuid%::*}
    438.                         send action bar "&cYou broke an emerald gen!" to player
    439.                         give player emerald block named "&2Emerald Gen"
    440.             else:
    441.                 cancel event
    442.                 send action bar "&bTo break a gen you need to be shifting." to player
    443.              
    444. on right click on emerald block:
    445.     Loop all players:
    446.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    447.             if player is sneaking:
    448.                 if {%event-block%.owner} is set:
    449.                     if {%event-block%.owner} is not player:
    450.                         send action bar "&cYou are not the owner of this gen!" to player
    451.                     else:
    452.                         wait 10 ticks
    453.                         set event-block to obsidian
    454.                         send action bar "&bYou upgraded a gen!" to player
    455.                      
    456. on place of obsidian:
    457.     if name of player's held item contains "&8Obsidian Gen":
    458.         if {gens::%player's uuid%} < 10:
    459.             set {%event-block%.owner} to player
    460.             add 1 to {gens::%player's uuid%}
    461.             add location of event-block to {placed::gens::%player's uuid%::*}
    462.             send action bar "&bYou placed an obsidian gen!" to player
    463.         else:
    464.             cancel event
    465.             send action bar "&cYou have reached the max gens you can place!" to player
    466.          
    467. on left click on obsidian:
    468.     Loop all players:
    469.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    470.             if player is sneaking:
    471.                 if {%event-block%.owner} is set:
    472.                     if {%event-block%.owner} is not player:
    473.                         cancel event
    474.                         send action bar "&cYou are not the owner of this gen!" to player
    475.                     else:
    476.                         cancel event
    477.                         set event-block to air
    478.                         remove 1 from {gens::%player's uuid%}
    479.                         remove location of event-block from {placed::gens::%player's uuid%::*}
    480.                         send action bar "&cYou broke an obsidian gen!" to player
    481.                         give player Obsidian block named "&8Obsidian Gen"
    482.             else:
    483.                 cancel event
    484.                 send action bar "&bTo break a gen you need to be shifting." to player
    485.              
    486. on right click on obsidian:
    487.     Loop all players:
    488.         if {placed::gens::%loop-player's uuid%::*} contains location of event-block:
    489.             if player is sneaking:
    490.                 if {%event-block%.owner} is set:
    491.                     if {%event-block%.owner} is not player:
    492.                         send action bar "&cYou are not the owner of this gen!" to player
    493.                     else:
    494.                         send action bar "&bThere are no gen upgrades." to player
    495.                      
    496. every 3 seconds:
    497.     Loop all players:
    498.         Loop all blocks in radius 30 of loop-player:
    499.             if loop-block is hay block:
    500.                 if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
    501.                     drop 1 wheat at block above loop-value-2
    502.             if loop-block is pumpkin:
    503.                 if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
    504.                     drop 1 pumpkin at block above loop-value-2
    505.             if loop-block is coal block:
    506.                 if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
    507.                     drop 1 coal at block above loop-value-2
    508.             if loop-block is iron block:
    509.                 if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
    510.                     drop 1 iron ingot at block above loop-value-2
    511.             if loop-block is gold block:
    512.                 if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
    513.                     drop 1 gold ingot at block above loop-value-2
    514.             if loop-block is lapis block:
    515.                 if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
    516.                     drop 1 lapis at block above loop-value-2
    517.             if loop-block is redstone block:
    518.                 if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
    519.                     drop 1 redstone at block above loop-value-2
    520.             if loop-block is diamond block:
    521.                 if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
    522.                     drop 1 diamond at block above loop-value-2
    523.             if loop-block is emerald block:
    524.                 if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
    525.                     drop 1 emerald at block above loop-value-2
    526.             if loop-block is obsidian:
    527.                 if {placed::gens::%Loop-player's uuid%::*} contains location of loop-value-2:
    528.                     drop 1 nether star at block above loop-value-2


     
    #1 MrSnowy, Sep 9, 2021
    Last edited: Sep 14, 2021
  2. Best Answer:
    Post #3 by couger44, Sep 9, 2021
  3. ShyDoge

    ShyDoge Member

    Joined:
    Jul 31, 2021
    Messages:
    49
    Likes Received:
    1
    1) It's obvious that this gen skript is either copied or barely edited, (Please don't take credit for this work)
    2) As far as I'm aware there isn't a way to "Reduce" the RAM because the skript barely takes any RAM at all.
    3) The RAM that a skript takes up is dependant on how big it is, but plugins are much bigger, so I suggest just deleting a few plugins.

    I'm sorry I couldn't help more but there is no way to reduce the RAM on a skript that barely takes RAM anyway.
     
  4. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    714
    Likes Received:
    31
    Reduce boilerplate code. Like the additional commands. For example:

    All this:

    Code (Skript):
    1.  
    2. command /wheatgen:
    3.     permission: op
    4.     permission message: "&4You are not allowed to do that!"
    5.     trigger:
    6.         give player hay block named "&eWheat Gen"
    7.        
    8. command /pumpkingen:
    9.     permission: op
    10.     permission message: "&4You are not allowed to do that!"
    11.     trigger:
    12.         give player pumpkin named "&6Pumpkin Gen"
    13.        
    14. command /coalgen:
    15.     permission: op
    16.     permission message: "&4You are not allowed to do that!"
    17.     trigger:
    18.         give player coal block named "&8Coal Gen"
    19.        
    20. command /irongen:
    21.     permission: op
    22.     permission message: "&4You are not allowed to do that!"
    23.     trigger:
    24.         give player iron block named "&fIron Gen"
    25.        
    26. command /goldgen:
    27.     permission: op
    28.     permission message: "&4You are not allowed to do that!"
    29.     trigger:
    30.         give player gold block named "&6Gold Gen"
    31.  
    32. command /lapisgen:
    33.     permission: op
    34.     permission message: "&4You are not allowed to do that!"
    35.     trigger:
    36.         give player lapis block named "&9Lapis Gen"
    37.  
    38. command /redstonegen:
    39.     permission: op
    40.     permission message: "&4You are not allowed to do that!"
    41.     trigger:
    42.         give player redstone block named "&cRedstone Gen"
    43.        
    44. command /diamondgen:
    45.     permission: op
    46.     permission message: "&4You are not allowed to do that!"
    47.     trigger:
    48.         give player diamond block named "&bDiamond Gen"
    49.  
    50. command /emeraldgen:
    51.     permission: op
    52.     permission message: "&4You are not allowed to do that!"
    53.     trigger:
    54.         give player emerald block named "&2Emerald Gen"
    55.        
    56. command /obsidiangen:
    57.     permission: op
    58.     permission message: "&4You are not allowed to do that!"
    59.     trigger:
    60.         give player obsidian named "&8Obsidian Gen"

    Can be reduce by doing this:

    Code (Skript):
    1. command /getgen [<string>]:
    2.    permission: op
    3.    permission message: &4You aren't allowed to do that!
    4.    trigger:
    5.       if arg 1 is "wheat":
    6.          give player hay block named "&eWheat Gen"
    7.  
    8.       else if arg 1 is "pumpkin":
    9.          give player pumpkin named "&6Pumpkin Gen"
    10.  
    11.       else if arg 1 is "coal":
    12.          give player coal block named "&8Coal Gen"
    13.  
    14.       else if arg 1 is "iron":
    15.          give player iron block named "&fIron Gen"
    16.  
    17.       else if arg 1 is "gold":
    18.          give player gold block named "&6Gold Gen"
    19.  
    20.       else if arg 1 is "lapis":
    21.          give player lapis block named "&9Lapis Gen"
    22.  
    23.       else if arg 1 is "redstone":
    24.          give player redstone block named "&cRedstone Gen"
    25.  
    26.       else if arg 1 is "diamond":
    27.          give player diamond block named "&bDiamond Gen"
    28.  
    29.       else if arg 1 is "emerald":
    30.          give player emerald block named "&2Emerald Gen"
    31.  
    32.       else if arg 1 is "obsidian":
    33.          give player obsidian named "&8Obsidian Gen"
    34.       else:
    35.          send "Incorrect generator."
    Do the same with the rest of the remaining code. It should be easy for you to look at the entire code and see what repeats over and over again.
     
  5. MrSnowy

    MrSnowy New Member

    Joined:
    Sep 7, 2021
    Messages:
    9
    Likes Received:
    0
    I coded it myself, so please don't say it also as I said I am just a beginner at skripting.
    --- Double Post Merged, Sep 10, 2021, Original Post Date: Sep 10, 2021 ---
    I did it with the gen command but I can't do with the remaining code because the remaining code is not a command.
    --- Double Post Merged, Sep 10, 2021 ---
    If you have any other way to skript it, tell me.
     
  6. ShyDoge

    ShyDoge Member

    Joined:
    Jul 31, 2021
    Messages:
    49
    Likes Received:
    1
    Code (Text):
    1. on place of block:
    2.   if event-block is pumpkin:
    3.     # do stuff
    4.   else:
    5.     if event-block is iron block:
    6.       # Do More Stuff
    7.     else:
    8.       if event-block is redstone block:
    9.         # Repeat Process
     
  7. MrSnowy

    MrSnowy New Member

    Joined:
    Sep 7, 2021
    Messages:
    9
    Likes Received:
    0
    How do I mark this as solved?
     
  8. Minecoll_YT

    Supporter Forums Helper

    Joined:
    Dec 2, 2018
    Messages:
    650
    Likes Received:
    39
    In the upper right corner in the thread options. But please mark the best answer
     
Thread Status:
Not open for further replies.

Share This Page

Loading...