Raised This Month: $ Target: $400
 0% 

[TF2] RoundEnd plugin [HELP]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ExtraSpeeed
Member
Join Date: Mar 2015
Location: Russia, Moscow
Old 11-02-2015 , 15:16   [TF2] RoundEnd plugin [HELP]
Reply With Quote #1

I have got a code of the round end plugin. So, when round ends, map is save, don't reset to default settings. I want, that map will reset in a new round.

Code:
#include <sourcemod>
#include <sdktools>

new const String:PLUGIN_VERSION[] = "1.0.1";

public Plugin:myinfo = 
{
	name = "[TF2] Force End Round",
	author = "DarthNinja",
	description = ".",
	version = PLUGIN_VERSION,
	url = "http://www.sourcemod.net"
}

public OnPluginStart()
{
	CreateConVar("sm_force_end_round_version", PLUGIN_VERSION, "k", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
	RegAdminCmd("sm_fer", ForceGameEnd, ADMFLAG_BAN, "sm_fer [team]");
	RegAdminCmd("sm_forceendround", ForceGameEnd, ADMFLAG_BAN, "sm_forceendround [team]");
	LoadTranslations("common.phrases");
}

public Action:ForceGameEnd(client, args)
{
	if (args != 0 && args != 1)
	{
		ReplyToCommand(client, "sm_fer / sm_forceendround [Winning Team: Red/Blue/None]");
		return Plugin_Handled;
	}
	
	new iEnt = -1;
	iEnt = FindEntityByClassname(iEnt, "game_round_win");
	
	if (iEnt < 1)
	{
		iEnt = CreateEntityByName("game_round_win");
		if (IsValidEntity(iEnt))
			DispatchSpawn(iEnt);
		else
		{
			ReplyToCommand(client, "Unable to find or create a game_round_win entity!");
			return Plugin_Handled;
		}
	}
	
	new iWinningTeam = 0;
	if (client) 
		iWinningTeam = GetClientTeam(client);
	
	if (args == 1)
	{
		decl String:buffer[32];
		GetCmdArg(1, buffer, sizeof(buffer));
	
		if (StrEqual(buffer, "blue", false))
			iWinningTeam = 3;
		else if (StrEqual(buffer, "red", false))
			iWinningTeam = 2;
		else if (StrEqual(buffer, "none", false))
			iWinningTeam = 0;
	}
	
	if (iWinningTeam == 1)
		iWinningTeam --;
		
	SetVariantInt(iWinningTeam);
	AcceptEntityInput(iEnt, "SetTeam");
	DispatchKeyValue(iEnt, "force_map_reset", true);
	AcceptEntityInput(iEnt, "RoundWin");
	
	return Plugin_Handled;
}
__________________
ExtraSpeeed is offline
Send a message via Skype™ to ExtraSpeeed
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 13:26.


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