Solved Function variable not working

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

ProfiiQus

New Member
Jul 28, 2017
9
0
0
26
Hello, I am getting the following error when reloading my skript:
code_language.skript:
>[2K [13:19:09 ERROR]: Can't understand this expression: p (Levelsystem.sk, line 32: if {exp.%p%} is greater than (2*((%{level.%p%}%+6)*(%{level.%p%}%+6))+4*%{level.%p%}%):')

But, I am pretty sure the variable p is declared in the head of the function - please take a look.
code_language.skript:
function checkForLevelUp(p: player):
    if {exp.%p%} is greater than (2*((%{level.%p%}%+6)*(%{level.%p%}%+6))+4*%{level.%p%}%):
        remove 2*((%{level.%p%}%+6)*(%{level.%p%}%+6))+4*%{level.%p%}% from {exp.%p%}
        add 1 to {level.%p%}
        send "Level up!" to p
Thanks anyone for any help <3

EDIT: If I try to add it to a variable, something goes horribly with skript error pops up.
 
Last edited:
Use %{_p}%, not p
:emoji_stuck_out_tongue:

code_language.skript:
function checkForLevelUp(p: player):
    if {exp.%{_p}%} is greater than (2*((%{level.%{_p}%}%+6)*(%{level.%{_p}%}%+6))+4*%{level.%{_p}%}%):
        remove 2*((%{level.%{_p}%}%+6)*(%{level.%{_p}%}%+6))+4*%{level.%{_p}%}% from {exp.%{_p}%}
        add 1 to {level.%{_p}%}
        send "Level up!" to {_p}
?
 
Status
Not open for further replies.