function returning null

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

Cramber

Member
Dec 24, 2021
1
0
1
Hi, my function is returning null, idk how to fix it. can anyone help me?
Im using: Skript 2.6, SkQuery 4.1.5, Reqn 1.2.3
code:

function getGrucoins(p: player) :: number:
send a "get" request to "https://unbelievaboat.com/api/v1/guilds/(id)/users/(id)" with the headers "Authorization: (token)"
set {_resp} to the last http response
set {_body} to {_resp}'s body
set {_SP_body::*} to {_body} split at ","
set {_pmoney::*} to {_SP_body::3} split at ":"
set {ppmoney} to {_pmoney::2} parsed as an integer
broadcast {ppmoney} #returns correct value
return {ppmoney}
on player join:
set {_ppmoney} to getGrucoins(player)
send "%player%'s balance: %{_ppmoney}% gc" to player #returns nickname's balance: <none> gc
 
Status
Not open for further replies.