Raised This Month: $318 Target: $400
 79%   Almost there!

Domination and revenge in HL2 Deathmatch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
VSG
Member
Join Date: May 2019
Location: Spain
Old 03-04-2020 , 16:01   Domination and revenge in HL2 Deathmatch
Reply With Quote #1

Hi, I tried using the plugin search tool but couldn't find it.

I am looking for a plugin that prints to chat info abour dominations and revenges on hl2dm...just in chat, no sounds (don't like quakesounds). This is probably going to be difficult, as I was suspecting this features are not supported on this game (same as headshots?).

Cheers.
VSG is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 03-05-2020 , 03:57   Re: Domination and revenge in HL2 Deathmatch
Reply With Quote #2

If this game triggers "player_death" event then I can do that. I need to know after how many kills we can consider that X dominated Y. I will code the plugin today and release it on github.
__________________
Ilusion9 is offline
VSG
Member
Join Date: May 2019
Location: Spain
Old 03-05-2020 , 08:31   Re: Domination and revenge in HL2 Deathmatch
Reply With Quote #3

Hi Illusion9.

Much appreciated. Sounds great! On Counter-Strike Source and Day Of Defeat Source, killing an enemy 4 times is considered a Domination, so that could as well be copied from them...

This could pair very neatly with the "killing sprees" plugin other nice coder made on a reddit request (if it can be of any help) https://www.reddit.com/r/truetf2/com...rcemod_plugin/ (first reply, mukunda). Has been working perfecty so far on the 3 oldest source games, as I tested it.

Thank you.

Last edited by VSG; 03-05-2020 at 08:33.
VSG is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 03-05-2020 , 14:07   Re: Domination and revenge in HL2 Deathmatch
Reply With Quote #4

PHP Code:

#include <sourcemod>
#include <sdktools>
#pragma newdecls required

int g_ConsecutiveKills[MAXPLAYERS 1][MAXPLAYERS 1];

public 
void OnPluginStart()
{
    
HookEvent("player_death"Event_PlayerDeath);
}

public 
void OnClientConnected(int client)
{
    for (
int i 1MAXPLAYERS 1i++)
    {
        
g_ConsecutiveKills[client][i] = 0;
        
g_ConsecutiveKills[i][client] = 0;
    }
}

public 
void Event_PlayerDeath(Event event, const char[] namebool dontBroadcast)
{
    if (
IsWarmupPeriod())
    {
        return;
    }
    
    
int victim GetClientOfUserId(event.GetInt("userid"));    
    if (!
victim)
    {
        return;
    }
    
    
int attacker GetClientOfUserId(event.GetInt("attacker"));
    if (!
attacker || attacker == victim)
    {
        return;
    }

    
bool revenge g_ConsecutiveKills[victim][attacker] > 3;
    
g_ConsecutiveKills[attacker][victim]++
    
g_ConsecutiveKills[victim][attacker] = 0;
    
    if (
revenge)
    {
        
PrintToChat(attacker"You revenged on %N!"victim);
        
PrintToChat(victim"%N has revenged on you!"attacker);
        return;
    }
    
    
int consKills g_ConsecutiveKills[attacker][victim];
    if (
consKills == 4)
    {
        
PrintToChat(victim"%N is dominating you."attacker);
        
PrintToChat(attacker"You are now dominating %N."victim);
        return;
    }
    
    if (
consKills 4)
    {
        
PrintToChat(victim"%N is still dominating you."attacker);
        
PrintToChat(attacker"You are still dominating %N."victim);
    }
}

bool IsWarmupPeriod()
{
    return 
view_as<bool>(GameRules_GetProp("m_bWarmupPeriod"));

It's untested, but should work fine.
__________________
Ilusion9 is offline
VSG
Member
Join Date: May 2019
Location: Spain
Old 03-05-2020 , 18:08   Re: Domination and revenge in HL2 Deathmatch
Reply With Quote #5

I added your code at the end of the "killingsprees.sp" file on the scripting folder just to try, but I guess it doesn't work just like that
VSG is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 03-06-2020 , 03:20   Re: Domination and revenge in HL2 Deathmatch
Reply With Quote #6

Just get it from here and try it.
Attached Files
File Type: sp Get Plugin or Get Source (domination.sp - 133 views - 1.7 KB)
__________________
Ilusion9 is offline
VSG
Member
Join Date: May 2019
Location: Spain
Old 03-06-2020 , 07:17   Re: Domination and revenge in HL2 Deathmatch
Reply With Quote #7

Damn! it's not working.

Quote:
<Bad Load> domination.smx
Errors:
domination.smx: Unable to load plugin (no debug string table)
I'm using SourceMod Version: 1.8.0.5947, because it loads all my other current addons without throwing errors.
VSG is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 03-07-2020 , 16:18   Re: Domination and revenge in HL2 Deathmatch
Reply With Quote #8

The plugin is working well. Just compile it for sm 1.8. The forum compiles it for the last version (1.10)
__________________
Ilusion9 is offline
VSG
Member
Join Date: May 2019
Location: Spain
Old 03-08-2020 , 05:33   Re: Domination and revenge in HL2 Deathmatch
Reply With Quote #9

Ok, so I compiled the .sp for my SourceMod version as per the instructions provided here:

https://wiki.alliedmods.net/Compiling_SourceMod_Plugins

And yes, the plugin loads sucessfully. But not seeing any txt about dominations or revenges, I decided to check the server console, and this is what I found spamming all the time:

Quote:
L 03/08/2020 - 10:00:56: [SM] Exception reported: Property "m_bWarmupPeriod" not found on the gamerules proxy
L 03/08/2020 - 10:00:56: [SM] Blaming: domination.smx
L 03/08/2020 - 10:00:56: [SM] Call stack trace:
L 03/08/2020 - 10:00:56: [SM] [0] GameRules_GetProp
L 03/08/2020 - 10:00:56: [SM] [1] Line 68, domination.sp::IsWarmupPeriod
L 03/08/2020 - 10:00:56: [SM] [2] Line 23, domination.sp::Event_PlayerDeath
Although my idea was to have this only for hl2dm, I will test your version compiled for the newer SM 1.10 which is actually installed on the cs: source server we have.

Last edited by VSG; 03-08-2020 at 05:35.
VSG is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 03-08-2020 , 06:58   Re: Domination and revenge in HL2 Deathmatch
Reply With Quote #10

Try this:

PHP Code:
#include <sourcemod>
#include <sdktools>
#pragma newdecls required

int g_ConsecutiveKills[MAXPLAYERS 1][MAXPLAYERS 1];

public 
void OnPluginStart()
{
    
HookEvent("player_death"Event_PlayerDeath);
}

public 
void OnClientConnected(int client)
{
    for (
int i 1MAXPLAYERS 1i++)
    {
        
g_ConsecutiveKills[client][i] = 0;
        
g_ConsecutiveKills[i][client] = 0;
    }
}

public 
void Event_PlayerDeath(Event event, const char[] namebool dontBroadcast)
{
    
int victim GetClientOfUserId(event.GetInt("userid"));    
    if (!
victim)
    {
        return;
    }
    
    
int attacker GetClientOfUserId(event.GetInt("attacker"));
    if (!
attacker || attacker == victim)
    {
        return;
    }

    
bool revenge g_ConsecutiveKills[victim][attacker] > 3;
    
g_ConsecutiveKills[attacker][victim]++
    
g_ConsecutiveKills[victim][attacker] = 0;
    
    if (
revenge)
    {
        
PrintToChat(attacker"You revenged on %N!"victim);
        
PrintToChat(victim"%N has revenged on you!"attacker);
        return;
    }
    
    
int consKills g_ConsecutiveKills[attacker][victim];
    if (
consKills == 4)
    {
        
PrintToChat(victim"%N is dominating you."attacker);
        
PrintToChat(attacker"You are now dominating %N."victim);
        return;
    }
    
    if (
consKills 4)
    {
        
PrintToChat(victim"%N is still dominating you."attacker);
        
PrintToChat(attacker"You are still dominating %N."victim);
    }

It seems there's no warmup in hl2dm.
__________________
Ilusion9 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 01:47.


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