Go Back   Steam Users' Forums > Steam Game Discussions > D - G > Day of Defeat: Source

Reply
 
Thread Tools Display Modes
Old 01-29-2012, 09:50 PM   #1
HufandPuf
 
Join Date: Jul 2008
Reputation: 8
Posts: 61
Command Help

Does anyone know the command to alter one player's health?

I am looking to give a player more health than all of the other players. Thank you.
HufandPuf is offline  
Reply With Quote
Old 01-30-2012, 04:53 PM   #2
Ustwes R. Dewo
 
Join Date: Mar 2010
Reputation: 66
Posts: 566
Quote:
Originally Posted by HufandPuf View Post
Does anyone know the command to alter one player's health?

I am looking to give a player more health than all of the other players. Thank you.
You would need a mod to affect that change, unless you plan on running with sv_cheats. If you do, I believe they would have to do it themselves, if a command such as that exists.

I don't recommend running a server with sv_cheats.
Ustwes R. Dewo is offline   Reply With Quote
Old 01-31-2012, 08:37 AM   #3
kalleiskogen2
 
Join Date: Jan 2012
Reputation: 0
Posts: 19
There are hundred's of mods to fix that.
kalleiskogen2 is offline   Reply With Quote
Old 01-31-2012, 11:17 PM   #4
StrontiumDog
 
 
 
Join Date: Feb 2006
Reputation: 98
Posts: 174
This is very quick but it should work.

1. Install Sourcemod (if you haven't already)

2. Create a text file called sm_health.sp and paste this Sourcemod script into it:

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

#define VERSION    "1.0.000"

public Plugin:myinfo = 
{
	name = "Set Health",
	author = "Dog",
	description = "Set Health",
	version = VERSION,
	url = "http://www.thevilluns.org"
};

public OnPluginStart()
{
	RegAdminCmd("sm_health", Command_Heal, ADMFLAG_CONVARS, " - heals a player");
}

public Action:Command_Heal(iClient, args)
{
	new iHealth;
	new String:szArg1[32], String:szArg2[64];
	
	//Make sure there are two arguments
	if (args == 2)
	{
		GetCmdArg(1, szArg1, sizeof(szArg1));
		GetCmdArg(2, szArg2, sizeof(szArg2));
		iHealth = StringToInt(szArg2);
	}
	else
	{
		ReplyToCommand(iClient, "[SM] Usage: sm_health <#userid|name> <amount>");
		return Plugin_Handled;
	}
	
	//Find the player(s)
	new iTarget = FindTarget(iClient, szArg1);
	if (iTarget == -1)
	{
		return Plugin_Handled;
	}

	//Stores players names
	new String:szName[MAX_NAME_LENGTH];
	//Array to hold targets
	decl iListPlayers[MAXPLAYERS];
	new iNumberPlayers, bool:tn_is_ml;
	
	GetClientName(iTarget, szName, sizeof(szName));
	
	if ((iNumberPlayers = ProcessTargetString(
			szArg1,
			iClient,
			iListPlayers,
			MAXPLAYERS,
			COMMAND_FILTER_ALIVE,
			szName,
			sizeof(szName),
			tn_is_ml)) <= 0)
	{
		ReplyToTargetError(iClient, iNumberPlayers);
		return Plugin_Handled;
	}
	
	for (new i = 0; i < iNumberPlayers; i++)
	{
			SetEntityHealth(iListPlayers[i], iHealth);
			LogAction(iClient, iListPlayers[i], "\"%N\" changed the health of \"%N\" to %i" , iClient, iListPlayers[i], iHealth);
	}

	return Plugin_Handled;
}
3. Save it in the scripts directory of Sourcemod and compile it.

4. Go into the 'compiled' directory and move the sm_health.smx into the plugins directory.

5. Change map and the plugin will load.

To use it, type sm_health <name> <amount>
Only usable by admins.

You should be able to change the health of whole teams with this, as well.

Hope this helps

--Dog

Last edited by StrontiumDog: 01-31-2012 at 11:19 PM.
StrontiumDog is offline   Reply With Quote
Old 02-03-2012, 12:21 AM   #5
HufandPuf
 
Join Date: Jul 2008
Reputation: 8
Posts: 61
I will give that a try. Thank you.
HufandPuf is offline   Reply With Quote
Reply

Go Back   Steam Users' Forums > Steam Game Discussions > D - G > Day of Defeat: Source


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 Off
HTML code is Off



All times are GMT -7. The time now is 07:43 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site Content Copyright Valve Corporation 1998-2014, All Rights Reserved.