Raised This Month: $ Target: $400
 0% 

[TF2] Unable to re-compile - can you help?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ph
AlliedModders Donor
Join Date: Mar 2006
Old 06-18-2020 , 15:27   [TF2] Unable to re-compile - can you help?
Reply With Quote #1

I am unable to re-compile and getting error messages.
Can you help to provide a re-compiled version.


Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <tf2_stocks>

// Global Definitions
#define PLUGIN_VERSION "1.0.71"

new bWaiting = false;
ConVar hConVar_GlobalTime;
ConVar hConVar_GlobalMaxTime;

// Functions
public Plugin:myinfo =
{
	name = "AddTime",
	author = "bl4nk (modified by belledesire, FlaminSarge, JoBarfCreepy)",
	description = "Add time to the clock via command",
	version = PLUGIN_VERSION,
	url = "http://forums.alliedmods.net"
};

public OnMapStart()
{
	bWaiting = false;
	FindArena(true);
}
public TF2_OnWaitingForPlayersStart()
{
	if (FindArena()) return;
	bWaiting = true;
}
public TF2_OnWaitingForPlayersEnd()
{
	OnMapEnd();
}
public OnPluginEnd()
{
	OnMapEnd();
}
public OnMapEnd()
{
	bWaiting = false;
}

public OnPluginStart()
{
	CreateConVar("sm_addtime_version", PLUGIN_VERSION, "AddTime Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
	hConVar_GlobalTime = CreateConVar("sm_addtime_globaltime", "0", "A global time setting to make rounds last this long", FCVAR_PLUGIN);
	hConVar_GlobalMaxTime = CreateConVar("sm_addtime_globalmaxtime", "0", "A global time setting to change max round time", FCVAR_PLUGIN);
	
	HookEvent("teamplay_setup_finished", Event_RoundStart);
	HookEvent("arena_round_start", Event_RoundStart);
	
	RegAdminCmd("sm_addtime", Command_AddTime, ADMFLAG_CHANGEMAP, "sm_addtime <amount>");
	RegAdminCmd("sm_settime", Command_SetTime, ADMFLAG_CHANGEMAP, "sm_settime <amount>");
	RegAdminCmd("sm_maxtime", Command_MaxTime, ADMFLAG_CHANGEMAP, "sm_maxtime <amount>");
}

public Action:Event_RoundStart(Handle:hEvent, const String:strName[], bool:bDontBroadcast)
{
	if(hConVar_GlobalTime.IntValue)
	{
		decl String:command[32];
		Format(command, sizeof(command), "sm_settime %i", hConVar_GlobalTime.IntValue);
		ServerCommand(command);
	}
	if(hConVar_GlobalTime.IntValue)
	{
		decl String:command[32];
		Format(command, sizeof(command), "sm_maxtime %i", hConVar_GlobalMaxTime.IntValue);
		ServerCommand(command);
	}
}

public Action:Command_AddTime(client, args)
{
	if (args < 1)
	{
		ReplyToCommand(client, "[%s] Usage: sm_addtime <amount>", "AddTime");
		return Plugin_Handled;
	}

	if (!bWaiting)
	{
		decl String:cmdArg[32];
		GetCmdArg(1, cmdArg, sizeof(cmdArg));

		new bool:bEntityFound = false;

		new entityTimer = MaxClients+1;
		while((entityTimer = FindEntityByClassname(entityTimer, "team_round_timer"))!=-1)
		{
			bEntityFound = true;
		
			decl String:mapName[32];
			GetCurrentMap(mapName, sizeof(mapName));
	
			if (strncmp(mapName, "pl_", 3) == 0)
			{
				decl String:buffer[32];
				Format(buffer, sizeof(buffer), "0 %i", StringToInt(cmdArg));

				SetVariantString(buffer);
				AcceptEntityInput(entityTimer, "AddTeamTime");
			}
			else
			{
				SetVariantInt(StringToInt(cmdArg));
				AcceptEntityInput(entityTimer, "AddTime");
			}
		}
	
		if (!bEntityFound)
		{
			new Handle:timelimit = FindConVar("mp_timelimit");
			SetConVarFloat(timelimit, GetConVarFloat(timelimit) + (StringToFloat(cmdArg) / 60));
			CloseHandle(timelimit);
		}
	
		PrintToChatAll("\x04[\x03%s\x04]\x01 Added %i second(s) to the time", "AddTime", StringToInt(cmdArg));
	}
	else
	{
		ReplyToCommand(client, "[%s] Cannot change time during wait-time", "AddTime");
	}

	return Plugin_Handled;
}

public Action:Command_SetTime(client, args)
{
	if (args < 1)
	{
		ReplyToCommand(client, "[%s] Usage: sm_settime <amount>", "AddTime");
		return Plugin_Handled;
	}

	if (!bWaiting)
	{
		decl String:cmdArg[32];
		GetCmdArg(1, cmdArg, sizeof(cmdArg));

		new bool:bEntityFound = false;
	
		new entityTimer = MaxClients+1;
		while((entityTimer = FindEntityByClassname(entityTimer, "team_round_timer"))!=-1)
		{
			bEntityFound = true;

			SetVariantInt(StringToInt(cmdArg));
			AcceptEntityInput(entityTimer, "SetTime");
		}

		if (!bEntityFound)
		{
			new Handle:timelimit = FindConVar("mp_timelimit");
			SetConVarFloat(timelimit, StringToFloat(cmdArg) / 60);
			CloseHandle(timelimit);
		}

		PrintToChatAll("\x04[\x03%s\x04]\x01 Time was set to %i second(s)", "AddTime", StringToInt(cmdArg));
	}
	else
	{
		ReplyToCommand(client, "[%s] Cannot change time during wait-time", "AddTime");
	}

	return Plugin_Handled;
}

public Action:Command_MaxTime(client, args)
{
	if (args < 1)
	{
		ReplyToCommand(client, "[%s] Usage: sm_maxtime <amount>", "AddTime");
		return Plugin_Handled;
	}

	decl String:cmdArg[32];
	GetCmdArg(1, cmdArg, sizeof(cmdArg));

	new bool:bEntityFound = false;

	new entityTimer = MaxClients + 1;
	while((entityTimer = FindEntityByClassname(entityTimer, "team_round_timer"))!=-1)
	{
		bEntityFound = true;
		decl String:mapName[32];
		GetCurrentMap(mapName, sizeof(mapName));

		if (strncmp(mapName, "pl_", 3) == 0)
		{
			decl String:buffer[32];
			Format(buffer, sizeof(buffer), "0 %i", StringToInt(cmdArg));

			SetVariantString(buffer);
			AcceptEntityInput(entityTimer, "SetMaxTime");
		}
		else
		{
			SetVariantInt(StringToInt(cmdArg));
			AcceptEntityInput(entityTimer, "SetMaxTime");
		}
	}
	if (!bEntityFound)
	{
		new Handle:timelimit = FindConVar("mp_timelimit");
		SetConVarFloat(timelimit, GetConVarFloat(timelimit) + (StringToFloat(cmdArg) / 60));
		CloseHandle(timelimit);
	}
	PrintToChatAll("\x04[\x03%s\x04]\x01 Max time was set to %i second(s)", "AddTime", StringToInt(cmdArg));
	return Plugin_Handled;
}
stock bool:FindArena(bool:forceRecalc = false)
{
	static bool:arena = false;
	static bool:found = false;
	if (forceRecalc)
	{
		found = false;
		arena = false;
	}
	if (!found)
	{
		new i = -1;
		while ((i = FindEntityByClassname2(i, "tf_logic_arena")) != -1)
		{
			arena = true;
		}
		found = true;
	}
	return arena;
}
stock FindEntityByClassname2(startEnt, const String:classname[])
{
	/* If startEnt isn't valid shifting it back to the nearest valid one */
	while (startEnt > -1 && !IsValidEntity(startEnt)) startEnt--;
	return FindEntityByClassname(startEnt, classname);
}
Attached Files
File Type: sp Get Plugin or Get Source (addtime.sp - 136 views - 6.0 KB)
__________________
ph is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 06-18-2020 , 16:37   Re: [TF2] Unable to re-compile - can you help?
Reply With Quote #2

It compiles fine on the forum (the "Get Plugin" link works) and on Spider.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline
ph
AlliedModders Donor
Join Date: Mar 2006
Old 06-18-2020 , 17:46   Re: [TF2] Unable to re-compile - can you help?
Reply With Quote #3

I get the following errors.

__________________
ph is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 06-18-2020 , 21:36   Re: [TF2] Unable to re-compile - can you help?
Reply With Quote #4

Quote:
Originally Posted by ph View Post
I get the following errors.
The lines you've listed aren't errors; they're warnings. Unless you have the -E flag set on your compiler to treat warnings as errors, in which case it would say "error 234" instead of "warning 234".

There are two errors in the compile log, no doubt. You'll want to scroll up and post them.

That said, the plugin you've posted both in the code block and as an attachment compile without errors on both 1.9 and 1.10, so I'm not sure where you're getting the errors claimed.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)

Last edited by nosoop; 06-18-2020 at 21:38.
nosoop is offline
Reply



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 03:08.


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