Raised This Month: $60 Target: $400

How to carry over values from a previous round/game in TFC

Post New Thread Reply   
Thread Tools Display Modes
Author Message
Junior Member
Join Date: Nov 2014
Old 10-12-2020 , 19:48   How to carry over values from a previous round/game in TFC
Reply With Quote #1

#include <amxmodx>

#pragma semicolon 1
#pragma ctrlchar '\'

new g_TeamScore[2];
new currentScore;
public show_timer()
	new prevScore;
	new nextmap[32];
	get_cvar_string("amx_nextmap", nextmap, 31);
	new timeleft = get_timeleft();
	if(timeleft == 0)
		prevScore = currentScore;
		currentScore = 0;
	set_hudmessage(255, 255, 255, 0.00, 0.00, 0, 1.00, 1000.00, 0.10, 0.20, 13);
	show_hudmessage(0, "WELCOME TO THE OUTHOUSE\nTimeleft: %d:%02d\nCurrent Score: %d\nPrevious Score: %d", timeleft / 60, timeleft % 60, currentScore, prevScore);
	return 0;

public get_teamscore()
new team[32];

	currentScore = read_data(2);

public logevent_round_end()
  client_print(0, print_chat, "end of game");

public plugin_init()
	register_logevent("logevent_round_end", 2, "1=Round_End");
	//register_logevent("capcounter", 3, "1=triggered", "2&dropoff");
	register_plugin("TimeProjector", "0.1", "ST4life");
	set_task(1.00, "show_timer", 0, "", 0, "b", 0);
	return 0;
would like to get the score from a previous game to carry over to another.. hopefully without writing and reading from files.. Tried that earlier and I was getting an invalid expression
12Toastie is offline
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-13-2020 , 00:57   Re: How to carry over values from a previous round/game in TFC
Reply With Quote #2

Depending on how much data you're needing to keep, you could try to use "localinfo". I use it to old over a short string (3 characters) in Polymorph. Local info will remain in memory while the server is running. When the server process is actually stopped is when it will disappear. See: set_localinfo(), get_localinfo()

I'm not sure what the limit actually is but you'll want to try and condense the data as much as possible and it must be a string.

(this assumes that whatever you mean by "round/game" means when the map changes)

Last edited by fysiks; 10-13-2020 at 00:59.
fysiks is online now

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -4. The time now is 22:48.

Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode