#Doesn't send the biggest value

1 messages · Page 1 of 1 (latest)

tiny flicker
#
    send "&3&lScenarios:" to all players
    add {GoldenRetriever} to {top::*}
    add {BleedingSweets} to {top::*}
    add {Shieldless} to {top::*}
    add {NetheriteDrop} to {top::*}
    add {Webless} to {top::*}
    add {AutoEnchant} to {top::*}
    loop 3 times:
      set {mayor} to max({top::*})
      if {mayor} = {GoldenRetriever}:
        send "&bGoldenRetriever" to all players
        set {GoldenRetriever} to true
        remove {GoldenRetriever} from {top::*}
      if {mayor} = {BleedingSweets}:
        send "&bBleedingSweets" to all players
        set {BleedingSweets} to true
        remove {BleedingSweets} from {top::*}
      if {mayor} = {Shieldless}:
        send "&bShieldless" to all players
        set {Shieldless} to true
        remove {Shieldless} from {top::*}
      if {mayor} = {NetheriteDrop}:
        send "&bNetheriteDrop" to all players
        set {NetheriteDrop} to true
        remove {NetheriteDrop} from {top::*}
      if {mayor} = {Webless}:
        send "&bWebless" to all players
        set {Webless} to true
        remove {Webless} from {top::*}
      if {mayor} = {AutoEnchant}:
        send "&bAutoEnchant" to all players
        set {AutoEnchant} to true
        remove {AutoEnchant} from {top::*}
    send " " to all players```
#
  if name of event-inventory is "&3&lScenario Selector":
    if index of event-slot = 11:
      cancel event
      if {voteSweets::%player's uuid%} is not set:
        if ({maxvote::%player's uuid%} ? 0) is less than 3:
          add 1 to {BleedingSweets}
          add 1 to {maxvote::%player's uuid%}
          set {voteSweets::%player's uuid%} to true
          send "&eYou have voted for BleedingSweets!"
        else:
          send "&4You have reached the maximum amount of votes!"
      else:
        delete {voteSweets::%player's uuid%}
        remove 1 from {BleedingSweets}
        remove 1 from {maxvote::%player's uuid%}
        send "&3Removed your vote from BleedingSweets!"```
#

this is how I do the counting system

#

thanks for all the help in advance!

unborn bridge
#

so true

elder mauve
#

Too be fair your code is bad.

tiny flicker
elder mauve
#

no

stone cloak
#

Umm

#

Use elses please

elder mauve
#

You are using a hardcoded way

stone cloak
#
  1. No one wants to read all of that.
  2. What are you even trying to do?
  3. Where does it stop working
#

Send a small snippet and a description of what this is supposed to do and where it fails

tiny flicker
stone cloak
#

How do you “choose”

tiny flicker
#

A gui I made

elder mauve
#

If I wasn't doing something I would fix it

elder mauve
tiny flicker
#

But your writing is just way faster 💀

stone cloak
#

Spoon feeding means that you didnt make it

elder mauve
#

He did I just redid it

stone cloak
#

Ah

tiny flicker
stone cloak
tiny flicker
#

Basically I am trying to code a uhc plugin

stone cloak
#

What scenarios

#

The variables

#

The if mayor = …

tiny flicker
#

Wait, I have to turn on my pc rq

tiny flicker
# stone cloak What scenarios

