Solved hi i need your help

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

Status
Not open for further replies.

effiraid

Member
Jul 16, 2017
24
0
0
i i need your help about my code!

code_language.skript:
on join:
if player has permission "heroes.playing.druid":
set {chain.druid.%player%} to 1
else:
set {chain.druid.%player%} to 0
else if player has permission "heroes.playing.babarian":
set {chain.babarian.%player%} to 1
else:
set {chain.babarian.%player%} to 0

And below is error:
code_language.skript:
[19:22:25 ERROR]: 'else if' has to be placed just after another 'if' or 'else if' section (체인_드루이드.sk, line 12: else if player has permission "heroes.playing.babarian":')
[19:22:25 ERROR]: 'else' has to be placed just after an 'if' or 'else if' section (체인_드루이드.sk, line 14: else:')

what i missed? please help me :emoji_slight_smile:
 
Just as the error says, an 'else if' can only be placed after a 'if' or 'else if' statement; not an 'else' statement.

code_language.skript:
on join:
    if player has permission "heroes.playing.druid":
        set {chain.druid.%player%} to 1
    else:
        set {chain.druid.%player%} to 0
    if player has permission "heroes.playing.babarian":
        set {chain.babarian.%player%} to 1
    else:
        set {chain.babarian.%player%} to 0

Also, I would suggest using list variables, as they can probably benefit you a lot more later down the line:

code_language.skript:
on join:
    if player has permission "heroes.playing.druid":
        set {chain::druid::%player%} to 1
    else:
        set {chain::druid::%player%} to 0
    if player has permission "heroes.playing.babarian":
        set {chain::babarian::%player%} to 1
    else:
        set {chain::babarian::%player%} to 0

So using list variables, we can do several cool things:
  • {chain::*} is now a list of all the classes
  • {chain::babarian::*} is now a list of all the players who are barbarians, if it equals 1
  • {chain::druid::*} is now a list of all the players who are druids, if it equals 1
  • etc.
Also, what you can totally do, is just not set variables equal to 0. If you code your program around not having the variable equal 0 (as in, checking if it's not 1 instead of checking if it's 0), you can do something like this:

code_language.skript:
on join:
    if player has permission "heroes.playing.druid":
        set {chain::druid::%player%} to 1
    else if player has permission "heroes.playing.babarian":
        set {chain::babarian::%player%} to 1
 
Just as the error says, an 'else if' can only be placed after a 'if' or 'else if' statement; not an 'else' statement.

code_language.skript:
on join:
    if player has permission "heroes.playing.druid":
        set {chain.druid.%player%} to 1
    else:
        set {chain.druid.%player%} to 0
    if player has permission "heroes.playing.babarian":
        set {chain.babarian.%player%} to 1
    else:
        set {chain.babarian.%player%} to 0

Also, I would suggest using list variables, as they can probably benefit you a lot more later down the line:

code_language.skript:
on join:
    if player has permission "heroes.playing.druid":
        set {chain::druid::%player%} to 1
    else:
        set {chain::druid::%player%} to 0
    if player has permission "heroes.playing.babarian":
        set {chain::babarian::%player%} to 1
    else:
        set {chain::babarian::%player%} to 0

So using list variables, we can do several cool things:
  • {chain::*} is now a list of all the classes
  • {chain::babarian::*} is now a list of all the players who are barbarians, if it equals 1
  • {chain::druid::*} is now a list of all the players who are druids, if it equals 1
  • etc.
Also, what you can totally do, is just not set variables equal to 0. If you code your program around not having the variable equal 0 (as in, checking if it's not 1 instead of checking if it's 0), you can do something like this:

code_language.skript:
on join:
    if player has permission "heroes.playing.druid":
        set {chain::druid::%player%} to 1
    else if player has permission "heroes.playing.babarian":
        set {chain::babarian::%player%} to 1

Thanks! i really appreciate about your answer. :emoji_slight_smile:
[doublepost=1500640835,1500638172][/doublepost]
Just as the error says, an 'else if' can only be placed after a 'if' or 'else if' statement; not an 'else' statement.

code_language.skript:
on join:
    if player has permission "heroes.playing.druid":
        set {chain.druid.%player%} to 1
    else:
        set {chain.druid.%player%} to 0
    if player has permission "heroes.playing.babarian":
        set {chain.babarian.%player%} to 1
    else:
        set {chain.babarian.%player%} to 0

Also, I would suggest using list variables, as they can probably benefit you a lot more later down the line:

code_language.skript:
on join:
    if player has permission "heroes.playing.druid":
        set {chain::druid::%player%} to 1
    else:
        set {chain::druid::%player%} to 0
    if player has permission "heroes.playing.babarian":
        set {chain::babarian::%player%} to 1
    else:
        set {chain::babarian::%player%} to 0

So using list variables, we can do several cool things:
  • {chain::*} is now a list of all the classes
  • {chain::babarian::*} is now a list of all the players who are barbarians, if it equals 1
  • {chain::druid::*} is now a list of all the players who are druids, if it equals 1
  • etc.
Also, what you can totally do, is just not set variables equal to 0. If you code your program around not having the variable equal 0 (as in, checking if it's not 1 instead of checking if it's 0), you can do something like this:

code_language.skript:
on join:
    if player has permission "heroes.playing.druid":
        set {chain::druid::%player%} to 1
    else if player has permission "heroes.playing.babarian":
        set {chain::babarian::%player%} to 1

Then how can player get {chain::babarian} if player change class druid to babarian? (Also delete {chain::druid})
 
Thanks! i really appreciate about your answer. :emoji_slight_smile:
[doublepost=1500640835,1500638172][/doublepost]

Then how can player get {chain::babarian} if player change class druid to babarian? (And removed {chain::druid}}

Assuming that either {chain::babarian::%player%} or {chain::druid::%player%} will be set (not both a once), you could delete the old class value, the set the new class to 1:

code_language.skript:
delete {chain::druid::%player%}
set {chain::babarian::%player%} to 1
 
Assuming that either {chain::babarian::%player%} or {chain::druid::%player%} will be set (not both a once), you could delete the old class value, the set the new class to 1:

code_language.skript:
delete {chain::druid::%player%}
set {chain::babarian::%player%} to 1
Oh...i doesn't thought that :emoji_slight_smile: really thanks about help newbie
[doublepost=1500649657,1500641310][/doublepost]
Assuming that either {chain::babarian::%player%} or {chain::druid::%player%} will be set (not both a once), you could delete the old class value, the set the new class to 1:

code_language.skript:
delete {chain::druid::%player%}
set {chain::babarian::%player%} to 1

Hi you there? may i ask you please?

code_language.skript:
on chat:
    if player has permission "heroes.playing.druid":
        set {chain::druid::%player%} to 1
        send "druid" to player
    else if player has permission "heroes.playing.babarian":
        set {chain::babarian::%player%} to 1
        send "babarian" to player

I coded this but only shows druid when only i have permission "heroes.playing.babarian".................... i doesn't have "heroes.playing.druid".

here is my permissionsex config

code_language.skript:
users:
  12dda6a0-0441-3785-828c-765822116f1b:
    group:
    - M
    options:
      name: IKFAM
    permissions:
    - heroes.playing.babarian
    worlds:
      SPAWN:
        permissions: []
  530fa97a-357f-3c19-94d3-0c5c65c18fe8:
    group:
    - M
    options:
      name: test
    permissions: []
groups:
  A:
    permissions:
    - '*'
    inheritance:
    - P
    worlds: []
    options:
      prefix: ''
      suffix: ''
      default: false
  P:
    permissions:
    - essentials.ban
    - essentials.banip
    - essentials.jails
    - essentials.kick
    - essentials.mute
    - essentials.tempban
    - essentials.jail
    - essentials.unban
    - essentials.unbanip
    - essentials.whois
    - essentials.unmute
    - essentials.unjail
    inheritance:
    - M
    worlds: []
    options:
      prefix: ''
      suffix: ''
      default: false
  N:
    permissions:
    - authme.player.*
    - deluxetags.gui
    - deluxetags.select
    - deluxetags.list
    - deluxetags.set
    - deluxetags.clear
    - deluxetags.tag.NEW
    - essentials.afk.auto
    - essentials.balance
    - essentials.balancetop
    - essentials.list
    - essentials.motd
    - essentials.pay
    - essentials.r
    - essentials.sethome.bed
    - essentials.home
    - essentials.spawn
    - heroes.classes.*
    - heroes.reset
    - heroes.bind
    - quests.take
    - quests.quit
    - quests.stats
    - multiverse.portal.access.*
    - PlayerPoints.me
    - chatitem.use
    - deluxetags.forcetag.new
    - deluxetags.tag.BETATESTER
    - commandcode.redeem
    - BossShop.open.command.g_main
    - BossShop.open.command.hero_skills_01
    - BossShop.open.command.hero_skills
    - BossShop.open.command.hero_confirm_01
    - BossShop.open.command.hero_choose
    - BossShop.open.command.hero_choose_guide
    - BossShop.open.command.g_commands
    - BossShop.open.command.g_information
    - BossShop.open.command.m_trade
    - races.elf
    - races.human
    - races.dwarf
    - races.orc
    inheritance:
    - ''
    worlds: []
    options:
      prefix: ''
      suffix: ''
      default: true
  M:
    permissions:
    - dxl.group.*
    - dxl.leave
    - dxl.lives
    - essentials.build
    - auction.noah
    - auction.limit.5
    inheritance:
    - N
    worlds: []
    options:
      prefix: ''
      suffix: ''
      default: false
schema-version: 1
 
I coded this but only shows druid when only i have permission "heroes.playing.babarian".................... i doesn't have "heroes.playing.druid".

Odd; the code works for me on my server. Perhaps you're opped?
 
Status
Not open for further replies.