The online racing simulator
Help about afk system
(13 posts, started , go to first unread)
Help about afk system
I have the afk timer made by Bassdriver, but I now want the player who remains motionless for a certain period of time to be thrown at the audience. I checked Bassdriver's codes but I couldn't run it. Can you help me?
https://www.lfs.net/forum/post/1645969#post1645969 ı have a lapper version 7.0.8.1
@Bass-Driver
The mentioned script is over 12 years old and might not be working in recent versions of Lapper.
Looking at the script, it should spectate a player that is idle for 600 seconds (10 minutes).
Main problem is that the code probably won't work with recent versions of Lapper and has to be converted first.
https://www.lfs.net/forum/post/1646256#post1646256 I also tried Karry's edit, but I couldn't get any results.


-------------------------------------------------------------------------


#$IdleExclude = "Lagamel,Gai-Luron"; # Usernames excluded for idle check
/*
$OnIdleTimeout1 = 60; # Idle timeout for OnIdleAction1 in seconds

Event OnIdle1( $userName ) # Player event
UserGroupFromFile( "idleExempt", "./idleexempt.txt" );
IF( UserInGroup( "idleExempt",$userName ) == 0 )
THEN
privMsg( langEngine( "%{main_idle1}%" ) );
ENDIF
EndEvent

$OnIdleTimeout2 = 120; # Idle timeout for OnIdleAction2 in seconds

Event OnIdle2( $userName ) # Player event
UserGroupFromFile( "idleExempt", "./idleexempt.txt" );
IF ( UserInGroup( "idleExempt",$userName ) == 0 )
THEN
cmdLFS ( "/spec " . GetCurrentPlayerVar("Nickname") );
privMsg ( langEngine( "%{main_idle2}%" ) );
ENDIF
EndEvent
*/

There is such a directory in Lapper, but it does not work either.
** Best answer **
The code is not working, because it is excluded by using /* (this means, start of the exclude) and */ (this means, end of the exlude).

Also good to know, to exclude a single line, just put a # in front of it and Lapper will ignore that line.
Removing the # will enable it again.

So by removing the start and ending of the exclude, that code should start to work and should look like this:


<?php 
$OnIdleTimeout1 
60# Idle timeout for OnIdleAction1 in seconds

Event OnIdle1$userName # Player event
    
UserGroupFromFile"idleExempt""./idleexempt.txt" );
    IF( 
UserInGroup"idleExempt",$userName ) == )
    
THEN
        privMsg
langEngine"%{main_idle1}%" ) );
    ENDIF
EndEvent

$OnIdleTimeout2 
120# Idle timeout for OnIdleAction2 in seconds

Event OnIdle2$userName # Player event
    
UserGroupFromFile"idleExempt""./idleexempt.txt" );
    IF ( 
UserInGroup"idleExempt",$userName ) == )
    
THEN
        cmdLFS 
"/spec " GetCurrentPlayerVar("Nickname") );
        
privMsg langEngine"%{main_idle2}%" ) );
    ENDIF
EndEvent
?>


Thanks👌
Quote from Yisc[NL :;2065935"]The code is not working, because it is excluded by using /* (this means, start of the exclude) and */ (this means, end of the exlude).

Also good to know, to exclude a single line, just put a # in front of it and Lapper will ignore that line.
Removing the # will enable it again.

So by removing the start and ending of the exclude, that code should start to work and should look like this:


<?php 
$OnIdleTimeout1 
60# Idle timeout for OnIdleAction1 in seconds

Event OnIdle1$userName # Player event
    
UserGroupFromFile"idleExempt""./idleexempt.txt" );
    IF( 
UserInGroup"idleExempt",$userName ) == )
    
THEN
        privMsg
langEngine"%{main_idle1}%" ) );
    ENDIF
EndEvent

$OnIdleTimeout2 
120# Idle timeout for OnIdleAction2 in seconds

Event OnIdle2$userName # Player event
    
UserGroupFromFile"idleExempt""./idleexempt.txt" );
    IF ( 
UserInGroup"idleExempt",$userName ) == )
    
THEN
        cmdLFS 
"/spec " GetCurrentPlayerVar("Nickname") );
        
privMsg langEngine"%{main_idle2}%" ) );
    ENDIF
EndEvent
?>



Hello, the shared code is not working right now. I had to switch to a different lapper due to a TCP memory error. But currently, it does not broadcast to the audience in version 7.0.7.1. But warning messages are coming. He doesn't just throw it at the audience.https://hizliresim.com/86kuxr8
Your comment is a bit weird, probably because of a translation issue.
I am guessing you mean that no global message is send when someone is spectated.
That's because "privMsg" is used, which sends a private message to the play involved.
To send the message to everyone, just use "GlobalMsg"
Quote from Yisc[NL :;2068448"]Your comment is a bit weird, probably because of a translation issue.
I am guessing you mean that no global message is send when someone is spectated.
That's because "privMsg" is used, which sends a private message to the play involved.
To send the message to everyone, just use "GlobalMsg"

What I mean is, it gives an afk warning. But he doesn't throw me at the audience.
You should look into cmdLFS function, this is the part of the code that should execute the spectate command. I don't know where in laper this function is declared, but maybe there is some sintax error..
I found a mistake in the code.
You cannot spectate the NickName of the player.

cmdLFS ( "/spec " . GetCurrentPlayerVar("Nickname") );

NickName should be UserName
Quote from Bass-Driver :I found a mistake in the code.
You cannot spectate the NickName of the player.

cmdLFS ( "/spec " . GetCurrentPlayerVar("Nickname") );

NickName should be UserName

Thanks.
Feels good to be right Smile

Help about afk system
(13 posts, started )
FGED GREDG RDFGDR GSFDG