Solved Help with this

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

verycoolguy123

Active Member
Jul 31, 2017
70
2
0
54
Hello, I'd like to know how to stop a player from obtaining a certain item with a certain name by replace it with another item. I've been trying to do it but I almost always get stuck with making a periodical event and that really lags the server. How could I check the inventory of every player, check if they have that specific item and replace it with another item if they do indeed have it?
 
code_language.skript:
on pickup of dirt:
    if name of event-item is "BAE":
        remove event-item from player's inventory
        add grass named "BAE" to player's inventory
 
Well, there is no event to detect that. You could try asking the developer of that plugin if he can change that item? Shouldn't be hard.
Hmm, is there a more efficient way to scan a player's inventory periodically and do the rest of the events? The thing I'm doing will only last for a small period of time so I wouldn't mind if it was a periodic event as long as it doesn't lag the server as much.
 
That's the only way you can do that , works but isn't efficient.
code_language.skript:
every 1 second:
    loop all players:
        if loop-player has [item]:
           remove [item] from loop-player's inventory
           add [item] named "BAE" to loop-player's inventory
 
That's the only way you can do that , works but isn't efficient.
code_language.skript:
every 1 second:
    loop all players:
        if loop-player has [item]:
           remove [item] from loop-player's inventory
           add [item] named "BAE" to loop-player's inventory
I wouldn't use a periodical event, these are so unefficient. Better to use a while loop in the skript load event.
 
I wouldn't use a periodical event, these are so unefficient. Better to use a while loop in the skript load event.

Ya , you're right.
But i think that the best way is just change the item in the main plugin, if it has source too , should be really easy to do and without asking the dev.
 
Ya , you're right.
But i think that the best way is just change the item in the main plugin, if it has source too , should be really easy to do and without asking the dev.
The plugin is heavily obfuscated and the developer would not want to do that as it is not a heavily requested feature and I doubt any other person would want that.
Yeah, I think the same, I can do this freely if it's open sourced.
It is not
 
Well, I guess I'll mark it as solved. The periodical event is, while not efficient, the only solution. I do not REALLY mind it as this will only affect the server for a very short period of time, but there is no other answer. Thanks for your support.
 
Well, I guess I'll mark it as solved. The periodical event is, while not efficient, the only solution. I do not REALLY mind it as this will only affect the server for a very short period of time, but there is no other answer. Thanks for your support.

Here you go , sorry for not find a better one.
 
Status
Not open for further replies.