#include #include #include #include #define CUP_DEFAULT_TIME 300 #define CUP_STATUS_NONE 0 #define CUP_STATUS_RUNNING 1 #define CUP_STATUS_FINISHED 2 #define CUP_VOICE_FEMALE 0 #define CUP_VOICE_MALE 1 #define CUP_START_COUNTDOWN 10 #define ACCESS_LEVEL ADMIN_LEVEL_A new jc_pluginname[] = "JBK Cup" new announc_interval new announc_voice new announcments new cup_time new cup_start_time // the time when the cup started new cup_status // the cup status (none, running or finished) new cup_start_id // the starte of the cup new cup_start_countdown new cup_rr_start new cup_rr_end new cup_god_mode new finish_locs[33][3] // the locs from the climbers when climbtime is 0 (the finish loc) new climber[33][33] // the climbers name new climbers // the number of climbers new menupos[33] public plugin_init() { register_plugin(jc_pluginname,"1.0","Juzam Djinn") register_clcmd("say /poscheck","jc_menu",0," - displays a menue to check the finish positions of the climbers") register_menucmd(register_menuid("\yPos check menue"),1023,"action_cup_menu") register_clcmd("say /cupmenu","jc_amenu", ACCESS_LEVEL, " - displays the admin menue for the climb cup") register_menucmd(register_menuid("\yCup admin menu"),1023,"action_cup_amenu") cup_status = CUP_STATUS_NONE cup_time = CUP_DEFAULT_TIME announc_interval = 30 announc_voice = CUP_VOICE_MALE cup_start_countdown = CUP_START_COUNTDOWN cup_rr_start = 0 cup_rr_end = 1 cup_god_mode = 2 return PLUGIN_CONTINUE } public action_cup_menu(id,key) { if( cup_status != CUP_STATUS_FINISHED ) return PLUGIN_HANDLED switch(key){ case 8: display_cup_menu(id,++menupos[id]) case 9: display_cup_menu(id,--menupos[id]) default:{ set_user_origin( id, finish_locs[menupos[id]*8+key] ) client_print(id,print_chat,"[%s] You have been teleported to the finish position of climber ^"%s^".", jc_pluginname, climber[menupos[id]*8+key] ) display_cup_menu( id, menupos[id] ) } } return PLUGIN_HANDLED } loc_is_set(i) { if( finish_locs[i][0] != 0 && finish_locs[i][1] != 0 && finish_locs[i][2] != 0 ) return 1 return 0 } display_cup_menu(id, pos) { if( pos < 0 ) return if( cup_status != CUP_STATUS_FINISHED ) { client_print(id,print_chat,"[%s] Cup-menu is only available when the climb cup has finished.", jc_pluginname ) return } new page = pos + 1 new pages = (climbers / 8) + ((climbers % 8 ) ? 1 : 0) new i = pos * 8 new keys = (1<<9) new key = 0 new menuBody[512] new len = format(menuBody, 511, "\yPos check menu\R%d/%d^n\w^n", page, pages ) while( !equal( climber[i], "" ) && key < 8 ){ if( loc_is_set(i) ) { keys |= (1< 900 ) cup_time = 60 display_cup_amenu( id, 0 ) } case 2: { announc_interval += 15 if( announc_interval > 180 ) announc_interval = 15 display_cup_amenu( id, 0 ) } case 3: { announc_voice = (announc_voice == CUP_VOICE_FEMALE ? CUP_VOICE_MALE : CUP_VOICE_FEMALE) display_cup_amenu( id, 0 ) } case 4: { cup_rr_start = (cup_rr_start ? 0 : 1) display_cup_amenu( id, 0 ) } case 5: { cup_rr_end = (cup_rr_end ? 0 : 1) display_cup_amenu( id, 0 ) } case 6: { cup_god_mode++; if( cup_god_mode >= 3 ) cup_god_mode = 0 display_cup_amenu( id, 0 ) } case 7: { for( new i = 0 ; i < 33; i++) { finish_locs[i][0] = 0 finish_locs[i][1] = 0 finish_locs[i][2] = 0 climber[i] = "" } cup_status = CUP_STATUS_NONE display_cup_amenu( id, 0 ) } default:{ display_cup_amenu( id, -1 ) } } return PLUGIN_HANDLED } display_cup_amenu(id, pos) { if( pos < 0 ) return new keys = (1<<9) new key = 0 new menuBody[512] new len = format(menuBody, 511, "\yCup admin menu\R^n\w^n" ) keys |= (1<