# Parc ferme V1.00 21-11-15 - Initial release # ################################################################# CatchEvent 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 "!setnode": IF( UserInGroup( "admin", $userName ) == 1 ) THEN Register_node( $KeyFlags,$id ); ELSE PrivMsg( "^1You are not allowed to do that"); ENDIF BREAK; ENDSWITCH EndCatchEvent CatchEvent OnLapperStart() OnLapperStart_Node_counter(); EndCatchEvent CatchEvent OnRaceStart( $NumP ) # Lapper event ORS_Reset_node_count(); EndCatchEvent Sub OnLapperStart_Node_counter() ### Declare global variable and give it a value ### GlobalVar $people_in_node; $people_in_node=0; ### End ### EndSub Sub Register_node( $KeyFlags,$id ) ### Register node the player is currently in ### #PrivMsg ( "^7DEBUG: " . GetCurrentPlayerVar ( "CurrNode" ) ); RegisterNodeAction( getLapperVar ( "ShortTrackName" ) , GetCurrentPlayerVar ( "CurrNode" ) , Count_node_plus, Count_node_minus ); ### End ### EndSub Sub Count_node_plus ( $KeyFlags ) ### Raise the number of people in the node by 1 and if the total is above 3, spectate the last person that entered the node and set counter back to 3 ### $people_in_node=$people_in_node+1; #PrivMsg ( "^7DEBUG: " . $people_in_node ); IF ( $people_in_node > 3 ) THEN cmdLFS("/spec " . GetCurrentPlayerVar("UserName") ); $people_in_node=$people_in_node-1; ENDIF ### End ### EndSub Sub Count_node_minus ( $KeyFlags ) ### Lower the number of people in the node by 1 and if total goes below 0, set it back to 0 ### $people_in_node=$people_in_node-1; IF ( $people_in_node < 0 ) THEN $people_in_node=0; ENDIF #PrivMsg ( "^7DEBUG: " . $people_in_node ); ### End ### EndSub Sub ORS_Reset_node_count () ### Set the counter back to 0 at the start of each race ### $people_in_node=0; ### End ### EndSub