Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    ReeceDaBeast's Avatar
    Join Date
    May 2013
    Gender
    male
    Posts
    340
    Reputation
    10
    Thanks
    778
    My Mood
    Stressed

    Ability Cooldown (People with Coding Knowledge)

    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));
                }
    Code:
            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));
                    }
    Galiu is just staying if youre connected to the server or not

    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.

  2. #2
    bluuman's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    localhost
    Posts
    629
    Reputation
    10
    Thanks
    889
    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?

  3. #3
    ReeceDaBeast's Avatar
    Join Date
    May 2013
    Gender
    male
    Posts
    340
    Reputation
    10
    Thanks
    778
    My Mood
    Stressed
    Quote Originally Posted by bluuman View Post
    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?
    What you just said, I can't cloak for the ability time + the cooldown time even though I am uncloaked

  4. #4
    bluuman's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    localhost
    Posts
    629
    Reputation
    10
    Thanks
    889
    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.

  5. #5
    ReeceDaBeast's Avatar
    Join Date
    May 2013
    Gender
    male
    Posts
    340
    Reputation
    10
    Thanks
    778
    My Mood
    Stressed
    Quote Originally Posted by bluuman View Post
    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.
    I am new to this stuff with Krelay and stuff so if you could add me on skype and help id love you

    What debugger are you talking about? The Krelay console plugin?

  6. #6
    toddddd's Avatar
    Join Date
    Sep 2016
    Gender
    male
    Posts
    720
    Reputation
    46
    Thanks
    6,363
    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).

  7. #7
    ReeceDaBeast's Avatar
    Join Date
    May 2013
    Gender
    male
    Posts
    340
    Reputation
    10
    Thanks
    778
    My Mood
    Stressed
    Quote Originally Posted by toddddd View Post
    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

  8. #8
    bluuman's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    localhost
    Posts
    629
    Reputation
    10
    Thanks
    889
    Quote Originally Posted by ReeceDaBeast View Post
    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.

  9. #9
    NisuxenZ's Avatar
    Join Date
    Jan 2014
    Gender
    male
    Posts
    127
    Reputation
    21
    Thanks
    715
    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.

  10. #10
    toddddd's Avatar
    Join Date
    Sep 2016
    Gender
    male
    Posts
    720
    Reputation
    46
    Thanks
    6,363
    Quote Originally Posted by ReeceDaBeast View Post
    The UseItem Packet is being sent right before you uncloak
    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.

  11. #11
    bluuman's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    localhost
    Posts
    629
    Reputation
    10
    Thanks
    889
    Quote Originally Posted by toddddd View Post
    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.

  12. #12
    ReeceDaBeast's Avatar
    Join Date
    May 2013
    Gender
    male
    Posts
    340
    Reputation
    10
    Thanks
    778
    My Mood
    Stressed
    Quote Originally Posted by bluuman View Post
    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 know it works but I am just trying to figure out why you can't cloak after you use it and yes there are some bugs in it.

  13. #13
    toddddd's Avatar
    Join Date
    Sep 2016
    Gender
    male
    Posts
    720
    Reputation
    46
    Thanks
    6,363
    Quote Originally Posted by ReeceDaBeast View Post
    I know it works but I am just trying to figure out why you can't cloak after you use it and yes there are some bugs in it.
    I just explained why your ability is on cooldown after the last packet is sent. Add more time inbetween each packet.

  14. #14
    ReeceDaBeast's Avatar
    Join Date
    May 2013
    Gender
    male
    Posts
    340
    Reputation
    10
    Thanks
    778
    My Mood
    Stressed
    Quote Originally Posted by toddddd View Post
    I just explained why your ability is on cooldown after the last packet is sent. Add more time inbetween each packet.
    So will you still be permacloaked or is there a time between cloak like auto ability?

  15. #15
    toddddd's Avatar
    Join Date
    Sep 2016
    Gender
    male
    Posts
    720
    Reputation
    46
    Thanks
    6,363
    Quote Originally Posted by ReeceDaBeast View Post
    So will you still be permacloaked or is there a time between cloak like auto ability?
    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.

Page 1 of 2 12 LastLast

Similar Threads

  1. [Tutorial] To people who need help with coding!
    By soappFunK in forum Counter-Strike 2 Coding & Resources
    Replies: 0
    Last Post: 11-05-2016, 05:34 PM
  2. Helping people with Hacks and krelay and really anything to the best of my knowledge!
    By MilkJug in forum Realm of the Mad God Tutorials & Source Code
    Replies: 30
    Last Post: 06-07-2016, 04:52 AM
  3. Help with codes
    By kalwarbo2008 in forum C++/C Programming
    Replies: 8
    Last Post: 07-26-2008, 08:58 AM
  4. Help With Coding Please
    By pbguy145 in forum WarRock - International Hacks
    Replies: 1
    Last Post: 10-10-2007, 06:52 PM
  5. trouble with code
    By cool4345 in forum WarRock Korea Hacks
    Replies: 3
    Last Post: 05-28-2007, 11:36 AM