Raised This Month: $51 Target: $400
 12% 

Let server run this cheat command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hagvan
Junior Member
Join Date: Apr 2018
Old 07-05-2019 , 15:59   Let server run this cheat command
Reply With Quote #1

Hello, I want to run the command "mp_forcewin" using ServerCommand() but the console says I need cheats enabled. Can someone help me bypass this in one way or the other so it is not visible to the players?
Hagvan is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 07-05-2019 , 23:05   Re: Let server run this cheat command
Reply With Quote #2

Found code from Leonardo... made it into a plugin for you....

Usage: sm_forcewin <teamnum> 0 - Draw, 2 - Red, 3 - Blue

Code:
#pragma semicolon 1

#define PLUGIN_VERSION "1.0"

public Plugin:myinfo = 
{
	name = "Force Round Win",
	author = "Code by Leonardo, modified by PC Gamer",
	description = "Force Round Win",
	version = PLUGIN_VERSION,
	url = "www.sourcemod.com"
}

public OnPluginStart()
{
	RegAdminCmd("sm_forcewin", Command_ForceWin, ADMFLAG_SLAY, "Pick a Winning Team");
}

public Action:Command_ForceWin(iClient, iArgs)
{
	if(iArgs != 1)
	{
		ReplyToCommand(iClient, "Usage: sm_forcewin <teamnum>\n0 - Draw, 2 - Red, 3 - Blue");
		return Plugin_Handled;    
	}
	
	new String:sBuffer[4];
	GetCmdArg(1, sBuffer, sizeof(sBuffer));
	new iTeam = StringToInt(sBuffer); 
	if(iTeam != 0 && iTeam != 2 && iTeam != 3)
	{
		ReplyToCommand(iClient, "Usage: sm_forcewin <teamnum>\n0 - Draw, 2 - Red, 3 - Blue");
		return Plugin_Handled;
	}
	
	new iFlags = GetCommandFlags("mp_forcewin");
	SetCommandFlags( "mp_forcewin", iFlags &= ~FCVAR_CHEAT ); 
	ServerCommand( "mp_forcewin %i", iTeam );
	SetCommandFlags( "mp_forcewin", iFlags );
	
	if(iClient>0 && iClient<=MaxClients)
	LogMessage("%L forced team #%i win", iClient, iTeam);
	else
	LogMessage("CONSOLE forced team #%i win", iTeam);
	
	return Plugin_Handled;
}
Attached Files
File Type: sp Get Plugin or Get Source (forcewin.sp - 123 views - 1.2 KB)
PC Gamer is offline
Hagvan
Junior Member
Join Date: Apr 2018
Old 07-06-2019 , 05:20   Re: Let server run this cheat command
Reply With Quote #3

Many thanks!
Hagvan 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 14:43.


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