# Author: Yisc[NL] # # Lapper version needed: 7.0.4.8 or above # # # # Schedule_set - V1.01 12-02-2012 -Initial release # # Schedule_set - V1.02 20-02-2012 -Added multiple server options # # Schedule_set - V1.03 25-02-2012 -Polished loading code # # Schedule_set - V1.03b 26-02-2012 -Fixed a minor bug in close # # Schedule_set - V1.03c 03-06-2014 -Fixed minor bug in Sub Set_Schedule # # Schedule_set - V1.04 21-01-2015 -Added Race ID option to match handicaps # # Schedule_set - V2.00.1 ALPHA 22-09-2017 -Complete re-write of the module for more efficient code # # -Added DELETE button to delete single server name # # -DELETE and LOAD buttons are dynamic now (no server name, no buttons) # # -Number of races are dynamic now, when an empty line is found, script ends # # -All entered information is saved instantly, so no need to save whole form # # -Added car select GUI # # -Added Weather,Wind,Qual length,Start order,Reset allowed,Cruise allowed # # -Added copy-function so that several values be set as default and then copied # # -Splitted password into event and regular password # # -When an empty value is entered, the current value will be deleted from the database # # -Added check for minimum race requirements (date,time,track,car(s),laps) # # -Added input validaton for all fields # # -Trackcode and car(s) can now be entered in lower case and are then automaticly put in upper case # # -Module should now be multi-user # # Schedule_Set - V2.00.2 ALPHA 22-09-2017 -Removed GlobalVar $storage_name_schdl and replaced it with a Set/GetCurrentPlayerVar( "storage_name_schdl" ) # # -Fixed a bug on data validation for Weather/Wind/Qual, which failed when a non-numeric value was entered # # -Fixed a bug that stopped the deletion of a servername # # Schedule_Set - V2.00.3 ALPHA 22-09-2017 -Fixed a bug that stopped entering valid trackcodes for AS,FE,KY and SO tracks # # Schedule_Set - V2.00.4 ALPHA 06-10-2017 -Added general configuration screen # # -Fixed two bugs in Sub 'config_cars' # # -Offered weather types are now based on the entered trackcode, data validation has been adjusted accordingly # # -Closing General Configuration Screen can now also be done by clicking the CFG button again # # -Added 'Cancel move race' button # # -When Set Schedule is started for the first time, General Config Setting must be set first before anything else # # Schedule_Set - V2.00.5 BETA 06-10-2017 -Program is feature complete, tested as much as possible, time to gather feedback and fix reported bugs/issues # # Schedule_Set - V2.00.6 BETA 08-10-2017 -Added check for entered timezone code to Sub 'config_time' # # -Added check for overlapping times when scheduling more races on the same day to Sub 'config_time' # # Schedule_Set - V2.00.7 BETA 10-10-2017 -Added a link to Race ID to be able to go straight into the Handicap System to set handicap settings # # Schedule_Set - V2.00.8 BETA 10-10-2017 -If handicaps are set for a Race ID, the ID will be displayed as green text, otherwise the text is in white # # Schedule_Set - V2.00.9 BETA 12-10-2017 -Fixed a bug where the Race ID was always changed, when the date of a race was changed # # -Made the columns for ID and More >>> a bit smaller # # -Made the column for Comment a bit bigger and extended input size from 30 to 40 characters # # -Limited Race ID to a maximum of 999, after that it will go back to 1 again # # -Added a check wether handicap settings needs to be deleted (and delete them when found), when deleting a race # # -Fixed a bug where the wrong Race ID was passed on to the Handicap System # # -Added routine to delete all handicap settings, when deleting the whole schedule of the current server # # Schedule_Set - V2.00.10 BETA 14-10-2017 -Rewritten all code for setting default values and option to copy them (to avoid going over 240 buttons limit) # # -Fixed a bug where weather code wasn't appearing when trackcode wasn't set, but no warning about it was given # # -Removed LOAD/DELETE buttons for servers and included those functions within the 'Server name X' buttons # # -Removed C(opy) button for servers and included that function within the 'Server name X' buttons # # Schedule_Set - V2.00.11 BETA 14-10-2017 -Fixed a bug where the Default buttons weren't closed when opening General Configuration screen # # Schedule_Set - V2.00.12 BETA 23-10-2017 -Fixed a bug in Sub 'config_schedule_interval' where $track_check_minutes were calculated wrongly when using H:M # # Schedule_Set - V2.01 31-10-2017 -Fixed a bug where the CFG-button was shown at an inappropriate moment # # -Added a message about having deleted a server name when no text is put in, to Sub 'config_server_name' # # -Clarified the text about having loaded the schedule of another server in Sub 'activate_server_name' # # -Moved the version out of BETA # # Schedule_Set - V2.02 27-12-2017 -Added UserGroupFromFile to Sub 'OnMSO' # # Schedule_Set - V2.03 09-04-2018 -Added option to add the name of a layout, incase an open config is used as track # # Schedule_Set - V2.04 21-04-2018 -Added option to add the numbers of splits that a layout has (number of splits is used to display correct size of PB) # # Schedule_Set - V2.05 22-04-2018 -Added option to add race length in hours (1-48) # # Schedule_Set - V2.06 25-08-2018 -Added option to add a default password for a server (will be used when no scheduled race is found) # # Schedule_Set - V2.07 01-06-2019 -Added a confirmation window when deleting a single race # # -Added a confirmation window when deleting the whole schedule of a server # # -Renamed $car_names to $car_names_set_schedule # # -Renamed $car_groups to $car_groups_set_schedule # ######################################################################################################################################################################### CatchEvent OnLapperStart() OnLapperStart_Set_Schedule(); EndCatchEvent 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 UserGroupFromFile( "admin", "./../AB-Configs/admin.txt" ); SWITCH( $command ) CASE "!set_schedule": CASE "!ss": IF( UserInGroup( "admin", $userName ) == 1 ) THEN SetCurrentPlayerVar( "more_options" , "no" ); IF ( GetStoredValue ( "SCHDL_GENERAL_RESET" ) == "" ) THEN ### Notify player that no general settings have been found and that they should be made first ### ### Set 'first_use' to "yes" to be able to hide CFG-button ### ### Go to Sub 'configure_schedule' #### PrivMsg ( "^7INFO: Set Schedule is started for the first time, please make the general configuration first" ); PrivMsg ( "^7INFO: After saving general settings, restart Lapper using command: !reload" ); SetCurrentPlayerVar( "first_use" , "yes" ); configure_schedule ( $KeyFlags,$id ); ### End ### ELSE SetCurrentPlayerVar( "first_use" , "no" ); Set_Schedule( $KeyFlags ); ENDIF ELSE PrivMsg( "^1You are not allowed to do that"); ENDIF BREAK; ENDSWITCH EndCatchEvent Sub OnLapperStart_Set_Schedule() ### Declare variables Schedule #### GlobalVar $version_set_schedule; GlobalVar $race_id_schdl; GlobalVar $car_names_set_schedule; GlobalVar $car_groups_set_schedule; GlobalVar $car_groups_explained; GlobalVar $close_gui_number; GlobalVar $mods_id_array; ### End ### ### Create variables Schedule ### $version_set_schedule = "V2.07"; ### End ### ### Declare arrays with car names ### $car_names_set_schedule[1,1] = "UF1"; $car_names_set_schedule[1,2] = "XFG"; $car_names_set_schedule[1,3] = "XRG"; $car_names_set_schedule[1,4] = "LX4"; $car_names_set_schedule[1,5] = "LX6"; $car_names_set_schedule[1,6] = "RB4"; $car_names_set_schedule[1,7] = "FXO"; $car_names_set_schedule[1,8] = "XRT"; $car_names_set_schedule[1,9] = "RAC"; $car_names_set_schedule[1,10] = "FZ5"; $car_names_set_schedule[1,11] = "UFR"; $car_names_set_schedule[1,12] = "XFR"; $car_names_set_schedule[1,13] = "FXR"; $car_names_set_schedule[1,14] = "XRR"; $car_names_set_schedule[1,15] = "FZR"; $car_names_set_schedule[1,16] = "MRT"; $car_names_set_schedule[1,17] = "FBM"; $car_names_set_schedule[1,18] = "FOX"; $car_names_set_schedule[1,19] = "FO8"; $car_names_set_schedule[1,20] = "BF1"; ### End ### ### Declare arrays with car groups and their explanation ### ### Starting with number 21 so that the numbers are still unique (needed for FOR loops) ### $car_groups_set_schedule[1,21] = "ALL"; $car_groups_set_schedule[1,22] = "ROAD"; $car_groups_set_schedule[1,23] = "RACE"; $car_groups_set_schedule[1,24] = "TBO"; $car_groups_set_schedule[1,25] = "LRF"; $car_groups_set_schedule[1,26] = "GTR"; $car_groups_explained[1,21] = "All cars"; $car_groups_explained[1,22] = "Road legal cars"; $car_groups_explained[1,23] = "Race cars"; $car_groups_explained[1,24] = "XRT+RB4+FXO"; $car_groups_explained[1,25] = "LX6+RAC+FZ5"; $car_groups_explained[1,26] = "FXR+XRR+FZR"; ### End ### EndSub Sub Set_Schedule ( $KeyFlags ) updatelistofmods(); $list_mods = getlistofmods(); FOR($i = 0; $i < ToNum($list_mods["numofmods"]); $i = $i + 1) $mods_id_array [1,$i] = "" . $list_mods[$i,"id"]; ENDFOR writeline ( "NBR of mods: " . ToNum($list_mods["numofmods"]) ); dumpVar ($car_names_set_schedule); dumpVar ($mods_id_array); writeline ( "debug 3b = " . $mods_id_array [1,0] ); writeline ( "debug 4b = " . $mods_id_array [1,463] ); ### Set server_name and storage_name ### IF ( GetCurrentPlayerVar( "server_name_schedule" ) == "" ) THEN SetCurrentPlayerVar( "server_name_schedule", StripLFSColor( getLapperVar( "HostName" ) ) ); ENDIF SetCurrentPlayerVar( "storage_name_schdl" , "SCHEDULE_" . GetCurrentPlayerVar( "server_name_schedule" ) ."_" ); ### End ### ### Get last used Race ID ### $race_id_schdl = GetStoredValue( "SCHDL_RACE_ID" ); IF ( $race_id_schdl == "") THEN $race_id_schdl=0; ENDIF ### End ### ### Set initial values for left/right and top/bottom coordinates ### $left_right_schedule = 1; $top_bottom_schedule = 30; ### End ### ### Draw the Schedule GUI ### openPrivButton( "schedule_gui_bg",$left_right_schedule,$top_bottom_schedule,192,138,5,-1,16,""); openPrivButton( "schedule_title",$left_right_schedule+1,$top_bottom_schedule+1,95,5,5,-1,32,"^7Schedule system " . $version_set_schedule ); openPrivButton( "schedule_server_name",$left_right_schedule+96,$top_bottom_schedule+1,90,5,5,-1,32,"^7Server name: " . getLapperVar( "HostName" ) ); openPrivButton( "schedule_server_cfg",$left_right_schedule+186,$top_bottom_schedule+1,5,5,5,-1,16,"^3CFG",configure_schedule ); FOR ($server=1;$server<=8;$server=$server+1) ### Set left/right coordinate based on which server will be displayed ### IF ( $server == 2 || $server == 4 || $server == 6 || $server == 8 ) THEN $left_right_schedule = 96; ELSE $left_right_schedule = 1; ENDIF ### End ### ### Retrieve server name from database ### $server_name = StripLFSColor( GetStoredValue( "SCHDL_SERVER_NAME_".$server ) ); $server_name_display = GetStoredValue( "SCHDL_SERVER_NAME_".$server ); $storage_name = "SCHEDULE_".$server_name."_"; $server_def_pwd = GetStoredValue( $storage_name . "DEF_PWD" ); ### End ### IF ( $server_name == GetCurrentPlayerVar( "server_name_schedule" ) ) THEN openPrivButton( "schedule_server_name_" . $server,$left_right_schedule+1,$top_bottom_schedule+11,20,5,5,-1,32,"^2Server name " . $server .":",activate_server_name ); ELSE IF ( $server_name != "" ) THEN openPrivButton( "schedule_server_name_" . $server,$left_right_schedule+1,$top_bottom_schedule+11,20,5,5,-1,32,"^3Server name " . $server .":",activate_server_name ); ELSE openPrivButton( "schedule_server_name_" . $server,$left_right_schedule+1,$top_bottom_schedule+11,20,5,5,-1,32,"^7Server name " . $server .":",activate_server_name ); ENDIF ENDIF IF ( $server_name == "" ) THEN openPrivTextButton( "schedule_server_name_input_" . $server,$left_right_schedule+21,$top_bottom_schedule+11,42,5,5,32,"^3Server name " . $server,"^3Click to set",40,config_server_name ); ELSE openPrivTextButton( "schedule_server_name_input_" . $server,$left_right_schedule+21,$top_bottom_schedule+11,42,5,5,32,"^3Server name " . $server,"^3".$server_name_display,40,config_server_name ); IF ( $server_def_pwd == "" ) THEN openPrivTextButton( "schedule_server_def_pwd_input_" . $server,$left_right_schedule+63,$top_bottom_schedule+11,30,5,5,32,"^3Default password server " . $server,"^3"."^3Click to set def. password",20,config_server_def_pwd ); ELSE openPrivTextButton( "schedule_server_def_pwd_input_" . $server,$left_right_schedule+63,$top_bottom_schedule+11,30,5,5,32,"^3Default password server " . $server,"^3".$server_def_pwd,20,config_server_def_pwd ); ENDIF ENDIF ### Raise top/bottom value by 5, after server 2/4/6 have been displayed ### IF ( $server == 2 || $server == 4 || $server == 6 ) THEN $top_bottom_schedule = $top_bottom_schedule + 5; ENDIF ### End ### ENDFOR close_layout_splits ( $KeyFlags,$id ); ### Reset values for left/right and top/bottom coordinates ### $left_right_schedule = 1; $top_bottom_schedule = 30; ### End ### openPrivButton( "schedule_delete_all_server_names",$left_right_schedule+1,$top_bottom_schedule+36,190,5,5,-1,32,"^3Delete all server names",delete_all_server_names ); openPrivButton( "schedule_number",$left_right_schedule+1,$top_bottom_schedule+46,5,5,5,-1,32,"^7#" ); openPrivButton( "schedule_date",$left_right_schedule+6,$top_bottom_schedule+46,13,5,5,-1,32,"^7Date:" ); openPrivButton( "schedule_time",$left_right_schedule+19,$top_bottom_schedule+46,15,5,5,-1,32,"^7Time:" ); openPrivButton( "schedule_track",$left_right_schedule+34,$top_bottom_schedule+46,9,5,5,-1,32,"^7Track:" ); openPrivButton( "schedule_cars",$left_right_schedule+48,$top_bottom_schedule+46,30,5,5,-1,32,"^7Cars:" ); openPrivButton( "schedule_laps",$left_right_schedule+81,$top_bottom_schedule+46,8,5,5,-1,32,"^7Laps:" ); IF ( GetCurrentPlayerVar( "time_def_value" ) == "" ) THEN openPrivTextButton( "schedule_time_default",$left_right_schedule+19,$top_bottom_schedule+51,15,5,5,32,"^3Set default time","^2Set default",10,config_default_settings ); ELSE openPrivTextButton( "schedule_time_default",$left_right_schedule+19,$top_bottom_schedule+51,15,5,5,32,"^3Set default time","^2" . GetCurrentPlayerVar( "time_def_value" ),10,config_default_settings ); ENDIF IF ( GetCurrentPlayerVar( "more_options" ) == "no" ) THEN openPrivButton( "schedule_event_pwd",$left_right_schedule+89,$top_bottom_schedule+46,20,5,5,-1,32,"^7Event pwd:" ); openPrivButton( "schedule_regular_pwd",$left_right_schedule+109,$top_bottom_schedule+46,20,5,5,-1,32,"^7Regular pwd:" ); openPrivButton( "schedule_comment",$left_right_schedule+129,$top_bottom_schedule+46,46,5,5,-1,32,"^7Comment:" ); openPrivButton( "schedule_race_id",$left_right_schedule+175,$top_bottom_schedule+46,5,5,5,-1,32,"^7ID:" ); openPrivButton( "schedule_more_options",$left_right_schedule+180,$top_bottom_schedule+46,11,5,5,-1,32,"^3More >>>",activate_more_options ); IF ( GetCurrentPlayerVar( "regular_pwd_def_value" ) == "" ) THEN openPrivTextButton( "schedule_regular_pwd_default",$left_right_schedule+109,$top_bottom_schedule+51,20,5,5,32,"^3Set default regular password","^2Set default",20,config_default_settings ); ELSE openPrivTextButton( "schedule_regular_pwd_default",$left_right_schedule+109,$top_bottom_schedule+51,20,5,5,32,"^3Set default regular password","^2" . GetCurrentPlayerVar( "regular_pwd_def_value" ),20,config_default_settings ); ENDIF ENDIF IF ( GetCurrentPlayerVar( "more_options" ) == "yes" ) THEN openPrivButton( "schedule_weather",$left_right_schedule+89,$top_bottom_schedule+46,15,5,5,-1,32,"^7Weather:" ); openPrivButton( "schedule_wind",$left_right_schedule+104,$top_bottom_schedule+46,15,5,5,-1,32,"^7Wind:" ); openPrivButton( "schedule_qual",$left_right_schedule+119,$top_bottom_schedule+46,15,5,5,-1,32,"^7Qual:" ); openPrivButton( "schedule_start",$left_right_schedule+134,$top_bottom_schedule+46,15,5,5,-1,32,"^7Start:" ); openPrivButton( "schedule_reset",$left_right_schedule+149,$top_bottom_schedule+46,15,5,5,-1,32,"^7Reset:" ); openPrivButton( "schedule_cruise",$left_right_schedule+164,$top_bottom_schedule+46,15,5,5,-1,32,"^7Cruise:" ); openPrivButton( "schedule_less_options",$left_right_schedule+179,$top_bottom_schedule+46,12,5,5,-1,32,"^3<<< Less",activate_less_options ); IF ( GetCurrentPlayerVar( "weather_def_value" ) == "" ) THEN openPrivTextButton( "schedule_weather_default",$left_right_schedule+89,$top_bottom_schedule+51,15,5,5,32,"^3Set default weather code","^2Set default",1,config_default_settings ); ELSE openPrivTextButton( "schedule_weather_default",$left_right_schedule+89,$top_bottom_schedule+51,15,5,5,32,"^3Set default weather code","^2" . GetCurrentPlayerVar( "weather_def_value" ),1,config_default_settings ); ENDIF IF ( GetCurrentPlayerVar( "wind_def_value" ) == "" ) THEN openPrivTextButton( "schedule_wind_default",$left_right_schedule+104,$top_bottom_schedule+51,15,5,5,32,"^3Set default wind code","^2Set default",1,config_default_settings ); ELSE openPrivTextButton( "schedule_wind_default",$left_right_schedule+104,$top_bottom_schedule+51,15,5,5,32,"^3Set default wind code","^2" . GetCurrentPlayerVar( "wind_def_value" ),1,config_default_settings ); ENDIF IF ( GetCurrentPlayerVar( "qual_def_value" ) == "" ) THEN openPrivTextButton( "schedule_qual_default",$left_right_schedule+119,$top_bottom_schedule+51,15,5,5,32,"^3Set default qualify length (max=240)","^2Set default",3,config_default_settings ); ELSE openPrivTextButton( "schedule_qual_default",$left_right_schedule+119,$top_bottom_schedule+51,15,5,5,32,"^3Set default qualify length (max=240)","^2" . GetCurrentPlayerVar( "qual_def_value" ),3,config_default_settings ); ENDIF IF ( GetCurrentPlayerVar( "start_def_value" ) == "" ) THEN openPrivTextButton( "schedule_start_default",$left_right_schedule+134,$top_bottom_schedule+51,15,5,5,32,"^3Set default start order","^2Set default",7,config_default_settings ); ELSE openPrivTextButton( "schedule_start_default",$left_right_schedule+134,$top_bottom_schedule+51,15,5,5,32,"^3Set default start order","^2" . GetCurrentPlayerVar( "start_def_value" ),7,config_default_settings ); ENDIF IF ( GetCurrentPlayerVar( "reset_def_value" ) == "" ) THEN openPrivTextButton( "schedule_reset_default",$left_right_schedule+149,$top_bottom_schedule+51,15,5,5,32,"^3Set default reset allowed value","^2Set default",3,config_default_settings ); ELSE openPrivTextButton( "schedule_reset_default",$left_right_schedule+149,$top_bottom_schedule+51,15,5,5,32,"^3Set default reset allowed value","^2" . GetCurrentPlayerVar( "reset_def_value" ),3,config_default_settings ); ENDIF IF ( GetCurrentPlayerVar( "cruise_def_value" ) == "" ) THEN openPrivTextButton( "schedule_cruise_default",$left_right_schedule+164,$top_bottom_schedule+51,15,5,5,32,"^3Set default cruise allowed value","^2Set default",3,config_default_settings ); ELSE openPrivTextButton( "schedule_cruise_default",$left_right_schedule+164,$top_bottom_schedule+51,15,5,5,32,"^3Set default cruise allowed value","^2" . GetCurrentPlayerVar( "cruise_def_value" ),3,config_default_settings ); ENDIF ENDIF $top_bottom_schedule = 86; SetCurrentPlayerVar( "check_empty_row" , 0 ); FOR ($race_number=1;$race_number<=14;$race_number=$race_number+1) IF ($race_number < 10) THEN $number="0".$race_number; ELSE $number=$race_number; ENDIF ### When PlayerVar 'check_empty_row' reaches value 1, set PlayerVar 'data_check' to "not_okay" ### ### Then start to loop through the possible remaining number of race and look for a filled 'date' field ### ### If found one, set PlayerVar 'check_empty_row' to value 0 and BREAK out of the for-loop ### ### In case PlayerVar 'data_check' is still set at "not_okay" once the for-loop completed, then BREAK out of for-loop showing the scheduled races ### IF ( GetCurrentPlayerVar( "check_empty_row" ) == 1 ) THEN SetCurrentPlayerVar( "data_check" , "not_okay" ); FOR ($data_check=$race_number;$data_check<=14;$data_check=$data_check+1) IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_".$data_check ) != "" ) THEN SetCurrentPlayerVar( "data_check" , "okay" ); SetCurrentPlayerVar( "check_empty_row" , 0 ); BREAK; ENDIF ENDFOR IF ( GetCurrentPlayerVar( "data_check" ) == "not_okay" ) THEN BREAK; ENDIF ENDIF ### End ### IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_".$race_number ) != "" ) THEN IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "time_".$race_number ) == "" || GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ) == "" || GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cars_".$race_number ) == "" || GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "laps_".$race_number ) == "" ) THEN openPrivButton( "schedule_number_".$race_number,$left_right_schedule+1,$top_bottom_schedule,5,5,5,-1,96,"^1".$number.": ", move_delete_race ); ELSE openPrivButton( "schedule_number_".$race_number,$left_right_schedule+1,$top_bottom_schedule,5,5,5,-1,96,"^7".$number.": ", move_delete_race ); ENDIF ELSE openPrivButton( "schedule_number_".$race_number,$left_right_schedule+1,$top_bottom_schedule,5,5,5,-1,96,"^7".$number.": ", move_delete_race ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_".$race_number ) == "" ) THEN openPrivTextButton( "schedule_date_input_".$race_number,$left_right_schedule+6,$top_bottom_schedule,13,5,5,32,"^3Date (DD-MM-YY) race ".$race_number,"^3Set",8,config_date ); SetCurrentPlayerVar( "check_empty_row" , GetCurrentPlayerVar( "check_empty_row" ) +1 ); ELSE openPrivTextButton( "schedule_date_input_".$race_number,$left_right_schedule+6,$top_bottom_schedule,13,5,5,32,"^3Date (DD-MM-YY) race ".$race_number,"^3".GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_".$race_number ),8,config_date ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "time_".$race_number ) == "" && GetCurrentPlayerVar( "time_def_value" ) == "" ) THEN openPrivTextButton( "schedule_time_input_".$race_number,$left_right_schedule+19,$top_bottom_schedule,15,5,5,32,"^3Time (HH:MM Timezone) race ".$race_number,"^3Click to set",10,config_time ); ELSE IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "time_".$race_number ) == "" && GetCurrentPlayerVar( "time_def_value" ) != "" ) THEN openPrivButton( "schedule_time_input_".$race_number,$left_right_schedule+19,$top_bottom_schedule,15,5,5,-1,32,"^2Copy default",config_time ); ELSE openPrivTextButton( "schedule_time_input_".$race_number,$left_right_schedule+19,$top_bottom_schedule,15,5,5,32,"^3Time (HH:MM Timezone) race ".$race_number,"^3".GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "time_".$race_number ),10,config_time ); ENDIF ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ) == "" ) THEN openPrivTextButton( "schedule_track_input_".$race_number,$left_right_schedule+34,$top_bottom_schedule,9,5,5,32,"^3Track (Short trackcode) race ".$race_number,"^3Set",5,config_track ); ELSE openPrivTextButton( "schedule_track_input_".$race_number,$left_right_schedule+34,$top_bottom_schedule,9,5,5,32,"^3Track (Short trackcode) race ".$race_number,"^3".GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ),5,config_track ); ENDIF ### Show button for setting layout-name, in case the 3rd or 4th character of the trackname is X or Y ### IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ) != "" && subStr( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ),3,1 ) == "X" ) THEN IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_".$race_number ) == "" ) THEN openPrivButton( "schedule_layout_input_".$race_number,$left_right_schedule+43,$top_bottom_schedule,5,5,5,-1,32,"^1+",config_layouts_gui ); ELSE IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_".$race_number ) != "" && GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_".$race_number ) != "" ) THEN openPrivButton( "schedule_layout_input_".$race_number,$left_right_schedule+43,$top_bottom_schedule,5,5,5,-1,32,"^2+",config_layouts_gui ); ELSE openPrivButton( "schedule_layout_input_".$race_number,$left_right_schedule+43,$top_bottom_schedule,5,5,5,-1,32,"^1+",config_layouts_gui ); ENDIF ENDIF ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ) != "" && subStr( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ),4,1 ) == "X" ) THEN IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_".$race_number ) == "" ) THEN openPrivTextButton( "schedule_layout_input_".$race_number,$left_right_schedule+43,$top_bottom_schedule,5,5,5,32,"^3Type the name of layout","^1X",25,config_layout ); ELSE IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_".$race_number ) != "" && GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_".$race_number ) != "" ) THEN openPrivTextButton( "schedule_layout_input_".$race_number,$left_right_schedule+43,$top_bottom_schedule,5,5,5,32,"^3Current name: ".GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_".$race_number ),"^2V",25,config_layout ); ELSE openPrivTextButton( "schedule_layout_input_".$race_number,$left_right_schedule+43,$top_bottom_schedule,5,5,5,32,"^3Type the name of layout","^1X",25,config_layout ); ENDIF ENDIF ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ) != "" && subStr( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ),3,1 ) == "Y" ) THEN IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_".$race_number ) == "" ) THEN openPrivButton( "schedule_layout_input_".$race_number,$left_right_schedule+43,$top_bottom_schedule,5,5,5,-1,32,"^1+",config_layouts_gui ); ELSE IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_".$race_number ) != "" && GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_".$race_number ) != "" ) THEN openPrivButton( "schedule_layout_input_".$race_number,$left_right_schedule+43,$top_bottom_schedule,5,5,5,-1,32,"^2+",config_layouts_gui ); ELSE openPrivButton( "schedule_layout_input_".$race_number,$left_right_schedule+43,$top_bottom_schedule,5,5,5,-1,32,"^1+",config_layouts_gui ); ENDIF ENDIF ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ) != "" && subStr( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ),4,1 ) == "Y" ) THEN IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_".$race_number ) == "" ) THEN openPrivButton( "schedule_layout_input_".$race_number,$left_right_schedule+43,$top_bottom_schedule,5,5,5,-1,32,"^1+",config_layouts_gui ); ELSE IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_".$race_number ) != "" && GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_".$race_number ) != "" ) THEN openPrivButton( "schedule_layout_input_".$race_number,$left_right_schedule+43,$top_bottom_schedule,5,5,5,-1,32,"^2+",config_layouts_gui ); ELSE openPrivButton( "schedule_layout_input_".$race_number,$left_right_schedule+43,$top_bottom_schedule,5,5,5,-1,32,"^1+",config_layouts_gui ); ENDIF ENDIF ENDIF ### End ### IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cars_".$race_number ) == "" ) THEN openPrivTextButton( "schedule_cars_input_".$race_number,$left_right_schedule+48,$top_bottom_schedule,30,5,5,32,"^3Car(s) (use + between carnames) race ".$race_number,"^3Click to set",40,config_cars ); openPrivButton( "schedule_cars_input2_".$race_number,$left_right_schedule+78,$top_bottom_schedule,3,5,5,-1,96,"^3+" , config_cars_gui ); ELSE openPrivTextButton( "schedule_cars_input_".$race_number,$left_right_schedule+48,$top_bottom_schedule,30,5,5,32,"^3Car(s) (use + between carnames) race ".$race_number,"^3".GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cars_".$race_number ),40,config_cars ); openPrivButton( "schedule_cars_input2_".$race_number,$left_right_schedule+78,$top_bottom_schedule,3,5,5,-1,96,"^3+" , config_cars_gui ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "laps_".$race_number ) == "" ) THEN openPrivTextButton( "schedule_laps_input_".$race_number,$left_right_schedule+81,$top_bottom_schedule,8,5,5,32,"^3Number of laps (0-99,100,110,120,...,1000,H1,H2...H48) race ".$race_number,"^3Set",4,config_laps ); ELSE openPrivTextButton( "schedule_laps_input_".$race_number,$left_right_schedule+81,$top_bottom_schedule,8,5,5,32,"^3Number of laps (0-99,100,110,120,...,1000,H1,H2...H48) race ".$race_number,"^3".GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "laps_".$race_number ),4,config_laps ); ENDIF IF ( GetCurrentPlayerVar( "more_options" ) == "no" ) THEN IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "event_pwd_".$race_number ) == "" ) THEN openPrivTextButton( "schedule_event_pwd_input_".$race_number,$left_right_schedule+89,$top_bottom_schedule,20,5,5,32,"^3Event password race ".$race_number,"^3Click to set",20,config_event_password ); ELSE openPrivTextButton( "schedule_event_pwd_input_".$race_number,$left_right_schedule+89,$top_bottom_schedule,20,5,5,32,"^3Event password race ".$race_number,"^3".GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "event_pwd_".$race_number ),20,config_event_password ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "regular_pwd_".$race_number ) == "" && GetCurrentPlayerVar( "regular_pwd_def_value" ) == "" ) THEN openPrivTextButton( "schedule_regular_pwd_input_".$race_number,$left_right_schedule+109,$top_bottom_schedule,20,5,5,32,"^3Regular password race ".$race_number,"^3Click to set",20,config_regular_password ); ELSE IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "regular_pwd_".$race_number ) == "" && GetCurrentPlayerVar( "regular_pwd_def_value" ) != "" ) THEN openPrivButton( "schedule_regular_pwd_input_".$race_number,$left_right_schedule+109,$top_bottom_schedule,20,5,5,-1,32,"^2Copy default",config_regular_password ); ELSE openPrivTextButton( "schedule_regular_pwd_input_".$race_number,$left_right_schedule+109,$top_bottom_schedule,20,5,5,32,"^3Regular password race ".$race_number,"^3".GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "regular_pwd_".$race_number ),20,config_regular_password ); ENDIF ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "comment_".$race_number ) == "" ) THEN openPrivTextButton( "schedule_comment_input_".$race_number,$left_right_schedule+129,$top_bottom_schedule,46,5,5,32,"^3Comment race ".$race_number,"^3Click to set",40,config_comment ); ELSE openPrivTextButton( "schedule_comment_input_".$race_number,$left_right_schedule+129,$top_bottom_schedule,46,5,5,32,"^3Comment race ".$race_number,"^3".GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "comment_".$race_number ),40,config_comment ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_".$race_number ) != "" ) THEN IF ( GetStoredValue( "HCS_" . GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_".$race_number ) . "_main_settings" ) != "" ) THEN openPrivButton( "schedule_race_id_".$race_number,$left_right_schedule+175,$top_bottom_schedule,5,5,5,-1,32,"^2".GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_".$race_number ), Handicap ); ELSE openPrivButton( "schedule_race_id_".$race_number,$left_right_schedule+175,$top_bottom_schedule,5,5,5,-1,32,"^7".GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_".$race_number ), Handicap ); ENDIF ENDIF ENDIF IF ( GetCurrentPlayerVar( "more_options" ) == "yes" ) THEN IF ( subStr( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ), 0, 2 ) == "AS" ) THEN $weather="^3Weather (1=Clear day, 2=Cloudy afternoon) race " .$race_number; ENDIF IF ( subStr( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ), 0, 2 ) == "BL" ) THEN $weather="^3Weather (1=Clear day, 2=Cloudy afternoon, 3=Cloudy sunset) race " .$race_number; ENDIF IF ( subStr( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ), 0, 2 ) == "FE" ) THEN $weather="^3Weather (1=Clear day, 2=Cloudy sunset, 3=Overcast dusk) race " .$race_number; ENDIF IF ( subStr( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ), 0, 2 ) == "KY" ) THEN $weather="^3Weather (1=Clear day, 2=Cloudy afternoon, 3=Cloudy morning) race " .$race_number; ENDIF IF ( subStr( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ), 0, 2 ) == "RO" ) THEN $weather="^3Weather (1=Clear day, 2=Clear morning, 3=Overcast afternoon, 4=Clear sunset) race " .$race_number; ENDIF IF ( subStr( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ), 0, 2 ) == "SO" ) THEN $weather="^3Weather (1=Clear afternoon, 2=Overcast day, 3=Cloudy sunset) race " .$race_number; ENDIF IF ( subStr( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ), 0, 2 ) == "WE" ) THEN $weather="^3Weather (1=Clear day, 2=Cloudy sunset) race " .$race_number; ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "weather_".$race_number ) == "" && GetCurrentPlayerVar( "weather_def_value" ) == "" ) THEN openPrivTextButton( "schedule_weather_input_".$race_number,$left_right_schedule+89,$top_bottom_schedule,15,5,5,32,$weather,"^3Set",1,config_weather ); ELSE IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "weather_".$race_number ) == "" && GetCurrentPlayerVar( "weather_def_value" ) != "" ) THEN openPrivButton( "schedule_weather_input_".$race_number,$left_right_schedule+89,$top_bottom_schedule,15,5,5,-1,32,"^2Copy default",config_weather ); ELSE openPrivTextButton( "schedule_weather_input_".$race_number,$left_right_schedule+89,$top_bottom_schedule,15,5,5,32,$weather,"^3".GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "weather_".$race_number ),1,config_weather ); ENDIF ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "wind_".$race_number ) == "" && GetCurrentPlayerVar( "wind_def_value" ) == "" ) THEN openPrivTextButton( "schedule_wind_input_".$race_number,$left_right_schedule+104,$top_bottom_schedule,15,5,5,32,"^3Wind (0=No wind, 1=Low wind, 2=High wind) race ".$race_number,"^3Set",1,config_wind ); ELSE IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "wind_".$race_number ) == "" && GetCurrentPlayerVar( "wind_def_value" ) != "" ) THEN openPrivButton( "schedule_wind_input_".$race_number,$left_right_schedule+104,$top_bottom_schedule,15,5,5,-1,32,"^2Copy default",config_wind ); ELSE openPrivTextButton( "schedule_wind_input_".$race_number,$left_right_schedule+104,$top_bottom_schedule,15,5,5,32,"^3Wind (0=No wind, 1=Low wind, 2=High wind) race ".$race_number,"^3".GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "wind_".$race_number ),1,config_wind ); ENDIF ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "qual_".$race_number ) == "" && GetCurrentPlayerVar( "qual_def_value" ) == "" ) THEN openPrivTextButton( "schedule_qual_input_".$race_number,$left_right_schedule+119,$top_bottom_schedule,15,5,5,32,"^3Qualify length in minutes (max 240) race ".$race_number,"^3Set",3,config_qual ); ELSE IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "qual_".$race_number ) == "" && GetCurrentPlayerVar( "qual_def_value" ) != "" ) THEN openPrivButton( "schedule_qual_input_".$race_number,$left_right_schedule+119,$top_bottom_schedule,15,5,5,-1,32,"^2Copy default",config_qual ); ELSE openPrivTextButton( "schedule_qual_input_".$race_number,$left_right_schedule+119,$top_bottom_schedule,15,5,5,32,"^3Qualify length in minutes (max 240) race ".$race_number,"^3".GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "qual_".$race_number ),3,config_qual ); ENDIF ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "start_".$race_number ) == "" && GetCurrentPlayerVar( "start_def_value" ) == "" ) THEN openPrivTextButton( "schedule_start_input_".$race_number,$left_right_schedule+134,$top_bottom_schedule,15,5,5,32,"^3Start order (Fixed, Finish, Reverse, Random) race ".$race_number,"^3Set",7,config_start ); ELSE IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "start_".$race_number ) == "" && GetCurrentPlayerVar( "start_def_value" ) != "" ) THEN openPrivButton( "schedule_start_input_".$race_number,$left_right_schedule+134,$top_bottom_schedule,15,5,5,-1,32,"^2Copy default",config_start ); ELSE openPrivTextButton( "schedule_start_input_".$race_number,$left_right_schedule+134,$top_bottom_schedule,15,5,5,32,"^3Start order (Fixed, Finish, Reverse, Random) race ".$race_number,"^3".GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "start_".$race_number ),7,config_start ); ENDIF ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "reset_".$race_number ) == "" && GetCurrentPlayerVar( "reset_def_value" ) == "" ) THEN openPrivTextButton( "schedule_reset_input_".$race_number,$left_right_schedule+149,$top_bottom_schedule,15,5,5,32,"^3Allow car reset (Yes, No) race ".$race_number,"^3Set",3,config_reset ); ELSE IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "reset_".$race_number ) == "" && GetCurrentPlayerVar( "reset_def_value" ) != "" ) THEN openPrivButton( "schedule_reset_input_".$race_number,$left_right_schedule+149,$top_bottom_schedule,15,5,5,-1,32,"^2Copy default",config_reset ); ELSE openPrivTextButton( "schedule_reset_input_".$race_number,$left_right_schedule+149,$top_bottom_schedule,15,5,5,32,"^3Allow car reset (Yes, No) race ".$race_number,"^3".GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "reset_".$race_number ),3,config_reset ); ENDIF ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cruise_".$race_number ) == "" && GetCurrentPlayerVar( "cruise_def_value" ) == "" ) THEN openPrivTextButton( "schedule_cruise_input_".$race_number,$left_right_schedule+164,$top_bottom_schedule,15,5,5,32,"^3Allow cruise (driving wrong way) (Yes, No) race ".$race_number,"^3Set",3,config_cruise ); ELSE IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cruise_".$race_number ) == "" && GetCurrentPlayerVar( "cruise_def_value" ) != "" ) THEN openPrivButton( "schedule_cruise_input_".$race_number,$left_right_schedule+164,$top_bottom_schedule,15,5,5,-1,32,"^2Copy default",config_cruise ); ELSE openPrivTextButton( "schedule_cruise_input_".$race_number,$left_right_schedule+164,$top_bottom_schedule,15,5,5,32,"^3Allow cruise (driving wrong way) (Yes, No) race ".$race_number,"^3".GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cruise_".$race_number ),3,config_cruise ); ENDIF ENDIF ENDIF $top_bottom_schedule=$top_bottom_schedule+5; ENDFOR $top_bottom_schedule = 156; openPrivButton( "schedule_delete",$left_right_schedule+1,$top_bottom_schedule+1,190,5,5,-1,32,"^3Delete whole schedule ^7(^1WARNING: ^7All values for this server will be erased from database)",schedule_delete_confirm ); openPrivButton( "schedule_close",$left_right_schedule+1,$top_bottom_schedule+6,190,5,5,-1,32,"^3Close schedule",schedule_set_close ); ### End ### EndSub Sub move_delete_race ( $KeyFlags,$id ) ### Check if clicked button has 'number' in its ID and if button is clicked with the Left MouseButton (LMB) ### IF ( subStr( $id, 9, 6 ) == "number" && $KeyFlags == 1 ) THEN $race_number = ToNum( subStr( $id, 16, 2 ) ); SetCurrentPlayerVar( "race_move" , $race_number ); $left_right_schedule = 1; $top_bottom_schedule = 151; IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_".$race_number ) != "" ) THEN IF ( $race_number > 1 && $race_number <= 13 ) THEN openPrivButton( "schedule_race_up",$left_right_schedule+1,$top_bottom_schedule+1,40,5,5,-1,32,"^3Move race up to first empty spot", schedule_move_race ); openPrivButton( "schedule_race_down",$left_right_schedule+41,$top_bottom_schedule+1,40,5,5,-1,32,"^3Move race down to first empty spot", schedule_move_race ); openPrivButton( "schedule_cancel_race_move",$left_right_schedule+81,$top_bottom_schedule+1,40,5,5,-1,32,"^1Cancel race move", schedule_cancel_race_move ); ELSE IF ( $race_number == 1 ) THEN openPrivButton( "schedule_race_down",$left_right_schedule+41,$top_bottom_schedule+1,40,5,5,-1,32,"^3Move race down to first empty spot", schedule_move_race ); openPrivButton( "schedule_cancel_race_move",$left_right_schedule+81,$top_bottom_schedule+1,40,5,5,-1,32,"^1Cancel race move", schedule_cancel_race_move ); ENDIF IF ( $race_number == 14 ) THEN openPrivButton( "schedule_race_up",$left_right_schedule+1,$top_bottom_schedule+1,40,5,5,-1,32,"^3Move race up to first empty spot", schedule_move_race ); openPrivButton( "schedule_cancel_race_move",$left_right_schedule+41,$top_bottom_schedule+1,40,5,5,-1,32,"^1Cancel race move", schedule_cancel_race_move ); ENDIF ENDIF ELSE PrivMsg ( "^1WARNING: ^7Race number " . $race_number . " has no date set, race can't be moved" ); ENDIF ENDIF ### End ### ### Check if clicked button has 'number' in its ID and if button is clicked with the Right MouseButton (RMB) ### ### Close all input buttons ### ### Store race_number into a PlayerVar ### ### Show a window to confirm (or cancel) deleting this race ### IF ( subStr( $id, 9, 6 ) == "number" && $KeyFlags == 2 ) THEN close_user_input_buttons ( $KeyFlags ); $race_number = ToNum( subStr( $id, 16, 2 ) ); SetCurrentPlayerVar( "race_delete" , $race_number ); $left_right_schedule = 1; $top_bottom_schedule = 101; openPrivButton( "schedule_confirm_race_delete_bg",$left_right_schedule+54,$top_bottom_schedule+1,82,17,5,-1,16,"" ); openPrivButton( "schedule_confirm_race_delete_text",$left_right_schedule+54,$top_bottom_schedule+2,82,5,5,-1,0,"^7Are you sure you want to delete information for race number " . $race_number ); openPrivButton( "schedule_confirm_race_delete",$left_right_schedule+55,$top_bottom_schedule+12,40,5,5,-1,32,"^2Confirm delete race", schedule_race_delete ); openPrivButton( "schedule_cancel_race_delete",$left_right_schedule+95,$top_bottom_schedule+12,40,5,5,-1,32,"^1Cancel delete race", schedule_cancel_race_delete ); ENDIF ### End ### EndSub Sub schedule_race_delete ( $KeyFlags,$id ) ### Close buttons from the confirmation window ## ### Retrieve the race_number from the PlayerVar ### Delete values from database in case they are found ### ### Announce completion of delete ### closePrivButton( "schedule_confirm_race_delete_bg&schedule_confirm_race_delete_text&schedule_confirm_race_delete&schedule_cancel_race_delete" ); $race_number = SetCurrentPlayerVar( "race_delete" , $race_number ); IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "time_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "time_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cars_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cars_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "laps_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "laps_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "event_pwd_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "event_pwd_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "regular_pwd_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "regular_pwd_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "comment_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "comment_".$race_number ); ENDIF ### Check wether there are handicap settings that needs to be deleted and if so, delete them ### ### This needs to be done before race_id is deleted from the database ### $storage_name_hcs = "HCS_" . GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_".$race_number ) . "_"; IF ( GetStoredValue( $storage_name_hcs . "main_settings" ) != "" ) THEN $main_settings = SplitToArray ( GetStoredValue( $storage_name_hcs . "main_settings" ),"*" ); $number_of_cars = $main_settings[3]; DeleteStoredValue( $storage_name_hcs . "main_settings" ); FOR ( $car_nbr=1;$car_nbr<=$number_of_cars;$car_nbr=$car_nbr+1 ) DeleteStoredValue( $storage_name_hcs . "car_" . $car_nbr ); ENDFOR PrivMsg ( "^7INFO: Handicap settings for race " . $race_number . " have been deleted" ); ENDIF ### End ### IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "weather_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "weather_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "wind_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "wind_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "qual_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "qual_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "start_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "start_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "reset_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "reset_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cruise_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cruise_".$race_number ); ENDIF PrivMsg ( "^7INFO: Information for race " . $race_number . " has been deleted" ); Set_Schedule( $KeyFlags ); EndSub Sub schedule_cancel_race_delete ( $KeyFlags,$id ) closePrivButton( "schedule_confirm_race_delete_bg&schedule_confirm_race_delete_text&schedule_confirm_race_delete&schedule_cancel_race_delete" ); Set_Schedule( $KeyFlags ); EndSub Sub schedule_move_race ( $KeyFlags,$id ) IF ( $id == "schedule_race_up" ) THEN $maximum = ToNum( GetCurrentPlayerVar( "race_move" ) ); SetCurrentPlayerVar( "race_moved" , "no" ); FOR ($race_number=$maximum;$race_number>=1;$race_number=$race_number-1) IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_" . $race_number ) == "" ) THEN IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_" . $maximum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_" . $maximum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_" . $maximum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "time_" . $maximum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "time_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "time_" . $maximum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "time_" . $maximum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_" . $maximum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_" . $maximum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_" . $maximum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_" . $maximum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_" . $maximum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_" . $maximum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_" . $maximum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_" . $maximum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_" . $maximum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cars_" . $maximum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cars_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cars_" . $maximum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cars_" . $maximum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "laps_" . $maximum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "laps_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "laps_" . $maximum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "laps_" . $maximum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "event_pwd_" . $maximum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "event_pwd_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "event_pwd_" . $maximum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "event_pwd_" . $maximum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "regular_pwd_" . $maximum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "regular_pwd_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "regular_pwd_" . $maximum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "regular_pwd_" . $maximum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "comment_" . $maximum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "comment_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "comment_" . $maximum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "comment_" . $maximum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_" . $maximum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_" . $maximum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_" . $maximum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "weather_" . $maximum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "weather_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "weather_" . $maximum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "weather_" . $maximum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "wind_" . $maximum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "wind_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "wind_" . $maximum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "wind_" . $maximum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "qual_" . $maximum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "qual_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "qual_" . $maximum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "qual_" . $maximum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "start_" . $maximum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "start_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "start_" . $maximum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "start_" . $maximum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "reset_" . $maximum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "reset_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "reset_" . $maximum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "reset_" . $maximum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cruise_" . $maximum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cruise_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cruise_" . $maximum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cruise_" . $maximum ); ENDIF SetCurrentPlayerVar( "race_moved" , "yes" ); PrivMsg ( "^7INFO: race moved from position " . $maximum . " to position " . $race_number ); BREAK; ENDIF ENDFOR IF ( GetCurrentPlayerVar( "race_moved" ) == "no" ) THEN PrivMsg ( "^7INFO: ^1NO ^7empty spot found" ); ENDIF ENDIF IF ( $id == "schedule_race_down" ) THEN $minimum = ToNum( GetCurrentPlayerVar( "race_move" ) ); SetCurrentPlayerVar( "race_moved" , "no" ); FOR ($race_number=$minimum;$race_number<=14;$race_number=$race_number+1) IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_" . $race_number ) == "" ) THEN IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_" . $minimum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_" . $minimum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_" . $minimum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "time_" . $minimum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "time_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "time_" . $minimum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "time_" . $minimum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_" . $minimum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_" . $minimum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_" . $minimum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_" . $minimum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_" . $minimum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_" . $minimum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_" . $minimum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_" . $minimum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_" . $minimum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cars_" . $minimum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cars_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cars_" . $minimum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cars_" . $minimum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "laps_" . $minimum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "laps_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "laps_" . $minimum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "laps_" . $minimum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "event_pwd_" . $minimum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "event_pwd_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "event_pwd_" . $minimum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "event_pwd_" . $minimum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "regular_pwd_" . $minimum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "regular_pwd_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "regular_pwd_" . $minimum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "regular_pwd_" . $minimum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "comment_" . $minimum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "comment_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "comment_" . $minimum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "comment_" . $minimum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_" . $minimum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_" . $minimum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_" . $minimum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "weather_" . $minimum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "weather_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "weather_" . $minimum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "weather_" . $minimum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "wind_" . $minimum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "wind_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "wind_" . $minimum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "wind_" . $minimum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "qual_" . $minimum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "qual_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "qual_" . $minimum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "qual_" . $minimum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "start_" . $minimum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "start_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "start_" . $minimum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "start_" . $minimum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "reset_" . $minimum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "reset_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "reset_" . $minimum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "reset_" . $minimum ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cruise_" . $minimum ) != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cruise_" . $race_number , GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cruise_" . $minimum ) ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cruise_" . $minimum ); ENDIF SetCurrentPlayerVar( "race_moved" , "yes" ); PrivMsg ( "^7INFO: race moved from position " . $minimum . " to position " . $race_number ); BREAK; ENDIF ENDFOR IF ( GetCurrentPlayerVar( "race_moved" ) == "no" ) THEN PrivMsg ( "^7INFO: ^1NO ^7empty spot found" ); ENDIF ENDIF closePrivButton( "schedule_race_up" ); closePrivButton( "schedule_race_down" ); closePrivButton( "schedule_cancel_race_move" ); close_user_input_buttons ( $KeyFlags ); Set_Schedule( $KeyFlags ); EndSub Sub schedule_cancel_race_move ( $KeyFlags,$id ) closePrivButton( "schedule_race_up" ); closePrivButton( "schedule_race_down" ); closePrivButton( "schedule_cancel_race_move" ); Set_Schedule( $KeyFlags ); EndSub Sub config_default_settings ( $id,$text ) IF ( subStr( $id, 9, 4 ) == "time" ) THEN IF ( GetCurrentPlayerVar( "time_def_value" ) != "" && $text == "" ) THEN SetCurrentPlayerVar( "time_def_value" , "" ); PrivMsg ( "^7INFO: Default time has been removed" ); ELSE SetCurrentPlayerVar( "time_def_value" , $text ); PrivMsg ( "^7INFO: Default time is now set to - " . GetCurrentPlayerVar( "time_def_value" ) ); ENDIF ENDIF IF ( subStr( $id, 9, 7 ) == "regular" ) THEN IF ( GetCurrentPlayerVar( "regular_pwd_def_value" ) != "" && $text == "" ) THEN SetCurrentPlayerVar( "regular_pwd_def_value" , "" ); PrivMsg ( "^7INFO: Default regular password has been removed" ); ELSE SetCurrentPlayerVar( "regular_pwd_def_value" , $text ); PrivMsg ( "^7INFO: Default regular password is now set to - " . GetCurrentPlayerVar( "regular_pwd_def_value" ) ); ENDIF ENDIF IF ( subStr( $id, 9, 7 ) == "weather" ) THEN IF ( GetCurrentPlayerVar( "weather_def_value" ) != "" && $text == "" ) THEN SetCurrentPlayerVar( "weather_def_value" , "" ); PrivMsg ( "^7INFO: Default weather code has been removed" ); ELSE SetCurrentPlayerVar( "weather_def_value" , $text ); PrivMsg ( "^7INFO: Default weather code is now set to - " . GetCurrentPlayerVar( "weather_def_value" ) ); ENDIF ENDIF IF ( subStr( $id, 9, 4 ) == "wind" ) THEN IF ( GetCurrentPlayerVar( "wind_def_value" ) != "" && $text == "" ) THEN SetCurrentPlayerVar( "wind_def_value" , "" ); PrivMsg ( "^7INFO: Default wind code has been removed" ); ELSE SetCurrentPlayerVar( "wind_def_value" , $text ); PrivMsg ( "^7INFO: Default wind code is now set to - " . GetCurrentPlayerVar( "wind_def_value" ) ); ENDIF ENDIF IF ( subStr( $id, 9, 4 ) == "qual" ) THEN IF ( GetCurrentPlayerVar( "qual_def_value" ) != "" && $text == "" ) THEN SetCurrentPlayerVar( "qual_def_value" , "" ); PrivMsg ( "^7INFO: Default qualify length has been removed" ); ELSE SetCurrentPlayerVar( "qual_def_value" , $text ); PrivMsg ( "^7INFO: Default qualilfy length is now set to - " . GetCurrentPlayerVar( "qual_def_value" ) . " minutes" ); ENDIF ENDIF IF ( subStr( $id, 9, 5 ) == "start" ) THEN IF ( GetCurrentPlayerVar( "start_def_value" ) != "" && $text == "" ) THEN SetCurrentPlayerVar( "start_def_value" , "" ); PrivMsg ( "^7INFO: Default starting order has been removed" ); ELSE SetCurrentPlayerVar( "start_def_value" , $text ); PrivMsg ( "^7INFO: Default starting order is now set to - " . GetCurrentPlayerVar( "start_def_value" ) ); ENDIF ENDIF IF ( subStr( $id, 9, 5 ) == "reset" ) THEN IF ( GetCurrentPlayerVar( "reset_def_value" ) != "" && $text == "" ) THEN SetCurrentPlayerVar( "reset_def_value" , "" ); PrivMsg ( "^7INFO: Default reset allowed value has been removed" ); ELSE SetCurrentPlayerVar( "reset_def_value" , $text ); PrivMsg ( "^7INFO: Default reset allowed is now set to - " . GetCurrentPlayerVar( "reset_def_value" ) ); ENDIF ENDIF IF ( subStr( $id, 9, 6 ) == "cruise" ) THEN IF ( GetCurrentPlayerVar( "cruise_def_value" ) != "" && $text == "" ) THEN SetCurrentPlayerVar( "cruise_def_value" , "" ); PrivMsg ( "^7INFO: Default cruise allowed value has been removed" ); ELSE SetCurrentPlayerVar( "cruise_def_value" , $text ); PrivMsg ( "^7INFO: Default cruise allowed is now set to - " . GetCurrentPlayerVar( "cruise_def_value" ) ); ENDIF ENDIF Set_Schedule( $KeyFlags ); EndSub Sub config_server_name ( $id,$text ) ### Find the server number by reading the ID of the clicked button, start on position 27 and read 1 character ### ### Store the server name into the database ### ### Re-open the set_schedule GUI ### $server_number = ToNum( subStr( $id, 27, 1 ) ); IF ( $text != "" ) THEN SetStoredValue( "SCHDL_SERVER_NAME_".$server_number , $text ); ELSE DeleteStoredValue( "SCHDL_SERVER_NAME_".$server_number ); privMsg ( "^7Server name " . $server_number . " has been deleted" ); ENDIF Set_Schedule( $KeyFlags ); ### End ### EndSub Sub config_server_def_pwd ( $id,$text ) ### Find the server number by reading the ID of the clicked button, start on position 30 and read 1 character ### ### Store the default password for server X into the database ### ### Re-open the set_schedule GUI ### $server_number = ToNum( subStr( $id, 30, 1 ) ); $server_name_schedule = StripLFSColor( GetStoredValue( "SCHDL_SERVER_NAME_".$server_number ) ); $storage_name = "SCHEDULE_".$server_name_schedule."_"; IF ( $text != "" ) THEN SetStoredValue( $storage_name . "DEF_PWD" , $text ); ELSE DeleteStoredValue( $storage_name . "DEF_PWD" ); privMsg ( "^7Default password server " . GetStoredValue( "SCHDL_SERVER_NAME_".$server_number ) . " ^7has been deleted" ); ENDIF Set_Schedule( $KeyFlags ); ### End ### EndSub Sub copy_server_name ( $KeyFlags,$id ) $server_number = ToNum( subStr( $id, 26, 2 ) ); SetStoredValue( "SCHDL_SERVER_NAME_".$server_number , getLapperVar( "HostName" ) ); closePrivButton("schedule_server_name_copy_".$server_number); Set_Schedule( $KeyFlags ); EndSub Sub activate_server_name ( $KeyFlags,$id ) $server_number = ToNum( subStr( $id, 21, 1 ) ); ### When 'Server name X' button is clicked using the Left Mouse Button (LMB), the name will be retrieved from the database ### IF ( $KeyFlags == 1 && StripLFSColor( GetStoredValue( "SCHDL_SERVER_NAME_".$server_number ) ) != "" ) THEN ### Find the server number by reading the ID of the clicked button, start on position 30 and read 1 character ### ### Retrieve server name from database and put server name into variable 'server_name_schedule', announce new server name, close buttons from previous schedule ### ### Re-open the set_schedule GUI ### SetCurrentPlayerVar( "server_name_schedule" , StripLFSColor( GetStoredValue( "SCHDL_SERVER_NAME_".$server_number ) ) ); privMsg ( "^7Server name set to " . GetCurrentPlayerVar( "server_name_schedule" ) . " and its schedule have been loaded" ); FOR ($race_number=1;$race_number<=14;$race_number=$race_number+1) closePrivButton( "schedule_server_name_" . $race_number ); closePrivButton( "schedule_server_name_input_" . $race_number) ; ENDFOR close_user_input_buttons ( $KeyFlags ); close_general_schdl_settings ( $KeyFlags,$id ); ### End ### ENDIF IF ( $KeyFlags == 1 && GetStoredValue( "SCHDL_SERVER_NAME_".$server_number ) == "" ) THEN SetCurrentPlayerVar ( "server_name_found","false" ); FOR ( $server_nbr=1;$server_nbr<=8;$server_nbr=$server_nbr+1 ) IF ( GetStoredValue( "SCHDL_SERVER_NAME_".$server_nbr ) == getLapperVar( "HostName" ) ) THEN PrivMsg ( "^1WARNING: ^7Server name already in use and can't be added for a second time" ); SetCurrentPlayerVar ( "server_name_found","true" ); BREAK; ENDIF ENDFOR IF ( GetCurrentPlayerVar ( "server_name_found" ) == "false" ) THEN SetStoredValue( "SCHDL_SERVER_NAME_".$server_number , getLapperVar( "HostName" ) ); ENDIF ENDIF ### When 'Server name X' button is clicked using the Right Mouse Button (RMB), the server name of that server will be deleted ### IF ( $KeyFlags == 2 ) THEN IF ( GetStoredValue( "SCHDL_SERVER_NAME_".$server_number ) != "" ) THEN DeleteStoredValue( "SCHDL_SERVER_NAME_".$server_number ); privMsg ( "^7Server name " . $server_number . " has been deleted" ); ENDIF ENDIF ### End ### Set_Schedule( $KeyFlags ); EndSub Sub config_date ( $id,$text ) $race_number = ToNum( subStr( $id, 20, 2 ) ); IF ( $text != "" ) THEN ### Split entered text into array using '-' as splitting value ### ### Set PlayerVar 'data_val_date' to "okay" ### $date_splitted = SplitToArray( $text,"-" ); SetCurrentPlayerVar( "data_val_date" , "okay" ); ### Check if - is used as third and sixth value in $text, if not give warning ### IF ( subStr( $text, 2, 1 ) != "-" || subStr( $text, 5, 1 ) != "-" ) THEN privMsg ( "^1WARNING: ^7No (or not enough) '-' have been found in entered date" ); SetCurrentPlayerVar( "data_val_date" , "wrong" ); ENDIF ### Loop through array and check if all values are numeric ones and if stringlength is okay ### ### If not, give warning on screen and stop loop ### ### If data validation has passed criteria, store date into database ### FOREACH( $val IN $date_splitted) IF ( isnum ( $val["value"] ) != 1 ) THEN privMsg ( "^1WARNING: ^7A non-numeric value has been found in entered date" ); SetCurrentPlayerVar( "data_val_date" , "wrong" ); BREAK; ENDIF IF ( strlen( $val["value"] ) < 2 ) THEN privMsg ( "^1WARNING: ^7Given date is in wrong format" ); SetCurrentPlayerVar( "data_val_date" , "wrong" ); BREAK; ENDIF ENDFOREACH IF ( GetCurrentPlayerVar( "data_val_date" ) == "okay" ) THEN IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_".$race_number ) == "" ) THEN IF ( $race_id_schdl == 999 ) THEN $race_id_schdl=0; ENDIF $race_id_schdl=$race_id_schdl+1; SetStoredValue( "SCHDL_RACE_ID", $race_id_schdl ); SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_".$race_number, $race_id_schdl ); ENDIF SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_".$race_number, $text ); ENDIF ### End ### ELSE DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_".$race_number ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_".$race_number ); closePrivButton( "schedule_race_id_" . $race_number ); ENDIF Set_Schedule( $KeyFlags ); EndSub Sub config_time ( $id,$text ) ### When Sub is reached from a PrivTextButton, $id=id and $text=text ### ### When Sub is reached from a PrivButton (clicked to copy the value set as default), $id=KeyFlags and $text=id ### IF ( GetCurrentPlayerVar( "time_def_value" ) != "" && $text != "" ) THEN $race_number = ToNum( subStr( $text, 20, 2 ) ); $text = GetCurrentPlayerVar( "time_def_value" ); ELSE $race_number = ToNum( subStr( $id, 20, 2 ) ); ENDIF ### End ### IF ( $text != "" ) THEN ### Split entered text into array using ':' as splitting value and only using the first five characters of $text (this to escape the timezone text) ### ### Set PlayerVar 'data_val_time' to "okay" ### $time_splitted = SplitToArray( subStr( $text, 0, 5 ),":" ); SetCurrentPlayerVar( "data_val_time" , "okay" ); ### Check if : is used as third value in $text, if not give warning ### IF ( subStr( $text, 2, 1 ) != ":" ) THEN privMsg ( "^1WARNING: ^7No ':' has been found in entered time" ); SetCurrentPlayerVar( "data_val_time" , "wrong" ); ENDIF ### Check stringlength for the entered timezone, if below 3, give warning ### IF ( strlen( subStr( $text, 6, 4 ) ) < 3 ) THEN privMsg ( "^1WARNING: ^7No timezone code or incorrect length for timezone code has been entered" ); SetCurrentPlayerVar( "data_val_time" , "wrong" ); ENDIF ### End ### ### Loop through array and check if all values are numeric ones and if stringlength is okay ### ### If not, give warning on screen and stop loop ### ### If data validation has passed criteria, store time into database ### FOREACH( $val IN $time_splitted) IF ( isnum ( $val["value"] ) != 1 ) THEN privMsg ( "^1WARNING: ^7A non-numeric value has been found in entered time" ); SetCurrentPlayerVar( "data_val_time" , "wrong" ); BREAK; ENDIF IF ( strlen( $val["value"] ) < 2 ) THEN privMsg ( "^1WARNING: ^7Given time is in wrong format" ); SetCurrentPlayerVar( "data_val_time" , "wrong" ); BREAK; ENDIF ENDFOREACH ### Get the current_race_date, calculate previous race number, get previous race_date and race_time, split previous_race_time using : as splitting value ### ### Add the hours needed to end the event ### $current_race_date = GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_" . $race_number ); $previous_race_number = $race_number - 1; $previous_race_date = GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_" . $previous_race_number ); $previous_race_time = GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "time_" . $previous_race_number ); $previous_race_time_splitted = SplitToArray( subStr( $previous_race_time, 0, 5 ),":" ); IF ( GetStoredValue( "SCHDL_EVENT_END") == "After 2 hours" ) THEN $previous_race_time_hour = $previous_race_time_splitted[0] + 2; $previous_race_time_minutes = $previous_race_time_splitted[1]; ELSE IF ( GetStoredValue( "SCHDL_EVENT_END") == "After 3 hours" ) THEN $previous_race_time_hour = $previous_race_time_splitted[0] + 3; $previous_race_time_minutes = $previous_race_time_splitted[1]; ELSE $previous_race_time_hour = $previous_race_time_splitted[0]; $previous_race_time_minutes = $previous_race_time_splitted[1]; ENDIF ENDIF ### End ### ### Check if date current race is the same as previous race in the schedule ### ### If so, check if race time isn't overlapping by getting previous time and adding the hours needed to end the event ### ### In case of an overlap, notify user and reject the entered time ### IF ( $current_race_date == $previous_race_date ) THEN IF ( $time_splitted[0] < $previous_race_time_hour ) THEN privMsg ( "^1WARNING: ^7Given time is overlapping with previous race" ); SetCurrentPlayerVar( "data_val_time" , "wrong" ); ELSE IF ( $time_splitted[0] == $previous_race_time_hour && $time_splitted[1] <= $previous_race_time_minutes ) THEN privMsg ( "^1WARNING: ^7Given time is overlapping with previous race" ); SetCurrentPlayerVar( "data_val_time" , "wrong" ); ENDIF ENDIF ENDIF ### End ### IF ( GetCurrentPlayerVar( "data_val_time" ) == "okay" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "time_" . $race_number, $text ); ENDIF ### End ### ELSE DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "time_" . $race_number ); ENDIF Set_Schedule( $KeyFlags ); EndSub Sub config_track ( $id,$text ) IF ( $id != "set_schedule_cfg_standard_track" ) THEN $race_number = ToNum( subStr( $id, 21, 2 ) ); ENDIF SetCurrentPlayerVar( "data_val_track" , "okay" ); $text = ToUpper ( $text ); IF ( $text != "" ) THEN IF ( subStr( $text, 0, 2 ) != "AS" && subStr( $text, 0, 2 ) != "BL" && subStr( $text, 0, 2 ) != "FE" && subStr( $text, 0, 2 ) != "KY" && subStr( $text, 0, 2 ) != "SO" && subStr( $text, 0, 2 ) != "WE" && subStr( $text, 0, 2 ) != "RO" ) THEN privMsg ( "^1WARNING: ^7An invalid trackcode has been entered" ); SetCurrentPlayerVar( "data_val_track" , "wrong" ); ELSE ### If correct trackcode is confirmed, then check entered layout number ### IF ( subStr( $text, 0, 2 ) == "AS" && subStr( $text, 2, 1 ) > 7 ) THEN privMsg ( "^1WARNING: ^7An invalid layout number for track " . subStr( $text, 0, 2 ) . " has been entered" ); SetCurrentPlayerVar( "data_val_track" , "wrong" ); ELSE ### If correct layout number is confirmed, then check entered sub-layout (R,X,Y) ### IF ( subStr( $text, 0, 2 ) == "AS" && subStr( $text, 3, 1 ) != "" && subStr( $text, 3, 1 ) != "R" && subStr( $text, 3, 1 ) != "X" && subStr( $text, 3, 1 ) != "Y" ) THEN privMsg ( "^1WARNING: ^7An invalid sub-layout for track " . subStr( $text, 0, 2 ) . " has been entered" ); SetCurrentPlayerVar( "data_val_track" , "wrong" ); ENDIF ENDIF IF ( subStr( $text, 0, 2 ) == "BL" && subStr( $text, 2, 1 ) > 4 ) THEN privMsg ( "^1WARNING: ^7An invalid layout number for track " . subStr( $text, 0, 2 ) . " has been entered" ); SetCurrentPlayerVar( "data_val_track" , "wrong" ); ELSE ### If correct trackcode is confirmed, then check if entered layout number is smaller then or equal to 3 ### IF ( subStr( $text, 0, 2 ) == "BL" && subStr( $text, 2, 1 ) <= 3 ) THEN ### If layout number is smaller or equal to 3, then check if entered sub-layout (R,X,Y) ### IF ( subStr( $text, 0, 2 ) == "BL" && subStr( $text, 3, 1 ) != "" && subStr( $text, 3, 1 ) != "R" && subStr( $text, 3, 1 ) != "X" && subStr( $text, 3, 1 ) != "Y" ) THEN privMsg ( "^1WARNING: ^7An invalid sub-layout for track " . subStr( $text, 0, 2 ) . " has been entered" ); SetCurrentPlayerVar( "data_val_track" , "wrong" ); ENDIF ELSE ### If layout number is bigger than 3 (which means it has to be 4), then check entered sub-layout (X) if that value isn't empty ### IF ( subStr( $text, 0, 2 ) == "BL" && subStr( $text, 3, 1 ) != "" && subStr( $text, 3, 1 ) != "X" ) THEN privMsg ( "^1WARNING: ^7An invalid sub-layout for track " . subStr( $text, 0, 2 ) . " has been entered" ); SetCurrentPlayerVar( "data_val_track" , "wrong" ); ENDIF ENDIF ENDIF ### If correct trackcode is confirmed, then check entered layout number ### IF ( subStr( $text, 0, 2 ) == "FE" && subStr( $text, 2, 1 ) > 6 ) THEN privMsg ( "^1WARNING: ^7An invalid layout number for track " . subStr( $text, 0, 2 ) . " has been entered" ); SetCurrentPlayerVar( "data_val_track" , "wrong" ); ELSE ### If correct layout number is confirmed, then check entered sub-layout (R,X,Y) ### IF ( subStr( $text, 0, 2 ) == "FE" && subStr( $text, 3, 1 ) != "" && subStr( $text, 3, 1 ) != "R" && subStr( $text, 3, 1 ) != "X" && subStr( $text, 3, 1 ) != "Y" ) THEN privMsg ( "^1WARNING: ^7An invalid sub-layout for track " . subStr( $text, 0, 2 ) . " has been entered" ); SetCurrentPlayerVar( "data_val_track" , "wrong" ); ENDIF ENDIF ### If correct trackcode is confirmed, then check entered layout number ### IF ( subStr( $text, 0, 2 ) == "KY" && subStr( $text, 2, 1 ) > 3 ) THEN privMsg ( "^1WARNING: ^7An invalid layout number for track " . subStr( $text, 0, 2 ) . " has been entered" ); SetCurrentPlayerVar( "data_val_track" , "wrong" ); ELSE ### If correct layout number is confirmed, then check entered sub-layout (R,X,Y) ### IF ( subStr( $text, 0, 2 ) == "KY" && subStr( $text, 3, 1 ) != "" && subStr( $text, 3, 1 ) != "R" && subStr( $text, 3, 1 ) != "X" && subStr( $text, 3, 1 ) != "Y" ) THEN privMsg ( "^1WARNING: ^7An invalid sub-layout for track " . subStr( $text, 0, 2 ) . " has been entered" ); SetCurrentPlayerVar( "data_val_track" , "wrong" ); ENDIF ENDIF ### If correct trackcode is confirmed, then check entered layout number ### IF ( subStr( $text, 0, 2 ) == "SO" && subStr( $text, 2, 1 ) > 6 ) THEN privMsg ( "^1WARNING: ^7An invalid layout number for track " . subStr( $text, 0, 2 ) . " has been entered" ); SetCurrentPlayerVar( "data_val_track" , "wrong" ); ELSE ### If correct layout number is confirmed, then check entered sub-layout (R,X,Y) ### IF ( subStr( $text, 0, 2 ) == "SO" && subStr( $text, 3, 1 ) != "" && subStr( $text, 3, 1 ) != "R" && subStr( $text, 3, 1 ) != "X" && subStr( $text, 3, 1 ) != "Y" ) THEN privMsg ( "^1WARNING: ^7An invalid sub-layout for track " . subStr( $text, 0, 2 ) . " has been entered" ); SetCurrentPlayerVar( "data_val_track" , "wrong" ); ENDIF ENDIF ### If correct trackcode is confirmed, then check entered layout number ### IF ( subStr( $text, 0, 2 ) == "WE" && subStr( $text, 2, 1 ) > 5 ) THEN privMsg ( "^1WARNING: ^7An invalid layout number for track " . subStr( $text, 0, 2 ) . " has been entered" ); SetCurrentPlayerVar( "data_val_track" , "wrong" ); ELSE ### If correct layout number is confirmed, then check entered sub-layout for WE3, as that only has WE3 or WE3X as valid input ### IF ( subStr( $text, 0, 2 ) == "WE" && subStr( $text, 2, 1 ) == 3 && subStr( $text, 3, 1 ) != "" && subStr( $text, 3, 1 ) != "X" ) THEN privMsg ( "^1WARNING: ^7An invalid sub-layout for track " . subStr( $text, 0, 2 ) . " has been entered" ); SetCurrentPlayerVar( "data_val_track" , "wrong" ); ENDIF ENDIF IF ( subStr( $text, 0, 2 ) == "RO" ) THEN ### Since RO is currently the only track with more then 9 layouts, an extra check is needed ### ### First check is the third character being a number and the fourth character being a number (in case layout 10 or 11 is entered) ### ### If that's the case, check if the entered number isn't bigger than 11 ### IF ( isnum ( subStr( $text, 2, 1 ) ) == 1 && isnum ( subStr( $text, 3, 1 ) ) == 1 ) THEN IF ( subStr( $text, 2, 2 ) > 11 ) THEN privMsg ( "^1WARNING: ^7An invalid layout number for track " . subStr( $text, 0, 2 ) . " has been entered" ); SetCurrentPlayerVar( "data_val_track" , "wrong" ); ELSE IF ( subStr( $text, 0, 2 ) == "RO" && subStr( $text, 4, 1 ) != "" && subStr( $text, 4, 1 ) != "X" ) THEN privMsg ( "^1WARNING: ^7An invalid sub-layout for track " . subStr( $text, 0, 2 ) . " has been entered" ); SetCurrentPlayerVar( "data_val_track" , "wrong" ); ENDIF ENDIF ELSE IF ( subStr( $text, 0, 2 ) == "RO" && subStr( $text, 3, 1 ) != "" && subStr( $text, 3, 1 ) != "X" ) THEN privMsg ( "^1WARNING: ^7An invalid sub-layout for track " . subStr( $text, 0, 2 ) . " has been entered" ); SetCurrentPlayerVar( "data_val_track" , "wrong" ); ENDIF ENDIF ENDIF ### End ### ENDIF IF ( GetCurrentPlayerVar( "data_val_track" ) == "okay" ) THEN ### Check the $id which is used to enter this sub-routine, if it's set to 'set_schedule_cfg_standard_race' then store standard track. Otherwise store track for schedule ### ### Go back to the routine you came from, based on the $id used to enter this sub-routine ### IF ( $id == "set_schedule_cfg_standard_track" ) THEN SetStoredValue( "SCHDL_STD_TRACK", $text ); configure_schedule( $KeyFlags, $id ); ELSE SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number, $text ); ### In case trackcode doesn't have X or Y as last character, delete layout-name from database and close layout button ### IF ( subStr( $text, 3, 1 ) != "X" && subStr( $text, 3, 1 ) != "Y" && subStr( $text, 4, 1 ) != "X" && subStr( $text, 4, 1 ) != "Y" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_".$race_number ); ClosePrivButton( "schedule_layout_input_".$race_number ); ENDIF ### End ### Set_Schedule( $KeyFlags ); ENDIF ### End ### ENDIF ELSE ### Check the $id which is used to enter this sub-routine, if it's set to 'set_schedule_cfg_standard_race' then delete standard track. Otherwise delete track for schedule ### ### Go back to the routine you came from, based on the $id used to enter this sub-routine ### IF ( $id == "set_schedule_cfg_standard_track" ) THEN DeleteStoredValue( "SCHDL_STD_TRACK" ); configure_schedule( $KeyFlags, $id ); ELSE DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ); DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_".$race_number ); ClosePrivButton( "schedule_layout_input_".$race_number ); Set_Schedule( $KeyFlags ); ENDIF ### End ### ENDIF EndSub Sub config_layout ( $id,$text ) $race_number = ToNum( subStr( $id, 23, 2 ) ); IF ( $text == "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_".$race_number ); ELSE SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_".$race_number, $text ); ENDIF config_layouts_gui( $KeyFlags,$id ); EndSub Sub config_splits ( $id,$text ) $race_number = ToNum( subStr( $id, 30, 2 ) ); IF ( $text == "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_".$race_number ); ELSE IF ( $text == 0 || $text > 4 ) THEN PrivMsg ( "^1WARNING: ^7Value can't be 0 or above 4" ); ELSE SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_".$race_number, $text ); ENDIF ENDIF config_layouts_gui( $KeyFlags,$id ); EndSub Sub config_cars ( $id,$text ) IF ( $id != "set_schedule_cfg_standard_cars" ) THEN $race_number = ToNum( subStr( $id, 20, 2 ) ); ENDIF $text = ToUpper ( $text ); ### Get the stringlength of $text ### ### Start at character 0 and work through $text until end of string is reached ### ### In case a '-' is found, replace that by '+' to be able to split $text to array using '+' as splitting value ### $input_length = strlen ( $text ); FOR ($character=0;$character<$input_length;$character=$character+1) IF ( subStr( $text, $character, 1 ) == "-" ) THEN $input_new=$input_new . "+"; ELSE $input_new=$input_new . subStr( $text, $character, 1 ); ENDIF ENDFOR ### End ### IF ( strlen ( $input_new ) > 3 ) THEN $cars_splitted = SplitToArray( $input_new , "+" ); FOREACH( $val_1 IN $cars_splitted ) SetCurrentPlayerVar( "data_val_cars" , "wrong" ); FOR ($car=21;$car<=26;$car=$car+1) IF ( $val_1["value"] == $car_groups_set_schedule[1,$car] ) THEN SetCurrentPlayerVar( "data_val_cars" , "okay" ); BREAK; ENDIF ENDFOR ### In case no valid group value has been found, start searching the car_names for a valid value ### IF ( GetCurrentPlayerVar( "data_val_cars" ) == "wrong" ) THEN FOR ($car=1;$car<=20;$car=$car+1) IF ( $val_1["value"] == $car_names_set_schedule[1,$car] ) THEN SetCurrentPlayerVar( "data_val_cars" , "okay" ); BREAK; ENDIF ENDFOR ENDIF ### End ### IF ( GetCurrentPlayerVar( "data_val_cars" ) == "wrong" ) THEN privMsg ( "^1WARNING: ^7" . $val_1["value"] . " is not a valid car/group value" ); BREAK; ENDIF ENDFOREACH ELSE IF ( strlen ( $input_new ) > 0 ) THEN FOR ($car=21;$car<=26;$car=$car+1) SetCurrentPlayerVar( "data_val_cars" , "wrong" ); IF ( $input_new == $car_groups_set_schedule[1,$car] ) THEN SetCurrentPlayerVar( "data_val_cars" , "okay" ); BREAK; ENDIF ENDFOR ### In case no valid group value has been found, start searching the car_names for a valid value ### IF ( GetCurrentPlayerVar( "data_val_cars" ) == "wrong" ) THEN FOR ($car=1;$car<=20;$car=$car+1) SetCurrentPlayerVar( "data_val_cars" , "wrong" ); IF ( $input_new == $car_names_set_schedule[1,$car] ) THEN SetCurrentPlayerVar( "data_val_cars" , "okay" ); BREAK; ENDIF ENDFOR ENDIF ### End ### IF ( GetCurrentPlayerVar( "data_val_cars" ) == "wrong" ) THEN privMsg ( "^1WARNING: ^7" . $input_new . " is not a valid car/group value" ); ENDIF ENDIF ENDIF IF ( $text != "" && GetCurrentPlayerVar( "data_val_cars" ) == "okay" ) THEN IF ( $id != "set_schedule_cfg_standard_cars" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cars_".$race_number, $text ); Set_Schedule( $KeyFlags ); ELSE SetStoredValue( "SCHDL_STD_CARS" , $text ); configure_schedule ( $KeyFlags,$id ); ENDIF ELSE IF ( $text == "" ) THEN IF ( $id != "set_schedule_cfg_standard_cars" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cars_".$race_number ); Set_Schedule( $KeyFlags ); ELSE DeleteStoredValue( "SCHDL_STD_CARS" ); configure_schedule ( $KeyFlags,$id ); ENDIF ENDIF ENDIF EndSub Sub config_layouts_gui ( $KeyFlags,$id ) closePrivButton( "schedule_cars" ); FOR ($race_number=1;$race_number<=14;$race_number=$race_number+1) closePrivButton( "schedule_layout_input_".$race_number ); closePrivButton( "schedule_cars_input_" . $race_number ); closePrivButton( "schedule_cars_input2_" . $race_number ); ENDFOR ### Reset values for left/right and top/bottom coordinates ### $left_right_schedule = 1; $top_bottom_schedule = 30; ### End ### openPrivButton( "schedule_layouts",$left_right_schedule+48,$top_bottom_schedule+46,20,5,5,-1,32,"^7Layouts:" ); openPrivButton( "schedule_layouts_splits",$left_right_schedule+68,$top_bottom_schedule+46,10,5,5,-1,32,"^7Splits:" ); openPrivButton( "schedule_close_layouts_splits",$left_right_schedule+48,$top_bottom_schedule+51,30,5,5,-1,32,"^3Close Layout & Splits", close_layout_splits ); $top_bottom_schedule = 86; FOR ($race_number=1;$race_number<=14;$race_number=$race_number+1) IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ) != "" ) THEN IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_".$race_number ) == "" ) THEN openPrivTextButton( "schedule_layouts_input_".$race_number,$left_right_schedule+48,$top_bottom_schedule,20,5,5,32,"^3Layout race ".$race_number,"^3Click to set",40,config_layout ); ELSE openPrivTextButton( "schedule_layouts_input_".$race_number,$left_right_schedule+48,$top_bottom_schedule,20,5,5,32,"^3Layout race ".$race_number,"^3".GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_".$race_number ),40,config_layout ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_".$race_number ) == "" ) THEN openPrivTextButton( "schedule_layouts_splits_input_".$race_number,$left_right_schedule+68,$top_bottom_schedule,10,5,5,32,"^3Number of splits (max 4) race ".$race_number,"^3Set",1,config_splits ); ELSE openPrivTextButton( "schedule_layouts_splits_input_".$race_number,$left_right_schedule+68,$top_bottom_schedule,10,5,5,32,"^3Number of splits (max 4) race ".$race_number,"^3".GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_".$race_number ),1,config_splits ); ENDIF ENDIF $top_bottom_schedule = $top_bottom_schedule + 5; ENDFOR EndSub Sub close_layout_splits ( $KeyFlags,$id ) closePrivButton( "schedule_layouts" ); closePrivButton( "schedule_layouts_splits" ); closePrivButton( "schedule_close_layouts_splits" ); FOR ($race_number=1;$race_number<=14;$race_number=$race_number+1) closePrivButton( "schedule_layouts_input_".$race_number ); closePrivButton( "schedule_layouts_splits_input_" . $race_number ); ENDFOR IF ( $id == "schedule_close_layouts_splits" ) THEN Set_Schedule( $KeyFlags ); ENDIF EndSub Sub config_cars_gui ( $KeyFlags,$id ) IF ( $id != "set_schedule_cfg_standard_cars_2" ) THEN closePrivButton( "schedule_laps" ); closePrivButton( "schedule_event_pwd" ); closePrivButton( "schedule_weather" ); closePrivButton( "schedule_wind" ); FOR ($race_number=1;$race_number<=14;$race_number=$race_number+1) closePrivButton( "schedule_laps_input_" . $race_number ); closePrivButton( "schedule_event_pwd_input_" . $race_number ); closePrivButton( "schedule_weather_input_" . $race_number ); closePrivButton( "schedule_wind_input_" . $race_number ); closePrivButton( "close_cars_gui_" . $race_number ); ENDFOR $race_number = ToNum( subStr( $id, 21, 2 ) ); $close_gui_number = ToNum( subStr( $id, 21, 2 ) ); ENDIF ### Set left/right and top/bottom coordinates ### IF ( $id != "set_schedule_cfg_standard_cars_2" ) THEN $left_right_cars_gui = 85; $top_bottom_cars_gui = 82; ELSE $left_right_cars_gui = 112; $top_bottom_cars_gui = 89; SetCurrentPlayerVar ( "car_gui_std_cars","yes" ); ENDIF ### End ### openPrivButton( "cars_gui_bg",$left_right_cars_gui-1,$top_bottom_cars_gui-6,24,77,5,-1,16,"" ); IF ( $id != "set_schedule_cfg_standard_cars_2" ) THEN openPrivButton( "cars_gui_title",$left_right_cars_gui,$top_bottom_cars_gui-5,22,5,5,-1,32,"^7Select car(s) race " . $race_number ); ELSE openPrivButton( "cars_gui_title",$left_right_cars_gui,$top_bottom_cars_gui-5,22,5,5,-1,32,"^7Select std car(s)" ); ENDIF openPrivButton( "UF1",$left_right_cars_gui,$top_bottom_cars_gui,11,5,5,-1,32,"^7UF1" , select_cars ); openPrivButton( "XFG",$left_right_cars_gui+11,$top_bottom_cars_gui,11,5,5,-1,32,"^7XFG" , select_cars ); openPrivButton( "XRG",$left_right_cars_gui,$top_bottom_cars_gui+5,11,5,5,-1,32,"^7XRG" , select_cars ); openPrivButton( "LX4",$left_right_cars_gui+11,$top_bottom_cars_gui+5,11,5,5,-1,32,"^7LX4" , select_cars ); openPrivButton( "LX6",$left_right_cars_gui,$top_bottom_cars_gui+10,11,5,5,-1,32,"^7LX6" , select_cars ); openPrivButton( "RB4",$left_right_cars_gui+11,$top_bottom_cars_gui+10,11,5,5,-1,32,"^7RB4" , select_cars ); openPrivButton( "FXO",$left_right_cars_gui,$top_bottom_cars_gui+15,11,5,5,-1,32,"^7FXO" , select_cars ); openPrivButton( "XRT",$left_right_cars_gui+11,$top_bottom_cars_gui+15,11,5,5,-1,32,"^7XRT" , select_cars ); openPrivButton( "RAC",$left_right_cars_gui,$top_bottom_cars_gui+20,11,5,5,-1,32,"^7RAC" , select_cars ); openPrivButton( "FZ5",$left_right_cars_gui+11,$top_bottom_cars_gui+20,11,5,5,-1,32,"^7FZ5" , select_cars ); openPrivButton( "UFR",$left_right_cars_gui,$top_bottom_cars_gui+25,11,5,5,-1,32,"^7UFR" , select_cars ); openPrivButton( "XFR",$left_right_cars_gui+11,$top_bottom_cars_gui+25,11,5,5,-1,32,"^7XFR" , select_cars ); openPrivButton( "FXR",$left_right_cars_gui,$top_bottom_cars_gui+30,11,5,5,-1,32,"^7FXR" , select_cars ); openPrivButton( "XRR",$left_right_cars_gui+11,$top_bottom_cars_gui+30,11,5,5,-1,32,"^7XRR" , select_cars ); openPrivButton( "FZR",$left_right_cars_gui,$top_bottom_cars_gui+35,11,5,5,-1,32,"^7FZR" , select_cars ); openPrivButton( "MRT",$left_right_cars_gui+11,$top_bottom_cars_gui+35,11,5,5,-1,32,"^7MRT" , select_cars ); openPrivButton( "FBM",$left_right_cars_gui,$top_bottom_cars_gui+40,11,5,5,-1,32,"^7FBM" , select_cars ); openPrivButton( "FOX",$left_right_cars_gui+11,$top_bottom_cars_gui+40,11,5,5,-1,32,"^7FOX" , select_cars ); openPrivButton( "FO8",$left_right_cars_gui,$top_bottom_cars_gui+45,11,5,5,-1,32,"^7FO8" , select_cars ); openPrivButton( "BF1",$left_right_cars_gui+11,$top_bottom_cars_gui+45,11,5,5,-1,32,"^7BF1" , select_cars ); openPrivButton( "ALL",$left_right_cars_gui,$top_bottom_cars_gui+50,11,5,5,-1,32,"^6ALL" , select_cars ); openPrivButton( "ROAD",$left_right_cars_gui+11,$top_bottom_cars_gui+50,11,5,5,-1,32,"^6ROAD" , select_cars ); openPrivButton( "RACE",$left_right_cars_gui,$top_bottom_cars_gui+55,11,5,5,-1,32,"^6RACE" , select_cars ); openPrivButton( "TBO",$left_right_cars_gui+11,$top_bottom_cars_gui+55,11,5,5,-1,32,"^6TBO" , select_cars ); openPrivButton( "LRF",$left_right_cars_gui,$top_bottom_cars_gui+60,11,5,5,-1,32,"^6LRF" , select_cars ); openPrivButton( "GTR",$left_right_cars_gui+11,$top_bottom_cars_gui+60,11,5,5,-1,32,"^6GTR" , select_cars ); openPrivButton( "close_cars_gui_".$close_gui_number,$left_right_cars_gui,$top_bottom_cars_gui+65,22,5,5,-1,32,"^3Close GUI" , close_cars_gui ); EndSub Sub select_cars ( $KeyFlags,$id ) IF ( GetCurrentPlayerVar ( "car_gui_std_cars" ) != "yes" ) THEN $top_bottom_cars_gui = 132; ELSE $top_bottom_cars_gui = 139; ENDIF $row_count=1; ### First check if a car-class is set, this to make sure that the value comes first in the PlayerVar ### FOR ($car=21;$car<=26;$car=$car+1) IF ( $row_count == 1 ) THEN IF ( GetCurrentPlayerVar ( "car_gui_std_cars" ) != "yes" ) THEN $left_right_cars_gui = 85; ELSE $left_right_cars_gui = 112; ENDIF ELSE IF ( GetCurrentPlayerVar ( "car_gui_std_cars" ) != "yes" ) THEN $left_right_cars_gui = 96; ELSE $left_right_cars_gui = 123; ENDIF ENDIF IF ( $id == $car_groups_set_schedule[1,$car] && $KeyFlags == 1 ) THEN IF ( GetCurrentPlayerVar( "car" . $car ) == "+" . $car_groups_set_schedule[1,$car] ) THEN SetCurrentPlayerVar( "car" . $car , "" ); openPrivButton( "".$car_groups_set_schedule[1,$car],$left_right_cars_gui,$top_bottom_cars_gui,11,5,5,-1,32,"^6".$car_groups_set_schedule[1,$car] , select_cars ); ELSE SetCurrentPlayerVar( "car" . $car , "+" . $car_groups_set_schedule[1,$car] ); openPrivButton( "".$car_groups_set_schedule[1,$car],$left_right_cars_gui,$top_bottom_cars_gui,11,5,5,-1,32,"^2".$car_groups_set_schedule[1,$car] , select_cars ); ENDIF ELSE IF ( $id == $car_groups_set_schedule[1,$car] && $KeyFlags == 2 ) THEN PrivMsg ( "^7INFO: " . $car_groups_set_schedule[1,$car] . " means " . $car_groups_set_schedule_explained[1,$car] ); ENDIF ENDIF $row_count=$row_count+1; IF ( $row_count > 2 ) THEN $row_count=1; $top_bottom_cars_gui=$top_bottom_cars_gui+5; ENDIF ENDFOR ### End ### ### Reset row_count ### IF ( GetCurrentPlayerVar ( "car_gui_std_cars" ) != "yes" ) THEN $top_bottom_cars_gui = 82; ELSE $top_bottom_cars_gui = 89; ENDIF $row_count=1; ### End ### FOR ($car=1;$car<=20;$car=$car+1) IF ( $row_count == 1 ) THEN IF ( GetCurrentPlayerVar ( "car_gui_std_cars" ) != "yes" ) THEN $left_right_cars_gui = 85; ELSE $left_right_cars_gui = 112; ENDIF ELSE IF ( GetCurrentPlayerVar ( "car_gui_std_cars" ) != "yes" ) THEN $left_right_cars_gui = 96; ELSE $left_right_cars_gui = 123; ENDIF ENDIF IF ( $id == $car_names_set_schedule[1,$car] && $KeyFlags == 1 ) THEN IF ( GetCurrentPlayerVar( "car" . $car ) == "+" . $car_names_set_schedule[1,$car] ) THEN SetCurrentPlayerVar( "car" . $car , "" ); openPrivButton( "".$car_names_set_schedule[1,$car],$left_right_cars_gui,$top_bottom_cars_gui,11,5,5,-1,32,"^7".$car_names_set_schedule[1,$car] , select_cars ); ELSE SetCurrentPlayerVar( "car" . $car , "+" . $car_names_set_schedule[1,$car] ); openPrivButton( "".$car_names_set_schedule[1,$car],$left_right_cars_gui,$top_bottom_cars_gui,11,5,5,-1,32,"^2".$car_names_set_schedule[1,$car] , select_cars ); ENDIF ELSE IF ( $id == $car_names_set_schedule[1,$car] && $KeyFlags == 2 ) THEN IF ( GetCurrentPlayerVar( "car" . $car ) == "-" . $car_names_set_schedule[1,$car] ) THEN SetCurrentPlayerVar( "car" . $car , "" ); openPrivButton( "".$car_names_set_schedule[1,$car],$left_right_cars_gui,$top_bottom_cars_gui,11,5,5,-1,32,"^7".$car_names_set_schedule[1,$car] , select_cars ); ELSE SetCurrentPlayerVar( "car" . $car , "-" . $car_names_set_schedule[1,$car] ); PrivMsg ( "^7INFO: Excluding a car is only working in combination with a group" ); openPrivButton( "".$car_names_set_schedule[1,$car],$left_right_cars_gui,$top_bottom_cars_gui,11,5,5,-1,32,"^1".$car_names_set_schedule[1,$car] , select_cars ); ENDIF ENDIF ENDIF $row_count=$row_count+1; IF ( $row_count > 2 ) THEN $row_count=1; $top_bottom_cars_gui=$top_bottom_cars_gui+5; ENDIF ENDFOR ### Reset Left/Right coordinates ### IF ( GetCurrentPlayerVar ( "car_gui_std_cars" ) != "yes" ) THEN $left_right_cars_gui = 85; ELSE $left_right_cars_gui = 112; ENDIF ### End ### $all_empty="yes"; FOR ($car=1;$car<=26;$car=$car+1) IF ( GetCurrentPlayerVar( "car" . $car ) != "" ) THEN $all_empty="no"; BREAK; ENDIF ENDFOR IF ( $all_empty == "yes" ) THEN openPrivButton( "close_cars_gui_".$close_gui_number,$left_right_cars_gui,$top_bottom_cars_gui+15,22,5,5,-1,32,"^3Close GUI" , close_cars_gui ); ELSE openPrivButton( "close_cars_gui_".$close_gui_number,$left_right_cars_gui,$top_bottom_cars_gui+15,22,5,5,-1,32,"^3Select car(s)" , close_cars_gui ); ENDIF EndSub Sub close_cars_gui ( $KeyFlags,$id ) IF ( GetCurrentPlayerVar ( "car_gui_std_cars" ) != "yes" ) THEN $race_number = ToNum( subStr( $id, 15, 2 ) ); ENDIF FOR ($car_nbr=21;$car_nbr<=26;$car_nbr=$car_nbr+1) IF ( $cars != "" && GetCurrentPlayerVar( "car" . $car_nbr ) != "" ) THEN $cars = $cars."".GetCurrentPlayerVar( "car" . $car_nbr ); ELSE IF ( GetCurrentPlayerVar( "car" . $car_nbr ) != "" ) THEN $cars = GetCurrentPlayerVar( "car" . $car_nbr ); ENDIF ENDIF ENDFOR FOR ($car_nbr=1;$car_nbr<=20;$car_nbr=$car_nbr+1) IF ( $cars != "" && GetCurrentPlayerVar( "car" . $car_nbr ) != "" ) THEN $cars = $cars."".GetCurrentPlayerVar( "car" . $car_nbr ); ELSE IF ( GetCurrentPlayerVar( "car" . $car_nbr ) != "" ) THEN $cars = GetCurrentPlayerVar( "car" . $car_nbr ); ENDIF ENDIF ENDFOR ### Check if first value of $cars is the "+" sign, if so, then skip the first value of $cars ### IF ( subStr( $cars, 0 , 1 ) == "+" ) THEN $cars = subStr( $cars, 1 ); ENDIF ### End ### ### Only store value(s) if $cars contains information (this to prevent deleting info by opening/closing GUI without doing anything) ### IF ( $cars != "" ) THEN IF ( GetCurrentPlayerVar ( "car_gui_std_cars" ) != "yes" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cars_".$race_number, $cars ); ELSE SetStoredValue( "SCHDL_STD_CARS" , $cars ); ENDIF ENDIF ### End ### ### Set CurrentPlayerVars to a blank value and close all button from car select GUI ### closePrivButton( "cars_gui_bg" ); closePrivButton( "cars_gui_title" ); FOR ($car_nbr=1;$car_nbr<=26;$car_nbr=$car_nbr+1) SetCurrentPlayerVar( "car" . $car_nbr , "" ); closePrivButton( "" . $car_names_set_schedule[1,$car_nbr] ); closePrivButton( "" . $car_groups_set_schedule[1,$car_nbr] ); ENDFOR closePrivButton( "close_cars_gui_" . $race_number ); ### End ### IF ( GetCurrentPlayerVar ( "car_gui_std_cars" ) != "yes" ) THEN Set_Schedule( $KeyFlags ); ELSE configure_schedule ( $KeyFlags,$id ); SetCurrentPlayerVar ( "car_gui_std_cars","" ); ENDIF EndSub Sub config_laps ( $id,$text ) IF ( $id != "set_schedule_cfg_standard_laps" ) THEN $race_number = ToNum( subStr( $id, 20, 2 ) ); ENDIF IF ( $text != "" ) THEN IF ( subStr( $text, 0, 1 ) == "H" ) THEN IF ( ToNum( subStr( $text, 1, 2 ) ) > 48 ) THEN PrivMsg ( "^1WARNING: ^7Number of hours can't be higher then 48" ); ELSE IF ( $id == "set_schedule_cfg_standard_laps" ) THEN SetStoredValue( "SCHDL_STD_LAPS" , ToNum ( $text ) ); configure_schedule( $KeyFlags,$id ); ELSE SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "laps_".$race_number, $text ); Set_Schedule( $KeyFlags ); ENDIF ENDIF ELSE IF ( ToNum ( $text ) <= 99 ) THEN IF ( $id == "set_schedule_cfg_standard_laps" ) THEN SetStoredValue( "SCHDL_STD_LAPS" , ToNum ( $text ) ); configure_schedule( $KeyFlags,$id ); ELSE SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "laps_".$race_number, $text ); Set_Schedule( $KeyFlags ); ENDIF ELSE $valid_nbr_of_laps="no"; FOR ($lapcheck=100;$lapcheck<=1000;$lapcheck=$lapcheck+10) IF ( ToNUm ( $text ) == $lapcheck) THEN $valid_nbr_of_laps="yes"; BREAK; ENDIF ENDFOR IF ( $valid_nbr_of_laps == "yes" ) THEN IF ( $id == "set_schedule_cfg_standard_laps" ) THEN SetStoredValue( "SCHDL_STD_LAPS" , ToNum ( $text ) ); configure_schedule( $KeyFlags,$id ); ELSE SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "laps_".$race_number, ToNum ( $text ) ); Set_Schedule( $KeyFlags ); ENDIF ELSE PrivMsg ( "^1WARNING: ^7Number of laps above 100, can only be set in steps of 10 (like 110,120,130 etc)" ); ENDIF ENDIF ENDIF ELSE IF ( $id == "set_schedule_cfg_standard_laps" ) THEN DeleteStoredValue( "SCHDL_STD_LAPS" ); configure_schedule( $KeyFlags,$id ); ELSE DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "laps_".$race_number ); Set_Schedule( $KeyFlags ); ENDIF ENDIF EndSub Sub activate_more_options ( $KeyFlags,$id ) closePrivButton( "schedule_event_pwd" ); closePrivButton( "schedule_regular_pwd" ); closePrivButton( "schedule_regular_pwd_default" ); closePrivButton( "schedule_comment" ); closePrivButton( "schedule_race_id" ); closePrivButton( "schedule_more_options" ); FOR ($race_number=1;$race_number<=14;$race_number=$race_number+1) closePrivButton( "schedule_event_pwd_input_" . $race_number ); closePrivButton( "schedule_regular_pwd_input_" . $race_number ); closePrivButton( "schedule_comment_input_" . $race_number ); closePrivButton( "schedule_race_id_" . $race_number ); ENDFOR SetCurrentPlayerVar( "more_options" , "yes" ); Set_Schedule( $KeyFlags ); EndSub Sub activate_less_options ( $KeyFlags,$id ) closePrivButton( "schedule_weather" ); closePrivButton( "schedule_weather_default" ); closePrivButton( "schedule_wind" ); closePrivButton( "schedule_wind_default" ); closePrivButton( "schedule_qual" ); closePrivButton( "schedule_qual_default" ); closePrivButton( "schedule_start" ); closePrivButton( "schedule_start_default" ); closePrivButton( "schedule_reset" ); closePrivButton( "schedule_reset_default" ); closePrivButton( "schedule_cruise" ); closePrivButton( "schedule_cruise_default" ); closePrivButton( "schedule_less_options" ); FOR ($race_number=1;$race_number<=14;$race_number=$race_number+1) closePrivButton( "schedule_weather_input_" . $race_number ); closePrivButton( "schedule_wind_input_" . $race_number ); closePrivButton( "schedule_qual_input_" . $race_number ); closePrivButton( "schedule_start_input_" . $race_number ); closePrivButton( "schedule_reset_input_" . $race_number ); closePrivButton( "schedule_cruise_input_" . $race_number ); ENDFOR SetCurrentPlayerVar( "more_options" , "no" ); Set_Schedule( $KeyFlags ); EndSub Sub config_weather ( $id,$text ) ### When Sub is reached from a PrivTextButton, $id=id and $text=text ### ### When Sub is reached from a PrivButton (clicked to copy the value set as default), $id=KeyFlags and $text=id ### IF ( GetCurrentPlayerVar( "weather_def_value" ) != "" && $text != "" ) THEN $race_number = ToNum( subStr( $text, 23, 2 ) ); $text = GetCurrentPlayerVar( "weather_def_value" ); ELSE $race_number = ToNum( subStr( $id, 23, 2 ) ); ENDIF ### End ### IF ( $text == "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "weather_".$race_number ); ELSE IF ( isnum ( $text) == 1 ) THEN $track = subStr( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ), 0, 2 ); IF ( $track == "AS" || $track == "WE" ) THEN IF ( ToNum ( $text ) <= 2 ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "weather_".$race_number, $text ); ELSE PrivMsg ( "^1WARNING: ^7Valid values for weather on THIS track (".$track.") are 1 or 2" ); ENDIF ENDIF IF ( $track == "BL" || $track == "FE" || $track == "KY" || $track == "SO" ) THEN IF ( ToNum ( $text ) <= 3 ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "weather_".$race_number, $text ); ELSE PrivMsg ( "^1WARNING: ^7Valid values for weather on THIS track (".$track.") are 1,2 or 3" ); ENDIF ENDIF IF ( $track == "RO" ) THEN IF ( ToNum ( $text ) <= 4 ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "weather_".$race_number, $text ); ELSE PrivMsg ( "^1WARNING: ^7Valid values for weather on THIS track (".$track.") are 1,2,3 or 4" ); ENDIF ENDIF ### Check if $track isn't equal to all valid trackcodes and if so, notify user that weather value can't be verified because of a missing trackcode ### ### For some reason $track is never empty (although debugging shows it is), so that's why it's compared to all trackcodes instead of (IF $track == "" ) ### IF ( $track != "AS" && $track != "WE" && $track != "BL" && $track != "FE" && $track != "KY" && $track != "SO" && $track != "RO" ) THEN PrivMsg ( "^1WARNING: ^7No trackcode is set, therefor weather value can't be verified" ); ENDIF ### End ### ELSE PrivMsg ( "^1WARNING: ^7Entered value isn't numeric." ); ENDIF ENDIF Set_Schedule( $KeyFlags ); EndSub Sub config_wind ( $id,$text ) ### When Sub is reached from a PrivTextButton, $id=id and $text=text ### ### When Sub is reached from a PrivButton (clicked to copy the value set as default), $id=KeyFlags and $text=id ### IF ( GetCurrentPlayerVar( "wind_def_value" ) != "" && $text != "" ) THEN $race_number = ToNum( subStr( $text, 20, 2 ) ); $text = GetCurrentPlayerVar( "wind_def_value" ); ELSE $race_number = ToNum( subStr( $id, 20, 2 ) ); ENDIF ### End ### IF ( $text == "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "wind_".$race_number ); ELSE IF ( isnum ( $text) == 1 ) THEN IF ( ToNum ( $text ) <= 2 ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "wind_".$race_number, $text ); ELSE PrivMsg ( "^1WARNING: ^7Valid values for wind are 0, 1 or 2" ); ENDIF ELSE PrivMsg ( "^1WARNING: ^7Entered value isn't numeric. Valid values for wind are 0, 1 or 2" ); ENDIF ENDIF Set_Schedule( $KeyFlags ); EndSub Sub config_qual ( $id,$text ) ### When Sub is reached from a PrivTextButton, $id=id and $text=text ### ### When Sub is reached from a PrivButton (clicked to copy the value set as default), $id=KeyFlags and $text=id ### IF ( GetCurrentPlayerVar( "qual_def_value" ) != "" && $text != "" ) THEN $race_number = ToNum( subStr( $text, 20, 2 ) ); $text = GetCurrentPlayerVar( "qual_def_value" ); ELSE $race_number = ToNum( subStr( $id, 20, 2 ) ); ENDIF ### End ### IF ( $text == "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "qual_".$race_number ); ELSE IF ( isnum ( $text) == 1 ) THEN IF ( ToNum ( $text ) <= 240 ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "qual_".$race_number, $text ); ELSE PrivMsg ( "^1WARNING: ^7Qualify can be a maximum of 240 minutes" ); ENDIF ELSE PrivMsg ( "^1WARNING: ^7Entered value isn't numeric" ); ENDIF ENDIF Set_Schedule( $KeyFlags ); EndSub Sub config_start ( $id,$text ) ### When Sub is reached from a PrivTextButton, $id=id and $text=text ### ### When Sub is reached from a PrivButton (clicked to copy the value set as default), $id=KeyFlags and $text=id ### IF ( GetCurrentPlayerVar( "start_def_value" ) != "" && $text != "" ) THEN $race_number = ToNum( subStr( $text, 21, 2 ) ); $text = GetCurrentPlayerVar( "start_def_value" ); ELSE $race_number = ToNum( subStr( $id, 21, 2 ) ); ENDIF ### End ### IF ( $text == "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "start_".$race_number ); ELSE IF ( $text == "Fixed" || $text == "Finish" || $text == "Reverse" || $text == "Random" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "start_".$race_number, $text ); ELSE PrivMsg ( "^1WARNING: ^7Valid values are Fixed, Finish, Reverse, Random" ); ENDIF ENDIF Set_Schedule( $KeyFlags ); EndSub Sub config_reset ( $id,$text ) ### When Sub is reached from a PrivTextButton, $id=id and $text=text ### ### When Sub is reached from a PrivButton (clicked to copy the value set as default), $id=KeyFlags and $text=id ### IF ( GetCurrentPlayerVar( "reset_def_value" ) != "" && $text != "" ) THEN $race_number = ToNum( subStr( $text, 21, 2 ) ); $text = GetCurrentPlayerVar( "reset_def_value" ); ELSE $race_number = ToNum( subStr( $id, 21, 2 ) ); ENDIF ### End ### IF ( $text == "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "reset_".$race_number ); ELSE IF ( $text == "Yes" || $text == "No" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "reset_".$race_number, $text ); ELSE PrivMsg ( "^1WARNING: ^7Valid values are Yes, No" ); ENDIF ENDIF Set_Schedule( $KeyFlags ); EndSub Sub config_cruise ( $id,$text ) ### When Sub is reached from a PrivTextButton, $id=id and $text=text ### ### When Sub is reached from a PrivButton (clicked to copy the value set as default), $id=KeyFlags and $text=id ### IF ( GetCurrentPlayerVar( "cruise_def_value" ) != "" && $text != "" ) THEN $race_number = ToNum( subStr( $text, 22, 2 ) ); $text = GetCurrentPlayerVar( "cruise_def_value" ); ELSE $race_number = ToNum( subStr( $id, 22, 2 ) ); ENDIF ### End ### IF ( $text == "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cruise_".$race_number ); ELSE IF ( $text == "Yes" || $text == "No" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cruise_".$race_number, $text ); ELSE PrivMsg ( "^1WARNING: ^7Valid values are Yes, No" ); ENDIF ENDIF Set_Schedule( $KeyFlags ); EndSub Sub config_comment ( $id,$text ) $race_number = ToNum( subStr( $id, 23, 2 ) ); IF ( $text != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "comment_".$race_number, $text ); ELSE DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "comment_".$race_number ); ENDIF Set_Schedule( $KeyFlags ); EndSub Sub config_event_password ( $id,$text ) $race_number = ToNum( subStr( $id, 25, 2 ) ); IF ( $text != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "event_pwd_".$race_number, $text ); ELSE DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "event_pwd_".$race_number ); ENDIF Set_Schedule( $KeyFlags ); EndSub Sub config_regular_password ( $id,$text ) ### When Sub is reached from a PrivTextButton, $id=id and $text=text ### ### When Sub is reached from a PrivButton (clicked to copy the value set as default), $id=KeyFlags and $text=id ### IF ( GetCurrentPlayerVar( "regular_pwd_def_value" ) != "" && $text != "" ) THEN $race_number = ToNum( subStr( $text, 27, 2 ) ); $text = GetCurrentPlayerVar( "regular_pwd_def_value" ); ELSE $race_number = ToNum( subStr( $id, 27, 2 ) ); ENDIF ### End ### IF ( $text != "" ) THEN SetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "regular_pwd_".$race_number, $text ); ELSE DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "regular_pwd_".$race_number ); ENDIF Set_Schedule( $KeyFlags ); EndSub Sub config_standard_race_password ( $id,$text) IF ( $text != "" ) THEN SetStoredValue( "SCHDL_STD_PASSWORD", $text ); ELSE DeleteStoredValue( "SCHDL_STD_PASSWORD" ); ENDIF configure_schedule( $KeyFlags,$id ); EndSub Sub schedule_set_close ( $KeyFlags,$id ) closePrivButton( "schedule_gui_bg" ); closePrivButton( "schedule_title" ); closePrivButton( "schedule_server_name" ); closePrivButton( "schedule_server_cfg" ); closePrivButton( "schedule_number" ); closePrivButton( "schedule_date" ); closePrivButton( "schedule_time" ); closePrivButton( "schedule_time_default" ); closePrivButton( "schedule_track" ); closePrivButton( "schedule_cars" ); closePrivButton( "schedule_laps" ); closePrivButton( "schedule_weather" ); closePrivButton( "schedule_weather_default" ); closePrivButton( "schedule_wind" ); closePrivButton( "schedule_wind_default" ); closePrivButton( "schedule_qual" ); closePrivButton( "schedule_qual_default" ); closePrivButton( "schedule_start" ); closePrivButton( "schedule_start_default" ); closePrivButton( "schedule_reset" ); closePrivButton( "schedule_reset_default" ); closePrivButton( "schedule_cruise" ); closePrivButton( "schedule_cruise_default" ); closePrivButton( "schedule_comment" ); closePrivButton( "schedule_event_pwd" ); closePrivButton( "schedule_regular_pwd" ); closePrivButton( "schedule_regular_pwd_default" ); closePrivButton( "schedule_race_id" ); closePrivButton( "schedule_more_options" ); closePrivButton( "schedule_less_options" ); closePrivButton( "schedule_race_up" ); closePrivButton( "schedule_race_down" ); closePrivButton( "schedule_cancel_race_move" ); FOR ($server_number=1;$server_number<=8;$server_number=$server_number+1) closePrivButton( "schedule_server_name_" . $server_number ); closePrivButton("schedule_server_name_copy_". $server_number ); closePrivButton( "schedule_server_name_input_" . $server_number); closePrivButton( "schedule_server_def_pwd_input_" . $server_number); ENDFOR close_user_input_buttons ( $KeyFlags ); close_layout_splits ( $KeyFlags,$id ); closePrivButton( "schedule_delete_all_server_names" ); closePrivButton( "schedule_close" ); closePrivButton( "schedule_delete" ); close_general_schdl_settings ( $KeyFlags,$id ); IF ( $id == "schedule_close" ) THEN SetCurrentPlayerVar( "server_name_schedule" , "" ); ENDIF EndSub Sub delete_all_server_names ( $KeyFlags,$id ) ### Delete all server names (that are currently filled) from the database ### ### Re-open the set_schedule GUI ### FOR ($server=1;$server<=8;$server=$server+1) IF ( GetStoredValue( "SCHDL_SERVER_NAME_" . $server ) != "" ) THEN DeleteStoredValue( "SCHDL_SERVER_NAME_" . $server ); DeleteStoredValue( "SCHDL_SERVER_DEF_PWD_" . $server ); ENDIF ENDFOR Set_Schedule( $KeyFlags ); ### End ### EndSub Sub schedule_delete_confirm ( $KeyFlags,$id ) close_user_input_buttons ( $KeyFlags ); $left_right_schedule = 1; $top_bottom_schedule = 101; openPrivButton( "schedule_confirm_schedule_delete_bg",$left_right_schedule+54,$top_bottom_schedule+1,82,17,5,-1,16,"" ); openPrivButton( "schedule_confirm_schedule_delete_text",$left_right_schedule+54,$top_bottom_schedule+2,82,5,5,-1,0,"^7Are you sure you want to delete the whole schedule for this server?" ); openPrivButton( "schedule_confirm_schedule_delete",$left_right_schedule+55,$top_bottom_schedule+12,40,5,5,-1,32,"^2Confirm delete whole schedule", schedule_delete ); openPrivButton( "schedule_cancel_schedule_delete",$left_right_schedule+95,$top_bottom_schedule+12,40,5,5,-1,32,"^1Cancel delete whole schedule", schedule_cancel_delete ); EndSub Sub schedule_cancel_delete ( $KeyFlags,$id ) closePrivButton( "schedule_confirm_schedule_delete_bg&schedule_confirm_schedule_delete_text&schedule_confirm_schedule_delete&schedule_cancel_schedule_delete" ); Set_Schedule( $KeyFlags ); EndSub Sub schedule_delete ( $KeyFlags,$id ) closePrivButton( "schedule_confirm_schedule_delete_bg&schedule_confirm_schedule_delete_text&schedule_confirm_schedule_delete&schedule_cancel_schedule_delete" ); FOR ($race_number=1;$race_number<=14;$race_number=$race_number+1) IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "date_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "time_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "time_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "track_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "layout_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "splits_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cars_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cars_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "laps_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "laps_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "event_pwd_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "event_pwd_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "regular_pwd_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "regular_pwd_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "comment_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "comment_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "weather_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "weather_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "wind_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "wind_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "qual_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "qual_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "start_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "start_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "reset_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "reset_".$race_number ); ENDIF IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cruise_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "cruise_".$race_number ); ENDIF ### Check wether there are handicap settings that needs to be deleted and if so, delete them ### ### This needs to be done before race_id is deleted from the database ### $storage_name_hcs = "HCS_" . GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_".$race_number ) . "_"; IF ( GetStoredValue( $storage_name_hcs . "main_settings" ) != "" ) THEN $main_settings = SplitToArray ( GetStoredValue( $storage_name_hcs . "main_settings" ),"*" ); $number_of_cars = $main_settings[3]; DeleteStoredValue( $storage_name_hcs . "main_settings" ); FOR ( $car_nbr=1;$car_nbr<=$number_of_cars;$car_nbr=$car_nbr+1 ) DeleteStoredValue( $storage_name_hcs . "car_" . $car_nbr ); ENDFOR ENDIF ### End ### IF ( GetStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_".$race_number ) != "" ) THEN DeleteStoredValue( GetCurrentPlayerVar( "storage_name_schdl" ) . "race_id_".$race_number ); ENDIF ENDFOR PrivMsg ( "^7INFO: Whole schedule for this server has been deleted" ); close_user_input_buttons ( $KeyFlags ); Set_Schedule( $KeyFlags ); EndSub Sub close_user_input_buttons ( $KeyFlags ) FOR ($race_number=1;$race_number<=14;$race_number=$race_number+1) closePrivButton( "schedule_number_" . $race_number ); closePrivButton( "schedule_date_input_" . $race_number ); closePrivButton( "schedule_time_input_" . $race_number ); closePrivButton( "schedule_track_input_" . $race_number ); closePrivButton( "schedule_layout_input_" . $race_number ); closePrivButton( "schedule_cars_input_" . $race_number ); closePrivButton( "schedule_cars_input2_" . $race_number ); closePrivButton( "schedule_laps_input_" . $race_number ); closePrivButton( "schedule_event_pwd_input_" . $race_number ); closePrivButton( "schedule_regular_pwd_input_" . $race_number ); closePrivButton( "schedule_comment_input_" . $race_number ); closePrivButton( "schedule_race_id_" . $race_number ); closePrivButton( "schedule_weather_input_" . $race_number ); closePrivButton( "schedule_wind_input_" . $race_number ); closePrivButton( "schedule_qual_input_" . $race_number ); closePrivButton( "schedule_start_input_" . $race_number ); closePrivButton( "schedule_reset_input_" . $race_number ); closePrivButton( "schedule_cruise_input_" . $race_number ); ENDFOR SetCurrentPlayerVar( "time_def_value" , "" ); SetCurrentPlayerVar( "regular_pwd_def_value" , "" ); SetCurrentPlayerVar( "weather_def_value" , "" ); SetCurrentPlayerVar( "wind_def_value" , "" ); SetCurrentPlayerVar( "qual_def_value" , "" ); SetCurrentPlayerVar( "start_def_value" , "" ); SetCurrentPlayerVar( "reset_def_value" , "" ); SetCurrentPlayerVar( "cruise_def_value" , "" ); EndSub Sub configure_schedule ( $KeyFlags,$id ) ### Close user_input buttons , close title buttons from schedule and 'Delete whole schedule' button ### close_user_input_buttons ( $KeyFlags ); close_layout_splits ( $KeyFlags,$id ); closePrivButton( "schedule_number" ); closePrivButton( "schedule_date" ); closePrivButton( "schedule_time" ); closePrivButton( "schedule_time_default" ); closePrivButton( "schedule_track" ); closePrivButton( "schedule_cars" ); closePrivButton( "schedule_laps" ); closePrivButton( "schedule_weather" ); closePrivButton( "schedule_weather_default" ); closePrivButton( "schedule_wind" ); closePrivButton( "schedule_wind_default" ); closePrivButton( "schedule_qual" ); closePrivButton( "schedule_qual_default" ); closePrivButton( "schedule_start" ); closePrivButton( "schedule_start_default" ); closePrivButton( "schedule_reset" ); closePrivButton( "schedule_reset_default" ); closePrivButton( "schedule_cruise" ); closePrivButton( "schedule_cruise_default" ); closePrivButton( "schedule_comment" ); closePrivButton( "schedule_event_pwd" ); closePrivButton( "schedule_regular_pwd" ); closePrivButton( "schedule_regular_pwd_default" ); closePrivButton( "schedule_race_id" ); closePrivButton( "schedule_more_options" ); closePrivButton( "schedule_less_options" ); closePrivButton( "schedule_delete" ); closePrivButton( "schedule_race_up" ); closePrivButton( "schedule_race_down" ); closePrivButton( "schedule_cancel_race_move" ); ### End ### ### Set values for left/right and top/bottom coordinates ### $left_right_schedule = 1; $top_bottom_schedule = 76; ### End ### IF ( GetStoredValue ( "SCHDL_GENERAL_RESET" ) != "" && GetCurrentPlayerVar( "first_use" ) == "no" ) THEN ### Re-open CFG-button with green text, to indicate CFG-screen is open openPrivButton( "schedule_server_cfg",$left_right_schedule+186,$top_bottom_schedule-45,5,5,5,-1,16,"^2CFG",close_general_schdl_settings ); ### End ### ENDIF openPrivButton( "set_schedule_cfg_bg",$left_right_schedule+1,$top_bottom_schedule,111,82,5,-1,32,"" ); openPrivButton( "set_schedule_cfg_title",$left_right_schedule+2,$top_bottom_schedule+1,109,5,5,-1,16,"^7Configure general schedule settings" ); openPrivButton( "set_schedule_cfg_allow_reset",$left_right_schedule+2,$top_bottom_schedule+11,34,5,5,-1,80,"^7Allow reset in general:" ); IF ( GetStoredValue( "SCHDL_GENERAL_RESET" ) == "Yes" ) THEN openPrivButton( "set_schedule_cfg_allow_reset_yes",$left_right_schedule+36,$top_bottom_schedule+11,25,5,5,-1,16,"^2Yes",config_general_reset ); ELSE openPrivButton( "set_schedule_cfg_allow_reset_yes",$left_right_schedule+36,$top_bottom_schedule+11,25,5,5,-1,16,"^3Yes",config_general_reset ); ENDIF IF ( GetStoredValue( "SCHDL_GENERAL_RESET" ) == "No" ) THEN openPrivButton( "set_schedule_cfg_allow_reset_no",$left_right_schedule+61,$top_bottom_schedule+11,25,5,5,-1,16,"^2No",config_general_reset ); ELSE openPrivButton( "set_schedule_cfg_allow_reset_no",$left_right_schedule+61,$top_bottom_schedule+11,25,5,5,-1,16,"^3No",config_general_reset ); ENDIF openPrivButton( "set_schedule_cfg_schdl_check",$left_right_schedule+2,$top_bottom_schedule+16,34,5,5,-1,80,"^7When to check schedule:" ); IF ( GetStoredValue( "SCHDL_CHECK" ) == "Every day" ) THEN openPrivButton( "set_schedule_cfg_schdl_check_daily",$left_right_schedule+36,$top_bottom_schedule+16,25,5,5,-1,16,"^2Every day",config_schedule_check ); IF ( GetStoredValue( "SCHDL_CHECK_HOUR" ) != "" && GetStoredValue( "SCHDL_CHECK_HOUR_MINUTE" ) != "" ) THEN openPrivTextButton( "set_schedule_cfg_schdl_check_interval_hour",$left_right_schedule+86,$top_bottom_schedule+16,25,5,5,16,"^3Set hour and minute to check schedule on (seperated by :)","^7@ ^3" . GetStoredValue( "SCHDL_CHECK_HOUR" ) . " ^7H ^3" . GetStoredValue( "SCHDL_CHECK_HOUR_MINUTE" ) . " ^7M",5,config_schedule_interval ); ELSE openPrivTextButton( "set_schedule_cfg_schdl_check_interval_hour",$left_right_schedule+86,$top_bottom_schedule+16,25,5,5,16,"^3Set hour and minute to check schedule on (seperated by :)","^3Set time",5,config_schedule_interval ); ENDIF ELSE openPrivButton( "set_schedule_cfg_schdl_check_daily",$left_right_schedule+36,$top_bottom_schedule+16,25,5,5,-1,16,"^3Every day",config_schedule_check ); ENDIF IF ( GetStoredValue( "SCHDL_CHECK" ) == "Every hour" ) THEN openPrivButton( "set_schedule_cfg_schdl_check_hour",$left_right_schedule+61,$top_bottom_schedule+16,25,5,5,-1,16,"^2Every hour",config_schedule_check ); IF ( GetStoredValue( "SCHDL_CHECK_MINUTE" ) != "" ) THEN openPrivTextButton( "set_schedule_cfg_schdl_check_interval_minute",$left_right_schedule+86,$top_bottom_schedule+16,25,5,5,16,"^3Set minute to check schedule on","^7@ ^3" . GetStoredValue( "SCHDL_CHECK_MINUTE" ) . " ^7minute(s)",2,config_schedule_interval ); ELSE openPrivTextButton( "set_schedule_cfg_schdl_check_interval_minute",$left_right_schedule+86,$top_bottom_schedule+16,25,5,5,16,"^3Set minute to check schedule on","^3Set minutes",2,config_schedule_interval ); ENDIF ELSE openPrivButton( "set_schedule_cfg_schdl_check_hour",$left_right_schedule+61,$top_bottom_schedule+16,25,5,5,-1,16,"^3Every hour",config_schedule_check ); ENDIF openPrivButton( "set_schedule_cfg_server_change",$left_right_schedule+2,$top_bottom_schedule+21,34,5,5,-1,80,"^7Change server settings:" ); IF ( GetStoredValue( "SCHDL_CHANGE" ) == "Day of event" ) THEN openPrivButton( "set_schedule_cfg_server_change_day",$left_right_schedule+36,$top_bottom_schedule+21,25,5,5,-1,16,"^2Day of event",config_schedule_change ); ELSE openPrivButton( "set_schedule_cfg_server_change_day",$left_right_schedule+36,$top_bottom_schedule+21,25,5,5,-1,16,"^3Day of event",config_schedule_change ); ENDIF IF ( GetStoredValue( "SCHDL_CHANGE" ) == "1 hour before event" ) THEN openPrivButton( "set_schedule_cfg_server_change_one_hour",$left_right_schedule+61,$top_bottom_schedule+21,25,5,5,-1,16,"^21 hour before event",config_schedule_change ); ELSE openPrivButton( "set_schedule_cfg_server_change_one_hour",$left_right_schedule+61,$top_bottom_schedule+21,25,5,5,-1,16,"^31 hour before event",config_schedule_change ); ENDIF openPrivButton( "set_schedule_cfg_event_end",$left_right_schedule+2,$top_bottom_schedule+26,34,5,5,-1,80,"^7When does event end:" ); IF ( GetStoredValue( "SCHDL_EVENT_END" ) == "After 2 hours" ) THEN openPrivButton( "set_schedule_cfg_event_end_2hours",$left_right_schedule+36,$top_bottom_schedule+26,25,5,5,-1,16,"^2After 2 hours",config_end_event ); ELSE openPrivButton( "set_schedule_cfg_event_end_2hours",$left_right_schedule+36,$top_bottom_schedule+26,25,5,5,-1,16,"^3After 2 hours",config_end_event ); ENDIF IF ( GetStoredValue( "SCHDL_EVENT_END" ) == "After 3 hours" ) THEN openPrivButton( "set_schedule_cfg_event_end_3hours",$left_right_schedule+61,$top_bottom_schedule+26,25,5,5,-1,16,"^2After 3 hours",config_end_event ); ELSE openPrivButton( "set_schedule_cfg_event_end_3hours",$left_right_schedule+61,$top_bottom_schedule+26,25,5,5,-1,16,"^3After 3 hours",config_end_event ); ENDIF IF ( GetStoredValue( "SCHDL_EVENT_END" ) == "No automatic end" ) THEN openPrivButton( "set_schedule_cfg_event_end_no",$left_right_schedule+86,$top_bottom_schedule+26,25,5,5,-1,16,"^2No automatic end",config_end_event ); ELSE openPrivButton( "set_schedule_cfg_event_end_no",$left_right_schedule+86,$top_bottom_schedule+26,25,5,5,-1,16,"^3No automatic end",config_end_event ); ENDIF openPrivButton( "set_schedule_cfg_standard_race",$left_right_schedule+2,$top_bottom_schedule+31,34,5,5,-1,80,"^7Set standard race after event:" ); IF ( GetStoredValue( "SCHDL_STD_RACE" ) == "Yes" ) THEN openPrivButton( "set_schedule_cfg_standard_race_yes",$left_right_schedule+36,$top_bottom_schedule+31,25,5,5,-1,16,"^2Yes",config_std_race ); openPrivButton( "set_schedule_cfg_standard_race_track",$left_right_schedule+23,$top_bottom_schedule+36,13,5,5,-1,80,"^7Track:" ); IF ( GetStoredValue( "SCHDL_STD_TRACK" ) == "" ) THEN openPrivTextButton( "set_schedule_cfg_standard_track",$left_right_schedule+36,$top_bottom_schedule+36,25,5,5,16,"^3Track (Short trackcode) standard race ","^3Set track",5,config_track ); ELSE openPrivTextButton( "set_schedule_cfg_standard_track",$left_right_schedule+36,$top_bottom_schedule+36,25,5,5,16,"^3Track (Short trackcode) standard race ","^3".GetStoredValue( "SCHDL_STD_TRACK" ),5,config_track ); ENDIF openPrivButton( "set_schedule_cfg_standard_race_cars",$left_right_schedule+23,$top_bottom_schedule+41,13,5,5,-1,80,"^7Car(s):" ); IF ( GetStoredValue( "SCHDL_STD_CARS" ) == "" ) THEN openPrivTextButton( "set_schedule_cfg_standard_cars",$left_right_schedule+36,$top_bottom_schedule+41,35,5,5,16,"^3Car(s) (use + between carnames) standard race ","^3Set car(s)",40,config_cars ); openPrivButton( "set_schedule_cfg_standard_cars_2",$left_right_schedule+71,$top_bottom_schedule+41,3,5,5,-1,16,"^3+" , config_cars_gui ); ELSE openPrivTextButton( "set_schedule_cfg_standard_cars",$left_right_schedule+36,$top_bottom_schedule+41,35,5,5,16,"^3Car(s) (use + between carnames) standard race ","^3".GetStoredValue( "SCHDL_STD_CARS" ),40,config_cars ); openPrivButton( "set_schedule_cfg_standard_cars_2",$left_right_schedule+71,$top_bottom_schedule+41,3,5,5,-1,16,"^3+" , config_cars_gui ); ENDIF openPrivButton( "set_schedule_cfg_standard_race_laps",$left_right_schedule+23,$top_bottom_schedule+46,13,5,5,-1,80,"^7Laps:" ); IF ( GetStoredValue( "SCHDL_STD_LAPS" ) == "" ) THEN openPrivTextButton( "set_schedule_cfg_standard_laps",$left_right_schedule+36,$top_bottom_schedule+46,25,5,5,16,"^3Number of laps (0-99,100,110,120,...,1000) standard race","^3Set laps",4,config_laps ); ELSE openPrivTextButton( "set_schedule_cfg_standard_laps",$left_right_schedule+36,$top_bottom_schedule+46,25,5,5,16,"^3Number of laps (0-99,100,110,120,...,1000) standard race","^3".GetStoredValue( "SCHDL_STD_LAPS" ),4,config_laps ); ENDIF openPrivButton( "set_schedule_cfg_standard_race_password",$left_right_schedule+23,$top_bottom_schedule+51,13,5,5,-1,80,"^7Password:" ); IF ( GetStoredValue( "SCHDL_STD_PASSWORD" ) == "" ) THEN openPrivTextButton( "set_schedule_cfg_standard_password",$left_right_schedule+36,$top_bottom_schedule+51,25,5,5,16,"^3Password standard race,","^3Set password",20,config_standard_race_password ); ELSE openPrivTextButton( "set_schedule_cfg_standard_password",$left_right_schedule+36,$top_bottom_schedule+51,25,5,5,16,"^3Password standard race","^3".GetStoredValue( "SCHDL_STD_PASSWORD" ),20,config_standard_race_password ); ENDIF ELSE openPrivButton( "set_schedule_cfg_standard_race_yes",$left_right_schedule+36,$top_bottom_schedule+31,25,5,5,-1,16,"^3Yes",config_std_race ); ENDIF IF ( GetStoredValue( "SCHDL_STD_RACE" ) == "No" ) THEN openPrivButton( "set_schedule_cfg_standard_race_no",$left_right_schedule+61,$top_bottom_schedule+31,25,5,5,-1,16,"^2No",config_std_race ); ELSE openPrivButton( "set_schedule_cfg_standard_race_no",$left_right_schedule+61,$top_bottom_schedule+31,25,5,5,-1,16,"^3No",config_std_race ); ENDIF openPrivButton( "set_schedule_cfg_timezone_1",$left_right_schedule+2,$top_bottom_schedule+56,34,5,5,-1,80,"^7Timezone 1 + offset to UTC:" ); IF ( GetStoredValue( "SCHDL_TIMEZONE_1" ) == "" ) THEN openPrivTextButton( "set_schedule_cfg_timezone_1_input",$left_right_schedule+36,$top_bottom_schedule+56,25,5,5,16,"^3Set timezone 1","^3Set timezone 1",4,config_timezone ); ELSE openPrivTextButton( "set_schedule_cfg_timezone_1_input",$left_right_schedule+36,$top_bottom_schedule+56,25,5,5,16,"^3Set timezone 1","^3" . GetStoredValue( "SCHDL_TIMEZONE_1" ),4,config_timezone ); ENDIF IF ( GetStoredValue( "SCHDL_TIMEZONE_1_OFFSET" ) == "" ) THEN openPrivTextButton( "set_schedule_cfg_timezone_1_offset",$left_right_schedule+61,$top_bottom_schedule+56,25,5,5,16,"^3Offset timezone 1 relative to UTC","^3Set offset timezone 1",2,config_timezone_offset ); ELSE openPrivTextButton( "set_schedule_cfg_timezone_1_offset",$left_right_schedule+61,$top_bottom_schedule+56,25,5,5,16,"^3Offset timezone 1 relative to UTC","^3" . GetStoredValue( "SCHDL_TIMEZONE_1_OFFSET" ),2,config_timezone_offset ); ENDIF openPrivButton( "set_schedule_cfg_timezone_2",$left_right_schedule+2,$top_bottom_schedule+61,34,5,5,-1,80,"^7Timezone 2 + offset to UTC:" ); IF ( GetStoredValue( "SCHDL_TIMEZONE_2" ) == "" ) THEN openPrivTextButton( "set_schedule_cfg_timezone_2_input",$left_right_schedule+36,$top_bottom_schedule+61,25,5,5,16,"^3Set timezone 2","^3Set timezone 2",4,config_timezone ); ELSE openPrivTextButton( "set_schedule_cfg_timezone_2_input",$left_right_schedule+36,$top_bottom_schedule+61,25,5,5,16,"^3Set timezone 2","^3" . GetStoredValue( "SCHDL_TIMEZONE_2" ),4,config_timezone ); ENDIF IF ( GetStoredValue( "SCHDL_TIMEZONE_2_OFFSET" ) == "" ) THEN openPrivTextButton( "set_schedule_cfg_timezone_2_offset",$left_right_schedule+61,$top_bottom_schedule+61,25,5,5,16,"^3Offset timezone 2 relative to UTC","^3Set offset timezone 2",2,config_timezone_offset ); ELSE openPrivTextButton( "set_schedule_cfg_timezone_2_offset",$left_right_schedule+61,$top_bottom_schedule+61,25,5,5,16,"^3Offset timezone 2 relative to UTC","^3" . GetStoredValue( "SCHDL_TIMEZONE_2_OFFSET" ),2,config_timezone_offset ); ENDIF openPrivButton( "set_schedule_cfg_close",$left_right_schedule+2,$top_bottom_schedule+76,109,5,5,-1,16,"^3Close general schedule settings",close_general_schdl_settings ); EndSub Sub config_general_reset( $KeyFlags,$id ) IF ( $id == "set_schedule_cfg_allow_reset_yes" ) THEN SetStoredValue( "SCHDL_GENERAL_RESET","Yes" ); ELSE SetStoredValue( "SCHDL_GENERAL_RESET","No" ); ENDIF cmdLFS("/canreset " . GetStoredValue( "SCHDL_GENERAL_RESET" ) ); configure_schedule ( $KeyFlags,$id ); EndSub Sub config_schedule_check( $KeyFlags,$id ) IF ( $id == "set_schedule_cfg_schdl_check_daily" ) THEN SetStoredValue( "SCHDL_CHECK","Every day" ); DeleteStoredValue( "SCHDL_CHECK_MINUTE" ); closePrivButton( "set_schedule_cfg_schdl_check_interval_minute" ); ENDIF IF ( $id == "set_schedule_cfg_schdl_check_hour" ) THEN SetStoredValue( "SCHDL_CHECK","Every hour" ); DeleteStoredValue( "SCHDL_CHECK_HOUR" ); DeleteStoredValue( "SCHDL_CHECK_HOUR_MINUTE" ); closePrivButton( "set_schedule_cfg_schdl_check_interval_hour" ); ENDIF IF ( $id == "set_schedule_cfg_schdl_check_other" ) THEN SetStoredValue( "SCHDL_CHECK","Other" ); ENDIF configure_schedule ( $KeyFlags,$id ); EndSub Sub config_schedule_interval ( $id,$text ) IF ( SubStr ( $id , 38 , 6 ) == "minute" ) THEN IF ( isnum ( $text ) == 1 ) THEN SetStoredValue( "SCHDL_CHECK_MINUTE",$text ); ### Syntax: ss mm hh dayofweek dd MM YYYY ### SetStoredValue( "SCHDL_CHECK_RSA","0 ".$text." * * * * *" ); RemoveScheduleAction( "check_schedule" ); RegisterScheduleAction( "check_schedule","" . GetStoredValue( "SCHDL_CHECK_RSA" ), Schedule_trackcheck ); $track_check_minute = $text-1; IF ( $track_check_minute < 0 ) THEN $track_check_minute = $track_check_minute + 60; ENDIF $track_check_schedule = "0 ".$track_check_minute." * * * * *"; RemoveScheduleAction( "check_track" ); RegisterScheduleAction( "check_track","" . $track_check_schedule, Track_check ); ELSE PrivMsg ( "^1WARNING: ^7Entered value isn't a number" ); ENDIF ENDIF IF ( SubStr ( $id , 38 , 4 ) == "hour" ) THEN $values = SplitToArray ( $text,":" ); $hour = $values[0]; $minutes = $values[1]; IF ( isnum ( $hour ) == 1 && isnum ( $minutes ) == 1 ) THEN SetStoredValue( "SCHDL_CHECK_HOUR",$hour ); SetStoredValue( "SCHDL_CHECK_HOUR_MINUTE",$minutes ); ### Syntax: ss mm hh dayofweek dd MM YYYY ### SetStoredValue( "SCHDL_CHECK_RSA","0 ".$minutes." ".$hour." * * * *" ); RemoveScheduleAction( "check_schedule" ); RegisterScheduleAction( "check_schedule","" . GetStoredValue( "SCHDL_CHECK_RSA" ), Schedule_trackcheck ); $track_check_minute = $minutes-1; IF ( $track_check_minute < 0 ) THEN $track_check_minute = $track_check_minute + 60; $hour = $hour - 1; IF ( $hour < 0 ) THEN $hour = $hour + 24; ENDIF ENDIF $track_check_schedule = "0 ".$track_check_minute." ".$hour." * * * *"; RemoveScheduleAction( "check_track" ); RegisterScheduleAction( "check_track","" . $track_check_schedule, Track_check ); ELSE PrivMsg ( "^1WARNING: ^7Entered value isn't a number or format is wrong" ); ENDIF ENDIF configure_schedule ( $KeyFlags,$id ); EndSub Sub config_schedule_change( $KeyFlags,$id ) IF ( $id == "set_schedule_cfg_server_change_day" ) THEN SetStoredValue( "SCHDL_CHANGE","Day of event" ); ENDIF IF ( $id == "set_schedule_cfg_server_change_one_hour" ) THEN SetStoredValue( "SCHDL_CHANGE","1 hour before event" ); ENDIF IF ( $id == "set_schedule_cfg_server_change_other" ) THEN SetStoredValue( "SCHDL_CHANGE","Other" ); ENDIF configure_schedule ( $KeyFlags,$id ); EndSub Sub config_end_event ( $KeyFlags,$id ) IF ( $id == "set_schedule_cfg_event_end_2hours" ) THEN SetStoredValue( "SCHDL_EVENT_END","After 2 hours" ); ENDIF IF ( $id == "set_schedule_cfg_event_end_3hours" ) THEN SetStoredValue( "SCHDL_EVENT_END","After 3 hours" ); ENDIF IF ( $id == "set_schedule_cfg_event_end_no" ) THEN SetStoredValue( "SCHDL_EVENT_END","No automatic end" ); ENDIF configure_schedule ( $KeyFlags,$id ); EndSub Sub config_std_race ( $KeyFlags,$id ) IF ( $id == "set_schedule_cfg_standard_race_yes" ) THEN SetStoredValue( "SCHDL_STD_RACE","Yes" ); ENDIF IF ( $id == "set_schedule_cfg_standard_race_no" ) THEN SetStoredValue( "SCHDL_STD_RACE","No" ); DeleteStoredValue( "SCHDL_STD_TRACK" ); DeleteStoredValue( "SCHDL_STD_CARS" ); DeleteStoredValue( "SCHDL_STD_LAPS" ); DeleteStoredValue( "SCHDL_STD_PASSWORD" ); closePrivButton( "set_schedule_cfg_standard_race_track" ); closePrivButton( "set_schedule_cfg_standard_track" ); closePrivButton( "set_schedule_cfg_standard_race_cars" ); closePrivButton( "set_schedule_cfg_standard_cars" ); closePrivButton( "set_schedule_cfg_standard_cars_2" ); closePrivButton( "set_schedule_cfg_standard_race_laps" ); closePrivButton( "set_schedule_cfg_standard_laps" ); closePrivButton( "set_schedule_cfg_standard_race_password" ); closePrivButton( "set_schedule_cfg_standard_password" ); ENDIF configure_schedule ( $KeyFlags,$id ); EndSub Sub config_timezone ( $id,$text ) IF ( $id == "set_schedule_cfg_timezone_1_input" ) THEN SetStoredValue( "SCHDL_TIMEZONE_1",$text ); ENDIF IF ( $id == "set_schedule_cfg_timezone_2_input" ) THEN SetStoredValue( "SCHDL_TIMEZONE_2",$text ); ENDIF configure_schedule ( $KeyFlags,$id ); EndSub Sub config_timezone_offset ( $id,$text ) IF ( $id == "set_schedule_cfg_timezone_1_offset" ) THEN SetStoredValue( "SCHDL_TIMEZONE_1_OFFSET",$text ); ENDIF IF ( $id == "set_schedule_cfg_timezone_2_offset" ) THEN SetStoredValue( "SCHDL_TIMEZONE_2_OFFSET",$text ); ENDIF configure_schedule ( $KeyFlags,$id ); EndSub Sub close_general_schdl_settings ( $KeyFlags,$id ) closePrivButton( "set_schedule_cfg_bg" ); closePrivButton( "set_schedule_cfg_title" ); closePrivButton( "set_schedule_cfg_allow_reset" ); closePrivButton( "set_schedule_cfg_allow_reset_yes" ); closePrivButton( "set_schedule_cfg_allow_reset_no" ); closePrivButton( "set_schedule_cfg_schdl_check" ); closePrivButton( "set_schedule_cfg_schdl_check_daily" ); closePrivButton( "set_schedule_cfg_schdl_check_hour" ); closePrivButton( "set_schedule_cfg_schdl_check_interval_hour" ); closePrivButton( "set_schedule_cfg_schdl_check_interval_minute" ); closePrivButton( "set_schedule_cfg_schdl_check_other" ); closePrivButton( "set_schedule_cfg_server_change" ); closePrivButton( "set_schedule_cfg_server_change_day" ); closePrivButton( "set_schedule_cfg_server_change_one_hour" ); closePrivButton( "set_schedule_cfg_server_change_other" ); closePrivButton( "set_schedule_cfg_event_end" ); closePrivButton( "set_schedule_cfg_event_end_2hours" ); closePrivButton( "set_schedule_cfg_event_end_3hours" ); closePrivButton( "set_schedule_cfg_event_end_no" ); closePrivButton( "set_schedule_cfg_standard_race" ); closePrivButton( "set_schedule_cfg_standard_race_yes" ); closePrivButton( "set_schedule_cfg_standard_race_no" ); closePrivButton( "set_schedule_cfg_standard_race_track" ); closePrivButton( "set_schedule_cfg_standard_track" ); closePrivButton( "set_schedule_cfg_standard_race_cars" ); closePrivButton( "set_schedule_cfg_standard_cars" ); closePrivButton( "set_schedule_cfg_standard_cars_2" ); closePrivButton( "set_schedule_cfg_standard_race_laps" ); closePrivButton( "set_schedule_cfg_standard_laps" ); closePrivButton( "set_schedule_cfg_standard_race_password" ); closePrivButton( "set_schedule_cfg_standard_password" ); closePrivButton( "set_schedule_cfg_timezone_1" ); closePrivButton( "set_schedule_cfg_timezone_1_input" ); closePrivButton( "set_schedule_cfg_timezone_1_offset" ); closePrivButton( "set_schedule_cfg_timezone_2" ); closePrivButton( "set_schedule_cfg_timezone_2_input" ); closePrivButton( "set_schedule_cfg_timezone_2_offset" ); closePrivButton( "set_schedule_cfg_close" ); IF ( GetStoredValue ( "SCHDL_GENERAL_RESET" ) != "" ) THEN IF ( GetCurrentPlayerVar( "first_use" ) == "yes" ) THEN SetCurrentPlayerVar( "first_use" , "no" ); PrivMsg ( "^7INFO: General settings have been made, please restart Lapper now, using command: !reload" ); ENDIF ENDIF ### Re-open 'Set_Schedule' only if General Config screen is closed ### IF ( $id == "set_schedule_cfg_close" || $id == "schedule_server_cfg" ) THEN closePrivButton( "set_schedule_cfg" ); Set_Schedule( $KeyFlags ); ENDIF ### End ### EndSub