Raised This Month: $32 Target: $400
 8% 

Start health ct


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 12-18-2018 , 17:43   Start health ct
Reply With Quote #1

Hello i test many way to fix health for seeker to 1000 because health change in some custom maps. I want to fix it to 1000 for ct team.

If someone have a plugin for this, and if you can add a timer of 2 seconds to fix it in my serv if you can.

Thank you for your help in advance !
__________________
IDEAS-GAMING.COM SERVERS ON CSGO :

- HIDE AND SEEK - SUPERHEROES
- BUNNY HOP
- KZ / CLIMB

---------------------------------------------------------------------
My steam link
Donate !

Last edited by vegeta1241; 12-19-2018 at 17:30.
vegeta1241 is offline
Brum Brum
Junior Member
Join Date: Mar 2017
Old 12-19-2018 , 02:24   Re: Start health ct
Reply With Quote #2

Code:
#pragma semicolon 1
#pragma newdecls required

ConVar CTHealth, enable;

public void OnPluginStart()
{
	CTHealth = CreateConVar("sm_cthp_on_spawn", "1000", "Change CT health");
	enable = CreateConVar("sm_enable_change_hp", "1", "enable/disable plugin");
	HookEvent("player_spawn", Event_PlayerSpawn);
}

public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcost)
{
	int client = GetClientOfUserId(event.GetInt("userid"));
	if (enable.BoolValue)
	{
		if (IsClientInGame(client) && IsPlayerAlive(client) && !IsFakeClient(client) && !IsClientSourceTV(client))
		{
			CreateTimer(2.0, ChangeHP, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
		}
	}
}

public Action ChangeHP(Handle timer, int userid)
{
	int client = GetClientOfUserId(userid);
	int hp = CTHealth.IntValue;
	SetEntityHealth(client, hp);
}
I think it should work
Brum Brum is offline
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 12-19-2018 , 04:44   Re: Start health ct
Reply With Quote #3

Thank you, I will test it soon !
__________________
IDEAS-GAMING.COM SERVERS ON CSGO :

- HIDE AND SEEK - SUPERHEROES
- BUNNY HOP
- KZ / CLIMB

---------------------------------------------------------------------
My steam link
Donate !
vegeta1241 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 12-19-2018 , 07:32   Re: Start health ct
Reply With Quote #4

I don't see "GetClientTeam" check in code...
Bacardi is offline
CliptonHeist
Senior Member
Join Date: Feb 2016
Old 12-19-2018 , 09:26   Re: Start health ct
Reply With Quote #5

Quote:
Originally Posted by Bacardi View Post
I don't see "GetClientTeam" check in code...
Also cfg file isn't being created so those convars are basically useless and there's no client validity check in the timer...

This should work however I haven't tested it:
PHP Code:
#include <sourcemod>
#include <cstrike>

#pragma semicolon 1
#pragma newdecls required

#define PLUGIN_VERSION "1.0"

//Plugin Information:
public Plugin myinfo 
{
    
name "Set HP"
    
author "The Doggy"
    
description "Sets CT HP."
    
version PLUGIN_VERSION,
    
url "coldcommunity.com"
};

ConVar CTHealthenable;

public 
void OnPluginStart()
{
    
CTHealth CreateConVar("sm_cthp_on_spawn""1000""Change CT health");
    
enable CreateConVar("sm_enable_change_hp""1""enable/disable plugin");
    
AutoExecConfig(true"sm_cthp");
    
HookEvent("player_spawn"Event_PlayerSpawn);
}

public 
Action Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int client event.GetInt("userid");
    if (
enable.BoolValue)
    {
        if (
IsValidClient(client) && GetClientTeam(client) == CS_TEAM_CT)
            
CreateTimer(2.0ChangeHPclientTIMER_FLAG_NO_MAPCHANGE);
    }
}

public 
Action ChangeHP(Handle timerint client)
{
    if(
IsValidClient(client))
    {
        
int hp CTHealth.IntValue;
        
SetEntityHealth(clienthp);
    }
    return 
Plugin_Stop;
}

stock bool IsValidClient(int client)
{
    return 
client >= && 
    
client <= MaxClients && 
    
IsClientConnected(client) && 
    
IsClientAuthorized(client) && 
    
IsClientInGame(client);

CliptonHeist is offline
Brum Brum
Junior Member
Join Date: Mar 2017
Old 12-19-2018 , 09:49   Re: Start health ct
Reply With Quote #6

Quote:
Originally Posted by Bacardi View Post
I don't see "GetClientTeam" check in code...
Ooh i forgot about that, sorry
Brum Brum is offline
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 12-19-2018 , 14:13   Re: Start health ct
Reply With Quote #7

Quote:
Originally Posted by CliptonHeist View Post
Also cfg file isn't being created so those convars are basically useless and there's no client validity check in the timer...

This should work however I haven't tested it:
PHP Code:
#include <sourcemod>
#include <cstrike>

#pragma semicolon 1
#pragma newdecls required

#define PLUGIN_VERSION "1.0"

//Plugin Information:
public Plugin myinfo 
{
    
name "Set HP"
    
author "The Doggy"
    
description "Sets CT HP."
    
version PLUGIN_VERSION,
    
url "coldcommunity.com"
};

ConVar CTHealthenable;

public 
void OnPluginStart()
{
    
CTHealth CreateConVar("sm_cthp_on_spawn""1000""Change CT health");
    
enable CreateConVar("sm_enable_change_hp""1""enable/disable plugin");
    
AutoExecConfig(true"sm_cthp");
    
HookEvent("player_spawn"Event_PlayerSpawn);
}

public 
Action Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int client event.GetInt("userid");
    if (
enable.BoolValue)
    {
        if (
IsValidClient(client) && GetClientTeam(client) == CS_TEAM_CT)
            
CreateTimer(2.0ChangeHPclientTIMER_FLAG_NO_MAPCHANGE);
    }
}

