[Release] [ZM] Highest Round Tracker (UPDATED 3/13/2020)
-
Cahz Is there a way to get this to work in 2021? Created a server recently and the pathing the script uses is the old way files were laid out. Such as, gameserver/t6r/data/logs not existing anymore
-
looks allot like mine
btw need this plugin
put This into <bo2 folder>\t6r\data\plugins#include maps/mp/zombies/_zm; #include maps/mp/zombies/_zm_ai_dogs; #include maps/mp/zombies/_zm_stats; #include common_scripts/utility; #include maps/mp/gametypes_zm/_hud_util; #include maps/mp/_utility; #include maps/mp/gametypes_zm/_globallogic; #include maps/mp/zombies/_zm_weapons; #include maps/mp/zombies/_zm_utility; #include maps/mp/gametypes_zm/_hud_message; #include maps/mp/gametypes_zm/_globallogic_score; #include maps/mp/gametypes_zm/_globallogic_utils; #include maps/mp/gametypes_zm/_globallogic_defaults; #include maps/mp/gametypes_zm/_globallogic_spawn; #include maps/mp/zombies/_zm_perks; #include maps/mp/zm_tomb_utility; #include maps/mp/zombies/_zm_challenges; #include maps/mp/zombies/_zm_laststand; #include maps/mp/zm_tomb_ee_main; #include maps/mp/zombies/_zm_sidequests; #include maps/mp/gametypes_zm/_weapons; #include maps/mp/zm_tomb_ee_main_step_1; #include maps/mp/_challenges; init() { thread high_round_tracker(); } get_map_name() { if (!isDefined(level.levelname)) { if (level.script == "zm_transit" && level.scr_zm_map_start_location == "transit") { level.levelname = "Tranzit"; } else if (level.script == "zm_transit" && level.scr_zm_map_start_location == "town") { level.levelname = "Town"; } else if (level.script == "zm_transit" && level.scr_zm_map_start_location == "farm") { level.levelname = "Farm"; } else if (level.script == "zm_nuked") { level.levelname = "Nuketown"; } else if (level.script == "zm_highrise") { level.levelname = "Die Rise"; } else if (level.script == "zm_prison") { level.levelname = "Mob of the Dead"; } else if (level.script == "zm_buried") { level.levelname = "Buried"; } else if (level.script == "zm_tomb") { level.levelname = "Origins"; } else level.levelname = "Unknown Map"; } return level.levelname; } high_round_tracker() { level endon( "end_game" ); level.basepath = getDvar("fs_basepath") + "/" + getDvar("fs_basegame"); path3 = level.basepath + get_map_name() + "_" + "Leaderboard2.txt"; //file3 = fopen(path3, "a+"); etok="-"; if(fileExists(path3)) level.theLBstr = readfile(path3); else { level.HighRoundPlayers = "^5initialized"; writestr = "THRS,3,starting from scratch-\n"; writefile(path3,writestr,1); level.theLBstr = readfile(path3); } level.HighRound = getDvarIntDefault( mapName( level.script ) + "HighRound", 3 ); level.HighRoundPlayers = getDvar( mapName( level.script ) + "Players" ); level.theLB = strtok(level.theLBstr, etok); foreach ( lbline in level.theLB ) { getlbs = strtok(lbline, ","); if(getlbs[0] == "THRS" && level.HighRound <= getlbs[1] ) { setDvar( mapName( level.script ) + "HighRound", getlbs[1] ); setDvar( mapName( level.script ) + "Players", "" ); for (i=2;i<=getlbs.size;i++) { if ( getDvar( mapName( level.script ) + "Players" ) == "" ) { setDvar( mapName( level.script ) + "Players", getlbs[i] ); level.HighRoundPlayers = getDvar( mapName( level.script ) + "Players" ); } else { setDvar( mapName( level.script ) + "Players", level.HighRoundPlayers + ", " + getlbs[i] ); level.HighRoundPlayers = getDvar( mapName( level.script ) + "Players" ); } } } else if(getlbs[0] == "THRS" && level.HighRound > getlbs[1] ) { //fclose(file3); fremove(path3); //file3 = fopen(path3, "a+"); writestr = ("THRS," + level.HighRound + "," + level.HighRoundPlayers + etok); writefile(path3,writestr,1); } else if(getlbs[0] != "THRS" && level.HighRoundPlayers != "" ) { //fclose(file3); fremove(path3); //file3 = fopen(path3, "a+"); writestr = ("THRS," + level.HighRound + "," + level.HighRoundPlayers + etok); writefile(path3,writestr,1); } else { level.HighRoundPlayers = "^5initialized"; setDvar( mapName( level.script ) + "Players", level.HighRoundPlayers ); writestr = ("THRS," + level.HighRound + "," + level.HighRoundPlayers + etok); writefile(path3,writestr,1); } } level.HighRound = getDvarIntDefault( mapName( level.script ) + "HighRound", 3 ); level.HighRoundPlayers = getDvar( mapName( level.script ) + "Players" ); if ( level.HighRoundPlayers == "" ) { level.HighRoundPlayers = "^5initialized"; writestr = ("THRS,3,starting from scratch" + etok); writefile(path3,writestr,1); } //fclose(file3); istr=""; for(i=0;i<40;i+=4) istr+=i + " "; for(i=40;i<100;i+=3) istr+=i + " "; fourfactor=strtok(istr," "); for ( ;; ) { level waittill ( "end_of_round" ); players = getplayers(); foreach (player in players) player thread Ping_kick_check(player); foreach (ff in fourfactor) { if (int(ff) == level.round_number) level thread high_round_info(); } if( level.round_number == level.HighRound ) { players = getplayers(); foreach (player in players) player tell("^5you are about to over throw the ^7high round record ^5if you can pass this round. ^3Good Luck"); } if ( level.round_number > level.HighRound ) { setDvar( mapName( level.script ) + "HighRound", level.round_number ); setDvar( mapName( level.script ) + "Players", "" ); level.HighRound = getDvarIntDefault( mapName( level.script ) + "HighRound", 3 ); players = get_players(); for ( i = 0; i < players.size; i++ ) { if ( getDvar( mapName( level.script ) + "Players" ) == "" ) { setDvar( mapName( level.script ) + "Players", players[i].name ); level.HighRoundPlayers = getDvar( mapName( level.script ) + "Players" ); } else { setDvar( mapName( level.script ) + "Players", level.HighRoundPlayers + ", " + players[i].name ); level.HighRoundPlayers = getDvar( mapName( level.script ) + "Players" ); } } iprintln ( "New Record: ^1" + level.HighRound ); iprintln ( "Set by: ^1" + level.HighRoundPlayers ); newLBstr=""; //logprint( "Map: " + mapName( level.script ) + " Record: " + level.HighRound + " Set by: " + level.HighRoundPlayers ); path1 = level.basepath + get_map_name() + "_" + "Leaderboard2.txt"; writestr = ("THRS," + level.HighRound + "," + level.HighRoundPlayers + etok); //file1 = fopen(path1, "a+"); level.theLBstr = readfile(path1); level.theLB = strtok(level.theLBstr,etok); foreach ( lbline in level.theLB ) { getlbs = strtok(lbline,","); if(getlbs[0] == "THRS") newLBstr = writestr; else newLBstr +=lbline + etok; } //fclose(file1); fremove(path1); //file1 = fopen(path1, "a+"); writefile(path1,newLBstr,1); //fclose(file1); } } } mapName( name ) { if( name == "zm_highrise" ) return "Die Rise"; else if( name == "zm_buried" ) return "Buried"; else if( name == "zm_prison" ) return "Mob of the Dead"; else if( name == "zm_tomb" ) return "Origins"; else if( name == "zm_nuked" ) return "Nuketown"; else if( name == "zm_transit" && level.scr_zm_map_start_location == "transit" ) return "Tranzit"; else if( name == "zm_transit" && level.scr_zm_map_start_location == "town" ) return "Town"; else if( name == "zm_transit" && level.scr_zm_map_start_location == "farm" ) return "Farm"; } high_round_info() { wait 10; AllClientsPrint( "Highest Round for this Map: ^1" + level.HighRound ); AllClientsPrint( "Record set by: ^1" + level.HighRoundPlayers ); } Ping_kick_check(player) { wait randomint( 20 ); } list_records( player ) { maps=[]; maps[0] = "Die Rise"; maps[maps.size] = "Buried"; maps[maps.size] = "Mob of the Dead"; maps[maps.size] = "Origins"; maps[maps.size] = "Nuketown"; maps[maps.size] = "Tranzit"; maps[maps.size] = "Town"; maps[maps.size] = "Farm"; recs=[]; level.basepath = getDvar("fs_basepath") + "/" + getDvar("fs_basegame"); for(i=0;i<maps.size;i++) { path = level.basepath + maps[i] + "_" + "Leaderboard.txt"; //file = fopen(path, "a+"); etok="-"; thisread = ""; thisread = readfile(path); if ( thisread == "" ) { thisread = "THRS,5,MrMrE-"; writefile(path,"THRS,5,MrMrE-",1); CONTINUE; } thisreadarray = strtok(thisread,etok); recs[i] = "^3 " + maps[i]; foreach(line in thisreadarray) { linearray = strtok(line,","); if(linearray[0] == "THRS") { recs[i] += ": ^1"+linearray[1]+ " ^7by "; for(j=2;isDefined(linearray[j]);j++) { if (j==2) recs[i] +="^6"+linearray[j] + " "; else recs[i] += "^7,^6"+linearray[j] + " "; } } } //fclose(file); } for(i=0;i<recs.size;i++) { self iPrintLn( recs[i] ); wait .7; } }
-
i get this error
2 script error(s): Unresolved external : -high_round_tracker- with 0 parameters in -example- at line 1 Unresolved external : -high_round_info- with 0 parameters in -example- at line 1 -
I fixed the script loading issue. Working with the latest version of the plugin (1.9.5). The script needs an elapsed game to save the first records, then it will display the information.
#include maps/mp/gametypes/_hud_message; #include maps/mp/gametypes/_globallogic_spawn; #include maps/mp/gametypes/_spectating; #include maps/mp/_tacticalinsertion; #include maps/mp/_challenges; #include maps/mp/gametypes/_globallogic; #include maps/mp/gametypes/_hud_util; #include maps/mp/_utility; #include common_scripts/utility; #include maps/mp/gametypes/_globallogic_ui; #include maps/mp/gametypes/_persistence; init() { level thread high_round_tracker(); level thread onPlayerConnect(); } onPlayerConnect() { for(;;) { level waittill("connected", player); player thread high_round_info(); } } high_round_tracker() { thread high_round_info_giver(); gamemode = gamemodeName( getDvar( "ui_gametype" ) ); map = mapName( level.script ); if( level.script == "zm_transit" && getDvar( "ui_gametype" ) == "zsurvival" ) map = startLocationName( getDvar( "ui_zm_mapstartlocation" ) ); //file handling// level.basepath = getDvar("fs_homepath") + "/"; path = level.basepath + "/logs/" + map + gamemode + "HighRound.txt"; file = fopen(path, "r"); text = fread(file); fclose(file); //end file handling// highroundinfo = strToK( text, ";" ); level.HighRound = int( highroundinfo[ 0 ] ); level.HighRoundPlayers = highroundinfo[ 1 ]; for ( ;; ) { level waittill ( "end_game" ); if ( level.round_number > level.HighRound ) { level.HighRoundPlayers = ""; players = get_players(); for ( i = 0; i < players.size; i++ ) { if( level.HighRoundPlayers == "" ) { level.HighRoundPlayers = players[i].name; } else { level.HighRoundPlayers = level.HighRoundPlayers + "," + players[i].name; } } foreach( player in level.players ) { player tell( "New Record: ^1" + level.round_number ); player tell( "Set by: ^1" + level.HighRoundPlayers ); } log_highround_record( level.round_number + ";" + level.HighRoundPlayers ); } } } log_highround_record( newRecord ) { gamemode = gamemodeName( getDvar( "ui_gametype" ) ); map = mapName( level.script ); if( level.script == "zm_transit" && getDvar( "ui_gametype" ) == "zsurvival" ) map = startLocationName( getDvar( "ui_zm_mapstartlocation" ) ); level.basepath = getDvar("fs_homepath") + "/"; path = level.basepath + "/logs/" + map + gamemode + "HighRound.txt"; file = fopen( path, "w" ); fwrite( file, newRecord ); fclose( file ); } startLocationName( location ) { if( location == "cornfield" ) return "Cornfield"; else if( location == "diner" ) return "Diner"; else if( location == "farm" ) return "Farm"; else if( location == "power" ) return "Power"; else if( location == "town" ) return "Town"; else if( location == "transit" ) return "BusDepot"; else if( location == "tunnel" ) return "Tunnel"; } mapName( map ) { if( map == "zm_buried" ) return "Buried"; else if( map == "zm_highrise" ) return "DieRise"; else if( map == "zm_prison" ) return "Motd"; else if( map == "zm_nuked" ) return "Nuketown"; else if( map == "zm_tomb" ) return "Origins"; else if( map == "zm_transit" ) return "Tranzit"; return "NA"; } gamemodeName( gamemode ) { if( gamemode == "zstandard" ) return "Standard"; else if( gamemode == "zclassic" ) return "Classic"; else if( gamemode == "zsurvival" ) return "Survival"; else if( gamemode == "zgrief" ) return "Grief"; else if( gamemode == "zcleansed" ) return "Turned"; return "NA"; } high_round_info_giver() { highroundinfo = 1; roundmultiplier = 5; level endon( "end_game" ); while( 1 ) { level waittill( "start_of_round" ); if( level.round_number == ( highroundinfo * roundmultiplier )) { highroundinfo++; foreach( player in level.players ) { player tell( "High Round Record for this map: ^1" + level.HighRound ); player tell( "Record set by: ^1" + level.HighRoundPlayers ); } } } } high_round_info() { wait 6; self tell( "High Round Record for this map: ^1" + level.HighRound ); self tell( "Record set by: ^1" + level.HighRoundPlayers ); }
-
Kalitos thank you bro it works perfect
-
Kalitos Any idea what I have done wrong with your script? I have placed the compiled gsc to .../Plutonium\storage\t6\scripts\zm and when running the server I receive this message. Would realllly love to add this feature to my server!
**** 5 script error(s):
**** Unresolved external : "fopen" with 2 parameters in "High scores" at lines 1,1 ****
**** Unresolved external : "fread" with 1 parameters in "High scores" at line 1 ****
**** Unresolved external : "fclose" with 1 parameters in "High scores" at lines -
Ch00chinat0r Got it to work. Had to scroll through more of the thread. Needed to add t6r folder to my game server folder and add the dll there. Great script! I really couldn't be happier with it!
-
Kalitos Hey, I tried using that script sadly as soon the script loads in my server, my server crashes and just reboots.. Do you have any idea how I can fix this issue?
-
akashio I don't know, maybe he forgot to load the plugin
-
Doesn't work for me.
**** Unresolved external : "fputs" with 2 parameters in "round-tracker" at line 1 **** -
emiloxd copy the version kalitos posted a few comments up that's the working one the version cahz put isn't working anymore because not updated in years(?)
-
I got some errors using that one aswell
-
I'd love to see a full tutorial of how to install this as im very lost on what is going on relating to this post. It's very confusing