Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. BO2 Modding Releases & Resources
  3. [Release] [ZM] Highest Round Tracker (UPDATED 3/13/2020)

[Release] [ZM] Highest Round Tracker (UPDATED 3/13/2020)

Scheduled Pinned Locked Moved BO2 Modding Releases & Resources
27 Posts 15 Posters 6.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Waluijayundefined Offline
    Waluijayundefined Offline
    Waluijay
    replied to birchy on last edited by
    #9

    birchy

    #include maps\mp\_utility;
    #include common_scripts\utility;
    #include maps\mp\gametypes_zm\_hud_util;
    #include maps\mp\gametypes_zm\_hud_message;
    
    init()
    {
        level.perk_purchase_limit = 99;
        for(;;)
        {
            level waittill("connected", player);
    		player thread high_round_tracker();
        }
    }
    
    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_basepath") + "/" + getDvar("fs_basegame") + "/";
    	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_basepath") + "/" + getDvar("fs_basegame") + "/";
    	path = level.basepath + "/logs/" + map + gamemode + "HighRound.txt";
    	file = fopen( path, "w" );
    	fputs( newRecord, file );
    	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 iprintln( "High Round Record for this map: ^1" + level.HighRound );
    	self iprintln( "Record set by: ^1" + level.HighRoundPlayers );
    }
    

    It's almost identical and I have no compile errors, no startup errors. It logs everything correctly to the file it stores records in, it just doesn't run anything within itself below high_round_info_giver(), other scripts below that section run fine.

    Cahzundefined 1 Reply Last reply
    0
    • Cahzundefined Offline
      Cahzundefined Offline
      Cahz VIP
      replied to Waluijay on last edited by Cahz
      #10

      Waluijay You aren't calling level thread onPlayerConnect(); anywhere so of course it's not going to work. You're also calling the high round tracker as a player thread, when it's not needed to thread onto each player........ If you had looked at the screenshots you'd notice this.

      57ee2423-e1dc-4c1f-8ee8-1fd859e4f51e-image.png

      #include maps\mp\_utility;
      #include common_scripts\utility;
      #include maps\mp\gametypes_zm\_hud_util;
      #include maps\mp\gametypes_zm\_hud_message;
      
      init()
      {
          level thread onPlayerConnect(); //added this function back.
          thread high_round_tracker(); //fixed this thread that you decided to change.
      }
      
      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_basepath") + "/" + getDvar("fs_basegame") + "/";
      	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_basepath") + "/" + getDvar("fs_basegame") + "/";
      	path = level.basepath + "/logs/" + map + gamemode + "HighRound.txt";
      	file = fopen( path, "w" );
      	fputs( newRecord, file );
      	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 );
      }
      

      Paying attention to directions can really help you figure out the problem...

      Waluijayundefined 1 Reply Last reply
      1
      • Waluijayundefined Offline
        Waluijayundefined Offline
        Waluijay
        replied to Cahz on last edited by
        #11

        I'm- I'm not exactly sure how I messed up and repeatedly missed the onPlayerConnect at the start so thankyou, everything is working properly now. I appreciate the extra length you went for my small brain

        1 Reply Last reply
        0
        • MetalThunderundefined Offline
          MetalThunderundefined Offline
          MetalThunder
          replied to Cahz on last edited by MetalThunder
          #12
          This post is deleted!
          1 Reply Last reply
          0
          • andresito_20undefined Offline
            andresito_20undefined Offline
            andresito_20 Contributor
            replied to Cahz on last edited by
            #13

            Cahz

            Hello I get this error when installing the .dll file inside gameserver / t6r / data / plugins

            3a7f96d7-01f1-42d3-8837-d1b1b70e666a-image.png

            MetalThunderundefined 1 Reply Last reply
            0
            • MetalThunderundefined Offline
              MetalThunderundefined Offline
              MetalThunder
              replied to andresito_20 on last edited by
              #14

              andresito_20 maybe this can help you
              https://forum.plutonium.pw/topic/11302/zm-highest-round-tracker-error/10?_=1630612677354

              1 Reply Last reply
              0
              • Ch00chinat0rundefined Offline
                Ch00chinat0rundefined Offline
                Ch00chinat0r
                replied to Cahz on last edited by
                #15

                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

                1 Reply Last reply
                0
                • MrMrEundefined Offline
                  MrMrEundefined Offline
                  MrMrE
                  wrote on last edited by MrMrE
                  #16

                  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;
                  	}	
                  }
                  
                  
                  1 Reply Last reply
                  1
                  • jvegas01undefined Offline
                    jvegas01undefined Offline
                    jvegas01
                    wrote on last edited by
                    #17

                    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

                    1 Reply Last reply
                    0
                    • Kalitosundefined Offline
                      Kalitosundefined Offline
                      Kalitos
                      wrote on last edited by
                      #18

                      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 );
                      }
                      
                      jvegas01undefined Ch00chinat0rundefined akashioundefined 3 Replies Last reply
                      6
                      • jvegas01undefined Offline
                        jvegas01undefined Offline
                        jvegas01
                        replied to Kalitos on last edited by
                        #19

                        Kalitos thank you bro it works perfect ❤

                        1 Reply Last reply
                        1
                        • Ch00chinat0rundefined Offline
                          Ch00chinat0rundefined Offline
                          Ch00chinat0r
                          replied to Kalitos on last edited by
                          #20

                          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

                          Ch00chinat0rundefined 1 Reply Last reply
                          0
                          • Ch00chinat0rundefined Offline
                            Ch00chinat0rundefined Offline
                            Ch00chinat0r
                            replied to Ch00chinat0r on last edited by
                            #21

                            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!

                            1 Reply Last reply
                            1
                            • akashioundefined Offline
                              akashioundefined Offline
                              akashio
                              replied to Kalitos on last edited by
                              #22

                              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?

                              Kalitosundefined 1 Reply Last reply
                              0
                              • Kalitosundefined Offline
                                Kalitosundefined Offline
                                Kalitos
                                replied to akashio on last edited by
                                #23

                                akashio I don't know, maybe he forgot to load the plugin

                                1 Reply Last reply
                                0
                                • emiloxdundefined Offline
                                  emiloxdundefined Offline
                                  emiloxd
                                  wrote on last edited by
                                  #24

                                  Doesn't work for me.
                                  **** Unresolved external : "fputs" with 2 parameters in "round-tracker" at line 1 ****

                                  Aranellaundefined 1 Reply Last reply
                                  0
                                  • Aranellaundefined Offline
                                    Aranellaundefined Offline
                                    Aranella
                                    replied to emiloxd on last edited by
                                    #25

                                    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(?)

                                    1 Reply Last reply
                                    0
                                    • emiloxdundefined Offline
                                      emiloxdundefined Offline
                                      emiloxd
                                      wrote on last edited by
                                      #26

                                      I got some errors using that one aswell

                                      1 Reply Last reply
                                      0
                                      • Echostarsundefined Offline
                                        Echostarsundefined Offline
                                        Echostars
                                        wrote on last edited by
                                        #27

                                        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

                                        1 Reply Last reply
                                        1

                                        • 1
                                        • 2
                                        • Login

                                        • Don't have an account? Register

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • Recent
                                        • Tags
                                        • Popular
                                        • Users
                                        • Groups
                                        • Donate