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

Solved [CS:GO] No killing during warmup


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
whtevrwt
AlliedModders Donor
Join Date: Apr 2015
Old 10-07-2017 , 15:02   [CS:GO] No killing during warmup
Reply With Quote #1

I was wondering if someone could link me or make a specific plugin:
  • During warmup, no one is able to kill each other.

Thanks if anyone is able to help me with this.


Thanks to shanapu for the plugin. I've attached the compiled plugin below for anyone that wishes to use it in the future.
Attached Files
File Type: sp Get Plugin or Get Source (NoWarmupKills.sp - 242 views - 1.1 KB)
__________________

Last edited by whtevrwt; 10-07-2017 at 19:27.
whtevrwt is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 10-07-2017 , 15:16   Re: [CS:GO] No killing during warmup
Reply With Quote #2

Should do the work (not tested):

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

public void OnClientPutInServer(int client)
{
    
SDKHook(clientSDKHook_TraceAttackOnTraceAttack);
}

public 
Action OnTraceAttack(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &ammotypeint hitboxint hitgroup)
{
    if (
GameRules_GetProp("m_bWarmupPeriod") != 1)
    {
        return 
Plugin_Continue;
    }

    if (!
IsValidClient(victim) || attacker == victim || !IsValidClient(attacker))
    {
        return 
Plugin_Continue;
    }

    return 
Plugin_Handled;
}

bool IsValidClient(int client)
{
    if (!(
<= client <= MaxClients) || !IsClientInGame(client) || IsClientSourceTV(client) || IsClientReplay(client))
    {
        return 
false;
    }
    return 
true;

__________________
coding & free software
shanapu is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-07-2017 , 15:47   Re: [CS:GO] No killing during warmup
Reply With Quote #3

...use OnTakeDamage to prevent damage happen.
hmm, seems SDKHook_TraceAttack works too :O

Last edited by Bacardi; 10-07-2017 at 15:51.
Bacardi is offline
whtevrwt
AlliedModders Donor
Join Date: Apr 2015
Old 10-07-2017 , 16:07   Re: [CS:GO] No killing during warmup
Reply With Quote #4

Quote:
Originally Posted by shanapu View Post
Should do the work (not tested):

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

public void OnClientPutInServer(int client)
{
    
SDKHook(clientSDKHook_TraceAttackOnTraceAttack);
}

public 
Action OnTraceAttack(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &ammotypeint hitboxint hitgroup)
{
    if (
GameRules_GetProp("m_bWarmupPeriod") != 1)
    {
        return 
Plugin_Continue;
    }

    if (!
IsValidClient(victim) || attacker == victim || !IsValidClient(attacker))
    {
        return 
Plugin_Continue;
    }

    return 
Plugin_Handled;
}

bool IsValidClient(int client)
{
    if (!(
<= client <= MaxClients) || !IsClientInGame(client) || IsClientSourceTV(client) || IsClientReplay(client))
    {
        return 
false;
    }
    return 
true;

Yep this works. Thanks as always
__________________
whtevrwt is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 10-07-2017 , 16:34   Re: [CS:GO] No killing during warmup
Reply With Quote #5

Quote:
Originally Posted by Bacardi View Post
...use OnTakeDamage to prevent damage happen.
hmm, seems SDKHook_TraceAttack works too :O
TraceAttack has the advantage to suppress the blood splashes.

Quote:
Originally Posted by KissLick View Post
... [about TraceAttack]
But that will ignore molotovs (and maybe decoys). So ideally you should use both, SDKHook_TraceAttack and SDKHook_OnTakeDamage.
So may this would be better:
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

public void OnClientPutInServer(int client)
{
    
SDKHook(clientSDKHook_TraceAttackOnTraceAttackOnTakeDamage);
    
SDKHook(clientSDKHook_OnTakeDamageOnTraceAttackOnTakeDamage);
}

public 
Action OnTraceAttackOnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &ammotypeint hitboxint hitgroup)
{
    if (
GameRules_GetProp("m_bWarmupPeriod") != 1)
    {
        return 
Plugin_Continue;
    }

    if (!
IsValidClient(victim) || attacker == victim || !IsValidClient(attacker))
    {
        return 
Plugin_Continue;
    }

    return 
Plugin_Handled;
}

bool IsValidClient(int client)
{
    if (!(
<= client <= MaxClients) || !IsClientInGame(client) || IsClientSourceTV(client) || IsClientReplay(client))
    {
        return 
false;
    }
    return 
true;

__________________
coding & free software

Last edited by shanapu; 10-07-2017 at 16:36.
shanapu is offline
CamerDisco
AlliedModders Donor
Join Date: Aug 2015
Location: Poland
Old 10-08-2017 , 14:37   Re: [CS:GO] No killing during warmup
Reply With Quote #6

As I remember I had problem with SDKHook_TraceAttack because it doesn't operate damage from molotov, so well that you add OnTakeDamage too.
__________________


Max-Play.pl - the best polish servers
CamerDisco 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 18:47.


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