Looping wont work in function

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

mmm

Member
Apr 24, 2017
2
0
0
27
code_language.skript:
command /pinvite <player>:
    trigger:
        set {_invitedplayer} to arg-1
        loop {party::*}:
            if loop-value-1 is equal to player:
                broadcast "          &4&lDEBUG &f-> &2%loop-value-1% party check &ntrue"
                loop {party::leaders::*}:
                    if loop-value-2 is equal to player:
                        broadcast "          &4&lDEBUG &f-> &2%loop-value-2% leader check &ntrue"
                        broadcast "          &4&lDEBUG &f-> &2%{_invitedplayer}% invited player"
                        partyInvite(argument 1, player)
            else:
                broadcast "          &4&lDEBUG &f-> &2%loop-value-1% party check &4&nfalse"
                add player to {party::*}
                add player to {party::leaders::*}
                partyInvite(argument 1, player)


function partyInvite(t: text , p: player):
    loop {party::*}:
        if loop-value-1 is equal to {_invitedplayer}:
            send "player is in party error message" to {_p}
            stop
        else:
            loop {party::pendinginvites::*}
                if loop-value-2 is equal to {_invitedplayer}:
                    send "player already has pending invite" to {_p}
                    stop
                else:
                    add {_invitedplayer} to {party::pendinginvites::*}
                    set {partyleader.%player%} to arg-1
                    send "%event-player% has invite u 2 party" to {_invitedplayer}
                    wait 15 seconds
                    remove {_invitedplayer} from {party::pendinginvites::*}

[21:48:19 ERROR]: The 1st argument given to the function 'partyInvite' is not of the required type text. Check the correct order of the arguments and put lists into parentheses if appropriate (e.g. 'give(player, (iron ore and gold ore))'). Please note that storing the value in a variable and then using that variable as parameter will suppress this error, but it still won't work. (a.sk, line 33: partyInvite(argument 1, player)')

[21:48:39 ERROR]: Can't understand this condition/effect: loop {party::emoji_stuck_out_tongue:endinginvites::*} (functions.sk, line 8: loop {party::emoji_stuck_out_tongue:endinginvites::*}')
 
To fix error 1:
Make the 't' argument in the function a player and not a text

To fix error 2:
You forgot to add a : after the variable
 
Status
Not open for further replies.