these:

    add {BleedingSweets} to {top::*}
    add {Shieldless} to {top::*}
    add {NetheriteDrop} to {top::*}
    add {Webless} to {top::*}
    add {AutoEnchant} to {top::*}```
stone cloak
#

Why not {scenarios::*}

tiny flicker
#

and is do you know a way to make my thing work?

#

( sorry for the ping )

elder mauve
#

send gui

stone cloak
#

I mean

#

set {scenario::vampire} to true

#

Then on death check if its true and heal the attacker

#

Idk

#

And for the voting

#

Just add 1 to {votes::NAME HERE}

elder mauve
#

also for your auto enchant

on preparing craft of any iron armor or iron sword:
  set {_o} to event-item
  if event-item is a iron sword:
    enchant {_o} with sharpness 1
  else:
    enchant {_o} with protection 1
  set slot 0 of event-inventory to {_o}
stone cloak
#

ive never used preparing craft before, but is it nessisary to stringify an item and then parse it as an item? why not just set o to event-item?

elder mauve
#

It says it's not an item

#

idfk

stone cloak
#

huh

elder mauve
#

yes

tiny flicker
# elder mauve send gui
  if name of player's held item is "&3Scenarios":
    set {_Scenarios} to chest inventory with 3 rows named "&3&lScenario Selector"
    set slot (integers between 0 and 3) of {_Scenarios} to cyan stained glass pane named "Made by meter"
    set slot 4 of {_Scenarios} to chest named "&3NoCleanUp" with lore "You can't hit or be hit for 15s after a kill" and " " and "&eAlready included"
    set slot (integers between 5 and 9) of {_Scenarios} to cyan stained glass pane named "Made by meter"
    set slot 10 of {_Scenarios} to golden apple named "&3Golden Retriever" with lore "Each kill drops 2 Golden Apples"
    set slot 11 of {_Scenarios} to sugar named "&3Bleeding Sweets" with lore "Each kill drops" and "» &b1 Diamond" and "» &b5 Arrows" and "» &b1 String"
    set slot 12 of {_Scenarios} to shield named "&3Shieldless" with lore "Shields will disabled"
    set slot 13 of {_Scenarios} to barrier named "&4Close"
    set slot 14 of {_Scenarios} to netherite scrap named "&3Netherite Drop" with lore "Breaking diamonds has the chance to drop netherite scraps"
    set slot 15 of {_Scenarios} to web named "&3Webless" with lore "Webs will be disabled"
    set slot 16 of {_Scenarios} to book named "&3AutoEnchant" with lore "Iron Armor gets prot 1 automatically" and "Iron Swords get sharpness 1 automatically" and " " and "&4Not working"
    set slot (integers between 17 and 21) of {_Scenarios} to cyan stained glass pane named "Made by meter"
    set slot 22 of {_Scenarios} to furnace named "&3AutoSmelter" with lore "Ores get smelted automatically" and " " and "&eAlready included"
    set slot (integers between 23 and 26) of {_Scenarios} to cyan stained glass pane named "Made by meter"
    open {_Scenarios} to player```
#

