#Hello, I want to make a javascript placeholder

1 messages · Page 1 of 1 (latest)

ripe shard
#

I took an example from the website https://github.com/PlaceholderAPI/Javascript-Expansion/wiki/Community-Scripts#has-permission and I replaced the placeholder there with the one that I will use, but not the example, not my code does not work, other javascript placeholder examples from this site work, I connected the file correctly, all the necessary dependencies are also there, the placeholder that I want to use in the script is also working

file code

// create a variable and name it wantever you want like this
// and use the placeholder you want, i'm using this one
var haspermission = "%checkitem_amount_mat:string%";

// create a function with the name you want
function permission() {

// if the haspermission variable that we created before return yes (true boolean)
// the js placeholder will return what we set in the return down
   if (haspermission == 0) {
       return "&aYou have the Test permission!";
   }

// if the haspermission varibale wasnt true it will return what we set down
   else {
       return "&cYou don't have the Test permission!";
   }
}
// by this we are calling the function to run
permission();```
the file is connected correctly, if you insert another code into it, it will work.
```js
example:
  file: example.js
souls:
  file: souls_tag.js```
twin radish
#

Does the code run at all? Or what exactly is the issue here?

ripe shard
#

the javascript placeholder that is received when exiting does not show anything

#

the example also doesn't show anything.

ripe shard
#

@twin radish Please help me figure out what the problem

twin radish
#

Hello. I've looked at the code and I am quite stumped. Only other thing I can suggest is maybe change it to == "0"

ripe shard
#

I have already tried it and it doesn't work

#

An official example from documentation does not work.