PlusEMU Command Cooldown?

Supermario

Member
Jan 5, 2016
99
0
Hi,

Anyone know how to code in a cooldown period for the command usage so people don't spam it 100 times in the room in less than 2 minutes?
 
bump.........
 
May 1, 2015
470
154
Code:
TimeSpan Cooldown = DateTime.Now - PlusEnvironment.CommandExecuted;
                if (Cooldown.Seconds >= 5)
                {
                   // ur code here
                  PlusEnvironment.CommandExecuted = DateTime.Now;
                }

                else
                {
                    int num = checked(5 - Cooldown.Seconds);
                    Session.SendWhisper("Cooldown! You must wait 5 seconds until you can do that!");
               
                }
            }

Add
Code:
public static DateTime CommandExecuted;
to plusenvironment.cs
 

Meap

Don't need glasses if you C#
Nov 7, 2010
1,045
296
Code:
TimeSpan Cooldown = DateTime.Now - PlusEnvironment.CommandExecuted;
                if (Cooldown.Seconds >= 5)
                {
                   // ur code here
                  PlusEnvironment.CommandExecuted = DateTime.Now;
                }

                else
                {
                    int num = checked(5 - Cooldown.Seconds);
                    Session.SendWhisper("Cooldown! You must wait 5 seconds until you can do that!");
              
                }
            }

Add
Code:
public static DateTime CommandExecuted;
to plusenvironment.cs
Surely you'd want to do that in Habbo.cs because PlusEnvironment would be globally so it would affect every user and not the individual user
 

Damien

Don't need glasses if you can C#
Feb 26, 2012
434
647
Surely you'd want to do that in Habbo.cs because PlusEnvironment would be globally so it would affect every user and not the individual user
Or even better yet in the roomuser.cs. Commands are initiated from the room so if the user leaves, or goes to the hotelview the timer will reset.
 

Supermario

Member
Jan 5, 2016
99
0
Code:
TimeSpan Cooldown = DateTime.Now - PlusEnvironment.CommandExecuted;
                if (Cooldown.Seconds >= 5)
                {
                   // ur code here
                  PlusEnvironment.CommandExecuted = DateTime.Now;
                }

                else
                {
                    int num = checked(5 - Cooldown.Seconds);
                    Session.SendWhisper("Cooldown! You must wait 5 seconds until you can do that!");
             
                }
            }

Add
Code:
public static DateTime CommandExecuted;
to plusenvironment.cs

Surely you'd want to do that in Habbo.cs because PlusEnvironment would be globally so it would affect every user and not the individual user

Or even better yet in the roomuser.cs. Commands are initiated from the room so if the user leaves, or goes to the hotelview the timer will reset.

Thank you so much, Where should I put this code? Plusenvironment.cs, Habbo.cs, or roomuser.cs ????? @Damien @Meap @Altercationz
 

Supermario

Member
Jan 5, 2016
99
0
Teamviewer?

sure 601 848 532 8928
 
Teamviewer?

@Altercationz Hey man, Thank you for taking the time to go on my TeamViewer to help me. I still have that one issue still, The example regarding hug I showed you on TeamViewer. When I use the Hug command and get the cooldown basically I can't use any other command, I have to wait 10 seconds in order to use any other command, I do not want it to be that way, I want to be able to use any other command, If It's possible. I also want the cooldown to affect the person who used the command, not affect the whole hotel.
 
Last edited:

Users who are viewing this thread

Top