The online racing simulator
Fast command
Hi, how can I warn people who use fast commands? I have Event OnFlood but it's not what I want and it doesn't seem to work with commands.
For example, instead of kicking, I want not to use commands for a certain period of time, can I do that?
What kind of commands are you talking about?
using commands too fast can cause my insim to crash, for example, when I use !rp 5 or 6 times in a row, there is a slowness
Add this piece of code to Event OnMSO above this line:

SWITCH( $command )


<?php 
    
IF (GetLapperVar("ShortTime") >= GetCurrentPlayerVar"control_commands"))
    
THEN
      $time_splitted 
SplitToArrayGetLapperVar("ShortTime"),":" ); #split ShortTime into an array
      
$time_splitted[1] = $time_splitted[1] + 1#add one minute to the current minutes

      # Check if minutes has value 60 or above. If so, raise hours by one and lower minutes by sixty
      
IF ($time_splitted[1] >= 60)
      
THEN
        $time_splitted
[0] = $time_splitted[0] + 1;
        
$time_splitted[1] = $time_splitted[1] - 60;
      ENDIF

      
# Check if hours has value 24. If so, reduce hours by 24
      
IF ($time_splitted[0] == 24)
      
THEN
        $time_splitted
[0] = $time_splitted[0] - 24;
      ENDIF

      
# Merge hours and minutes into one value
      
$pace_control_time "" $time_splitted[0] . ":" $time_splitted[1];

      
# Set player var 'control_command' to the new time stamp
      
SetCurrentPlayerVar"control_commands"$pace_control_time );
?>

Add this piece of code to Event OnMSO the after this line:

ENDSWITCH


<?php 
    
ELSE
      
PrivMsg("^1You have to wait until it is ^3(" GetCurrentPlayerVar"control_commands") . ")^1 , to be able to execute a command");
    ENDIF
?>

Maybe you only want the tempo control on certain commands.
That's possible by adding this sub-event:


<?php 
Sub pace_control_command
$KeyFlags,$id )
    IF (
GetLapperVar("ShortTime") >= GetCurrentPlayerVar"control_commands"))
    
THEN
      $time_splitted 
SplitToArrayGetLapperVar("ShortTime"),":" ); #split ShortTime into an array
      
$time_splitted[1] = $time_splitted[1] + 1#add one minute to the current minutes

      # Check if minutes has value 60 or above. If so, raise hours by one and lower minutes by sixty
      
IF ($time_splitted[1] >= 60)
      
THEN
        $time_splitted
[0] = $time_splitted[0] + 1;
        
$time_splitted[1] = $time_splitted[1] - 60;
      ENDIF

      
# Check if hours has value 24. If so, reduce hours by 24
      
IF ($time_splitted[0] == 24)
      
THEN
        $time_splitted
[0] = $time_splitted[0] - 24;
      ENDIF

      
# Merge hours and minutes into one value
      
$pace_control "" $time_splitted[0] . ":" $time_splitted[1];

      
# Set player var 'control_command' to the new time stamp
      # Set player var 'control_command_allowd' to "yes"
      
SetCurrentPlayerVar"control_commands"$pace_control );
      
SetCurrentPlayerVar"control_commands_allowed""yes" );
    ELSE
      
# Set player var 'control_command_allowd' to "no"
      
SetCurrentPlayerVar"control_commands_allowed""no" );
    ENDIF
EndSub
?>


Then the command you want to check on, should look like this:


<?php 
        
CASE "!test":
            
pace_control_command0,);
            IF (
GetCurrentPlayerVar"control_commands_allowed" ) == "yes" )
            
THEN
              MyTest
();
            ELSE
              
PrivMsg("^1You have to wait until it is ^3(" GetCurrentPlayerVar"control_commands") . ")^1 , to be able to execute this command");
            ENDIF
            BREAK;
?>

thanks I will try
It might be a bit boring to wait 1 minute for each command, can we make it 20 seconds or can we wait 1 minute if we use 3 or 4 commands instead of each command?
Sure, you can make it 20 seconds (or any time you want).
Adjust the code to use the long time-format of Lapper, add the seconds and add an extra check to see if seconds have gone above 60.
Thanks I will try to do it

FGED GREDG RDFGDR GSFDG