############################################ #Name of script: ConnectedTime #Date of build: 14-04-2017 #Author: Bass-Driver #Version: V1.0 ############################################ ############################################ ###CHANGES:### #Nothing yet ############################################ #Event executes when you (re)start LFSLapper Event OnLapperStart() RegisterScheduleAction( "0 * * * * * *", Timer_Sub); #Timeraction executes each minute EndEvent Sub Timer_Sub() $PlayerList = GetListOfPlayers("U"); #Get list of all players in the server FOREACH ($Driver IN $PlayerList) #Check each player one by one. SetPlayerVar($Driver["value"],"ConnectedTime",GetPlayerVar($Driver["value"],"ConnectedTime")+1); #(ConnectedTime=ConnectedTime+1) ENDFOREACH EndSub #Event when player connect to the server Event OnConnect( $userName ) SetPlayerVar($userName,"ConnectedTime",0); #Set PlayerVar EndEvent #PlayerMessage Event. Event OnMSO( $userName, $text ) # Player event $idxOfFirtsSpace = indexOf( $text, " "); IF( $idxOfFirtsSpace == -1 ) THEN $command = $text; $argv = ""; ELSE $command = subStr( $text,0,$idxOfFirtsSpace ); $argv = trim( subStr( $text,$idxOfFirtsSpace ) ); ENDIF SWITCH( $command ) CASE "!conntime": #Command !conntime privmsg("^7Connected Time of ".GetPlayerVar($argv,"NickName"). " ^7is ^3".GetPlayerVar($argv,"ConnectedTime")); #Get PlayerVar(ConnectedTime) BREAK; ENDSWITCH EndEvent