View Single Post
NatsUpX
Junior Member
Join Date: Jun 2022
Old 06-26-2022 , 08:58   Re: CS GO Removing Red Circle when being hit
Reply With Quote #8

Quote:
Originally Posted by Cruze View Post
Try this:
PHP Code:
#include <sourcemod>
#include <sdkhooks>

#pragma newdecls required
#pragma semicolon 1

#define PLUGIN_VERSION    "1.2"
#define PLUGIN_NAME        "NoDamage"

bool g_bLateLoadg_bEnabled;
ConVar g_hEnabled;

public 
Plugin myinfo 
{
    
name PLUGIN_NAME,
    
author "Thomas Ross, fixes by Grey83 & Cruze",
    
description "Stops damage from being taken",
    
version PLUGIN_VERSION,
    
url ""
}

public 
APLRes AskPluginLoad2(Handle myselfbool latechar[] errorint err_max)
{
    
g_bLateLoad late;
    return 
APLRes_Success;
}

public 
void OnPluginStart()
{
    
CreateConVar("sm_nodamage_version"PLUGIN_VERSIONPLUGIN_NAMEFCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
    
g_hEnabled CreateConVar("sm_nodamage_enabled""1""1 = Plugin enabled, 0 = Disabled"FCVAR_SPONLYtrue0.0true1.0);

    
HookConVarChange(g_hEnabledOnSettingsChange);
    
g_bEnabled g_hEnabled.BoolValue;
    
    
HookEvent("player_hurt"Event_PlayerHurtEventHookMode_Pre);

    if(
g_bLateLoad && g_bEnabled)
    {    
        
LateLoadConnect();
        
g_bLateLoad false;
    }
}

public 
int OnSettingsChange(ConVar cvar, const char[] oldVal, const char[] newVal)
{
    if(
StrEqual(oldValnewVal))
    {
        return;
    }
    
    
g_bEnabled = !!StringToInt(newVal);

    if (
g_bEnabled)
    {
        
LateLoadConnect();
    }
    else
    {
        
LateLoadDisconnect();
    }
}

public 
void OnClientPostAdminCheck(int client)
{
    if(
IsFakeClient(client))
    {
        return;
    }
    
SDKHook(clientSDKHook_OnTakeDamageEvent_OnTakeDamage);
}

 public 
void OnClientDisconnect(int client)
{
    if(
IsFakeClient(client))
    {
        return;
    }
    
SDKUnhook(clientSDKHook_OnTakeDamageEvent_OnTakeDamage);
}

public 
Action Event_PlayerHurt(Event ev, const char[] namebool dbc)
{
    if (
g_bEnabled)
    {
        return 
Plugin_Handled;
    }
    return 
Plugin_Continue;
}

public 
Action Event_OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetype

    return 
Plugin_Handled;
}

void LateLoadConnect()
{
    for(
int clientclient <= MaxClientsclient++) if(IsClientInGame(client))
    {
        
OnClientPostAdminCheck(client);
    }
}

void LateLoadDisconnect()
{
    for(
int clientclient <= MaxClientsclient++) if(IsClientInGame(client))
    {
        
OnClientDisconnect(client);
    }

Unfortunately this didnt work

i made a clip for you so you can see what i am talking about.
Normally when i score an owngoal i get killed so the round can reset. With the plugin loaded nothing happens as im resitent to all damage. When im unloading the plugin then im getting killed right after like an post effect.

https://medal.tv/games/csgo/clips/pW...IsNzE1MjI4MzMs

Maybe that helps but when i try to load the mod after its unloaded i get this error :

] sm_rcon sm plugins load nodamage2
L 06/26/2022 - 12:57:54: [SM] Exception reported: Client index 0 is invalid
L 06/26/2022 - 12:57:54: [SM] Blaming: nodamage2.smx
L 06/26/2022 - 12:57:54: [SM] Call stack trace:
L 06/26/2022 - 12:57:54: [SM] [0] IsClientInGame
L 06/26/2022 - 12:57:54: [SM] [1] Line 98, /home/forums/content/files/2/7/9/4/9/8/195402.attach::LateLoadConnect
L 06/26/2022 - 12:57:54: [SM] [2] Line 40, /home/forums/content/files/2/7/9/4/9/8/195402.attach::OnPluginStart
L 06/26/2022 - 12:57:54: [SM] [4] ServerCommandEx
L 06/26/2022 - 12:57:54: [SM] [5] Line 402, /data/sourcemod/plugins/basecommands.sp::Command_Rcon
[SM] Plugin nodamage2.smx failed to load: Error detected in plugin startup (see error logs).
NatsUpX is offline