Skript Version: Skript 2.5-alpha2 (Github)
---
Full Code:
Errors on Reload:
Addons using (including versions):
Reqn (v1.2.3), Skript-JSON (v1.0.0)
Additional Infomation:
The API will return a string of JSON like below
"TimeLeft" is the second calculated in backend needed to ban for how many second more.
If there is no record, it will return
Troubleshooting:
Have you tried searching the docs? Yes
Have you tried searching the forums? Yes
What other methods have you tried to fix it? I found a post suggest to phrase the variable to integer to be possible to be calculated, but the post doesn't suggest a way to be implement in my case.
https://forums.skunity.com/threads/issues-with-subtracting-from-variables.3272/
---
Full Code:
Code:
if {TimeExpire::%player's UUID%} is not set:
send a "get" request to "http://localhost/api2.php?UUID=%player's UUID%"
set {_response} to the last http response
set {_body} to {_response}'s body
copy json {_body} to {_output::*}
if {_output::TimeLeft} is set:
set {TimeExpire::%player's UUID%} to now
add {_output::TimeLeft} seconds to {TimeExpire::%player's UUID%}
broadcast "Success"
#kick the player due to "Sorry"
else if {TimeExpire::%player's UUID%} is set:
if {TimeExpire::%player's UUID%} is greater than now:
broadcast "Success"
#kick the player due to "Sorry"
else:
clear {TimeExpire::%player's UUID%}
Code:
[00:17:59 ERROR]: '{_output::TimeLeft} seconds' can't be added to {TimeExpire::%the UUID of the player%} because the former is not an object (GlobleBan.sk, line 32: add {_output::TimeLeft} seconds to {TimeExpire::%player's UUID%}')
Reqn (v1.2.3), Skript-JSON (v1.0.0)
Additional Infomation:
The API will return a string of JSON like below
Code:
{"UUID":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","Warnings":"0","TimeLeft":83289}
If there is no record, it will return
Code:
{"UUID":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","Warnings":"0"}
Troubleshooting:
Have you tried searching the docs? Yes
Have you tried searching the forums? Yes
What other methods have you tried to fix it? I found a post suggest to phrase the variable to integer to be possible to be calculated, but the post doesn't suggest a way to be implement in my case.
https://forums.skunity.com/threads/issues-with-subtracting-from-variables.3272/