Please be more specific? When you uncloak the ability is on cooldown, unless you use packets to circumvent that cooldown (which it seems you did). What is the issue you are facing here?
So I am trying to make a user friendly permacloak plugin and I have it setup and it works but whenever you uncloak, the ability acts like you've used it so it is on cooldown even though you aren't invisible
This is what I have
Code:private void SendUseItem(Client client, int i, int v) { if (galiu) { client.PreviousTime = client.PreviousTime + i; UseItemPacket useItem = _useItemMap[client]; useItem.Time = client.Time; useItem.ItemUsePos = client.PlayerData.Pos; client.SendToServer(useItem); v++; if (v < TimesRepeat) PluginUtils.Delay(itemUseTime - 100, () => SendUseItem(client, 1150 * v, v)); }Galiu is just staying if youre connected to the server or notCode:private void OnUseItem(Client client, Packet packet) { if (client.PlayerData.Class == Classes****gue) { _useItemMap[client] = packet as UseItemPacket; UseItemPacket us = (UseItemPacket)packet; if (us.SlotObject.SlotId == 1 && _enabled) { PluginUtils.Delay(itemUseTime - 100, () => SendUseItem(client, 1150, 1)); }
Can anyone help tell me why it is on cooldown and possibly fix it. Also you can add me on skype in my signature if you want.
Please be more specific? When you uncloak the ability is on cooldown, unless you use packets to circumvent that cooldown (which it seems you did). What is the issue you are facing here?
Your packets look fine, it should work unless there was an update to the server checks for ablities. Make sure your bools are true and your statements are being met, try running this code through the debugger to see if some condition is failing causing the program not to run.
Last edited by ReeceDaBeast; 02-21-2017 at 07:48 PM.
So i have a question here for ya, looking at your code how often are you sending the useitem packet to cloak yourself?
The normal cloaking ability will have a cooldown lasting longer then your cloak lasts, and you can generally bypass this by sending the useitem packet again right after you come uncloaked. But the clients cooldown will be from the last useitem packet that is sent (from what i recall), even if that useitem packet didnt actually trigger your cloak (possibly because you sent it too early and the server refused to cloak you).
The UseItem Packet is being sent right before you uncloak (You can change the item it is being sent but I send it at 5500 which is when you uncloak) but it works. It seems like it is doing what youre saying though, like it sends the useItem packet but doesn't let you cloak and it goes on cooldown but it does work to an extent
You are using einara's permacloak plugin, correct? I've ran through the code, and although the commands are a bit confusing, I've verified that the program still works. Please list me off the commands you are running in your chat.
https://i.imgur.com/jwhjfZ5.gif
Make sure you have adequate mana (using an item checks your server mana before allowing you to use, it is to fix an old exploit where people would spam abilities and crash servs). If you can't figure this out, ill probably re-release a plugin like this soon, with an updated flow (noticed a few glitches with this current plugin).
Last edited by bluuman; 02-21-2017 at 08:22 PM.
There is a 0.5 second cooldown between the end of the cloak and when the server will accept another cloak ability use. Last time I checked (2 years ago?) the server didn't care what time you sent with the ability packet so you were able to literally never decloak by messing with it. So plan around that unless it's been changed.
Thats your problem. What @NisuxenZ just posted is correct, you cant cloak before your cloak time expires anymore. If you look at the permacloak plugin (or atleast when i last looked at it), it would send the next useitem packet about .5 seconds AFTER your uncloak, not before. So what you are experiencing is the fact that you sent a useitem packet before the cooldown was over, which reset the clients cooldown timer even though you didnt cloak. Add another second of delay before sending the useitem packet and you should be fine.
I also strongly suggest adding a full second instead of just trying to send it right as you uncloak because the server will disconnect you if you sent too many useitem packets in a row with no actual break between when the ability ends and the next starts. I think i was able to cloak about 3-4 times back to back and the 5th would dc me (this was a few months ago when i was trying it). But if i allowed that .5 seconds between cloaks, you can do it as many times as you want.
You are right in that the client will not allow nor will the server accept a useitem packet before the cooldown is over, but I just want to clarify that you can still send the use item packet before cool down, but the server will only allow it if you increase your client time sent in the packet by the time remaining in the cooldown(plus a little extra for safety). That is where the coefficient 1150 (it's the cooldown remaining that we need to account for by adding it to the clients time in our forged packet) comes in in the sendUseItem method of this code. This is also why we get disconnected when using this code.
I told you to allow about a 0.5 second break between cloaks. This will prevent you from getting disconnected and prevent the issue you where asking about. So no you arent constantly cloaked, but its only 0.5 seconds where you arent. And like i and others have said, if you dont allow for a small break between cloaks the server will disconnect you after a couple times.