public 
Action ChangeHP(Handle timerint client)
{
    if(
IsValidClient(client))
    {
        
int hp CTHealth.IntValue;
        
SetEntityHealth(clienthp);
    }
    return 
Plugin_Stop;
}

stock bool IsValidClient(int client)
{
    return 
client >= && 
    
client <= MaxClients && 
    
IsClientConnected(client) && 
    
IsClientAuthorized(client) && 
    
IsClientInGame(client);

doesn't work

édit : i test with timer 2 5 and 10 no effect. Health doesnt change in round start and no change when player spawn
__________________
IDEAS-GAMING.COM SERVERS ON CSGO :

- HIDE AND SEEK - SUPERHEROES
- BUNNY HOP
- KZ / CLIMB

---------------------------------------------------------------------
My steam link
Donate !

Last edited by vegeta1241; 12-19-2018 at 15:02.
vegeta1241 is offline
Brum Brum
Junior Member
Join Date: Mar 2017
Old 12-19-2018 , 15:22   Re: Start health ct
Reply With Quote #8

Code:
#pragma semicolon 1
#pragma newdecls required

#define CS_TEAM_CT 3

ConVar CTHealth, enable;

public Plugin myinfo = 
{
	name = "Change HP", 
	description = "Change HP", 
	author = "Brum Brum", 
	version = "1.0", 
	url = "http://www.StudioADEPT.net/forum", 
};

public void OnPluginStart()
{
	CTHealth = CreateConVar("sm_cthp_on_spawn", "1000", "Change CT health");
	enable = CreateConVar("sm_enable_change_hp", "1", "enable/disable plugin");
	AutoExecConfig(true, "ChangeHP");
	HookEvent("player_spawn", Event_PlayerSpawn);
}

public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
	int client = GetClientOfUserId(event.GetInt("userid"));
	if (enable.BoolValue)
	{
		if (IsValidClient(client) && IsPlayerAlive(client) && GetClientTeam(client) == CS_TEAM_CT)
		{
			CreateTimer(2.0, ChangeHP, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
		}
	}
}

public Action ChangeHP(Handle timer, int userid)
{
	int client = GetClientOfUserId(userid);
	if (IsValidClient(client))
	{
		int hp = CTHealth.IntValue;
		SetEntityHealth(client, hp);
	}
}

public bool IsValidClient(int client)
{
	if (!(1 <= client <= MaxClients) || !IsClientInGame(client) || !IsClientConnected(client) || IsFakeClient(client) || IsClientSourceTV(client))
		return false;
	
	return true;
}
Try this

Last edited by Brum Brum; 12-19-2018 at 15:25. Reason: missclick
Brum Brum is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 12-19-2018 , 16:32   Re: Start health ct
Reply With Quote #9

Quote:
Originally Posted by CliptonHeist View Post
Also cfg file isn't being created so those convars are basically useless and there's no client validity check in the timer...

This should work however I haven't tested it:
PHP Code:
#include <sourcemod>
#include <cstrike>

#pragma semicolon 1
#pragma newdecls required

#define PLUGIN_VERSION "1.0"

//Plugin Information:
public Plugin myinfo 
{
    
name "Set HP"
    
author "The Doggy"
    
description "Sets CT HP."
    
version PLUGIN_VERSION,
    
url "coldcommunity.com"
};

ConVar CTHealthenable;

public 
void OnPluginStart()
{
    
CTHealth CreateConVar("sm_cthp_on_spawn""1000""Change CT health");
    
enable CreateConVar("sm_enable_change_hp""1""enable/disable plugin");
    
AutoExecConfig(true"sm_cthp");
    
HookEvent("player_spawn"Event_PlayerSpawn);
}

public 
Action Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int client event.GetInt("userid");
    if (
enable.BoolValue)
    {
        if (
IsValidClient(client) && GetClientTeam(client) == CS_TEAM_CT)
            
CreateTimer(2.0ChangeHPclientTIMER_FLAG_NO_MAPCHANGE);
    }
}

public 
Action ChangeHP(Handle timerint client)
{
    if(
IsValidClient(client))
    {
        
int hp CTHealth.IntValue;
        
SetEntityHealth(clienthp);
    }
    return 
Plugin_Stop;
}

stock bool IsValidClient(int client)
{
    return 
client >= && 
    
client <= MaxClients && 
    
IsClientConnected(client) && 
    
IsClientAuthorized(client) && 
    
IsClientInGame(client);

I never use AutoExecConfig functionality. I use server.cfg and server.cfg only. if alliedmods wanted, they could just make one large file, more efficient in term of issues in linux, since lots of cfg files can crash some linux servers in L4D2. That's why I always push my ConVars into server.cfg
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 12-19-2018 , 17:29   Re: Start health ct
Reply With Quote #10

WORK men thank you !!
__________________
IDEAS-GAMING.COM SERVERS ON CSGO :

- HIDE AND SEEK - SUPERHEROES
- BUNNY HOP
- KZ / CLIMB

---------------------------------------------------------------------
My steam link
Donate !
vegeta1241 is offline
Reply


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 11:18.


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