how votes get counted:

  if name of event-inventory is "&3&lScenario Selector":
    cancel event
    if index of event-slot = 10:
      cancel event
      if {voteGolden::%player's uuid%} is not set:
        if ({maxvote::%player's uuid%} ? 0) is less than 3:
          add 1 to {GoldenRetriever}
          add 1 to {maxvote::%player's uuid%}
          set {voteGolden::%player's uuid%} to true
          send "&eYou have voted for GoldenRetriever!"
        else:
          send "&4You have reached the maximum amount of votes!"
      else:
        delete {voteGolden::%player's uuid%}
        remove 1 from {GoldenRetriever}
        remove 1 from {maxvote::%player's uuid%}
        send "&3Removed your vote from Golden Retriever!"```
#

where they get chosen after voting:

    add {BleedingSweets} to {top::*}
    add {Shieldless} to {top::*}
    add {NetheriteDrop} to {top::*}
    add {Webless} to {top::*}
    add {AutoEnchant} to {top::*}
    loop 3 times:
      set {mayor} to max({top::*})
      if {mayor} = {GoldenRetriever}:
        send "&bGoldenRetriever" to all players
        set {GoldenRetriever} to true
        remove {GoldenRetriever} from {top::*}
      if {mayor} = {BleedingSweets}:
        send "&bBleedingSweets" to all players
        set {BleedingSweets} to true
        remove {BleedingSweets} from {top::*}
      if {mayor} = {Shieldless}:
        send "&bShieldless" to all players
        set {Shieldless} to true
        remove {Shieldless} from {top::*}
      if {mayor} = {NetheriteDrop}:
        send "&bNetheriteDrop" to all players
        set {NetheriteDrop} to true
        remove {NetheriteDrop} from {top::*}
      if {mayor} = {Webless}:
        send "&bWebless" to all players
        set {Webless} to true
        remove {Webless} from {top::*}
      if {mayor} = {AutoEnchant}:
        send "&bAutoEnchant" to all players
        set {AutoEnchant} to true
        remove {AutoEnchant} from {top::*}
    send " " to all players```
stone cloak
#

Please use else ifs

#

And also %nl%

elder mauve
#

nl

tiny flicker
stone cloak
#

Turn off reply pings please

#

Nl will go to the next line

tiny flicker
#

so just put %% around {GoldenRetriever}?

stone cloak
#

No

stone cloak
tiny flicker
#

what's the fix to my problem tho?

#

it's like the only issue I have left rn

stone cloak
#

no errors doesnt mean good code

#

and if you are going to use this code on a public server it should be done professionally

tiny flicker
#

and what's the difference by adding else ifs?
I have never used that tbh

tiny flicker
stone cloak
#

Can each player only vote for one scenario?

#

Else ifs are great

#

If the first condition is false, then if another is passed

tiny flicker
#

and 3 get chosen out of 6 scenarios I have made until now

stone cloak
#

Ok

tiny flicker
#

@elder mauve sorry for the ping but you said you knew how to fix it

elder mauve
#

I’m no home

stone cloak
#

Just use a list variables

#
  add 1 to {votes::%scenario%}```
#

Then loop {votes::*}

tiny flicker
#
      set {mayor} to max({votes::*})
      if {mayor} = {GoldenRetriever}:
        send "&d» &bGoldenRetriever" to all players
        set {GoldenRetriever} to true
        remove {votes::GoldenRetriever} from {votes::*}
      if {mayor} = {BleedingSweets}:
        send "&d» &bBleedingSweets" to all players
        set {BleedingSweets} to true
        remove {votes::BleedingSweets} from {votes::*}
      if {mayor} = {Shieldless}:
        send "&d» &bShieldless" to all players
        set {Shieldless} to true
        remove {votes::Shieldless} from {votes::*}
      if {mayor} = {NetheriteDrop}:
        send "&d» &bNetheriteDrop" to all players
        set {NetheriteDrop} to true
        remove {votes::NetheriteDrop} from {votes::*}
      if {mayor} = {Webless}:
        send "&d» &bWebless" to all players
        set {Webless} to true
        remove {votes::Webless} from {votes::*}
      if {mayor} = {AutoEnchant}:
        send "&d» &bAutoEnchant" to all players
        set {AutoEnchant} to true
        remove {votes::AutoEnchant} from {votes::*}
    send " " to all players```
#

so like this?

#
  if name of event-inventory is "&3&lScenario Selector":
    if index of event-slot = 15:
      cancel event
      if {voteWebless::%player's uuid%} is not set:
        if ({maxvote::%player's uuid%} ? 0) is less than 3:
          add 1 to {votes::Webless}
          add 1 to {maxvote::%player's uuid%}
          set {voteWebless::%player's uuid%} to true
          send "&eYou have voted for Webless!"
        else:
          send "&4You have reached the maximum amount of votes!"
      else:
        delete {voteWebless::%player's uuid%}
        remove 1 from {votes::Webless}
        remove 1 from {maxvote::%player's uuid%}
        send "&3Removed your vote from Webless!"```
tiny flicker
#

idk if the problem is that some maybe have the same votes number?

midnight flume
#

i don't suggest pinging him

stone cloak
#

Im at an archery tournament

#

Ill look later

stone cloak
tiny flicker
stone cloak
#

try something like

#
  if {votes::%scenario%} does not contain player's uuid:
    add player's uuid to {votes::%scenario%}
    send "You voted for %{votes::%scenario%}%" to player
    remove 1 from {remainingVotes::%player's uuid%}
  else:
    send "You have already voted for %{votes::%scenario%}%" to player```
#

then loop {votes::*}, and check the sizes

tiny flicker
#
  if name of event-inventory is "&3&lScenario Selector":
    if index of event-slot = 15:
      cancel event
      if {voteWebless::%player's uuid%} is not set:
        if ({maxvote::%player's uuid%} ? 0) is less than 3:
          add 1 to {votes::Webless}
          add 1 to {maxvote::%player's uuid%}
          set {voteWebless::%player's uuid%} to true
          send "&eYou have voted for Webless!"
        else:
          send "&4You have reached the maximum amount of votes!"
      else:
        delete {voteWebless::%player's uuid%}
        remove 1 from {votes::Webless}
        remove 1 from {maxvote::%player's uuid%}
        send "&3Removed your vote from Webless!"```
#

first it checks if you voted, then the votecount and then it adds your vote

stone cloak
#

yeah but yours is hardcoded

#

i assume you have that for each scenario

tiny flicker
#

your help votes the votes::* idea made it happen

#

thank you so much

#

I found a mistake I had done yesterday whilest making your idea

#

also if you are seeing this Ispoonfeed