AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Domination and revenge in HL2 Deathmatch (https://forums.alliedmods.net/showthread.php?t=321873)

VSG 03-04-2020 16:01

Domination and revenge in HL2 Deathmatch
 
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.

Ilusion9 03-05-2020 03:57

Re: Domination and revenge in HL2 Deathmatch
 
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.

VSG 03-05-2020 08:31

Re: Domination and revenge in HL2 Deathmatch
 
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.

Ilusion9 03-05-2020 14:07

Re: Domination and revenge in HL2 Deathmatch
 
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.

VSG 03-05-2020 18:08

Re: Domination and revenge in HL2 Deathmatch
 
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 :P

Ilusion9 03-06-2020 03:20

Re: Domination and revenge in HL2 Deathmatch
 
1 Attachment(s)
Just get it from here and try it.

VSG 03-06-2020 07:17

Re: Domination and revenge in HL2 Deathmatch
 
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.

Ilusion9 03-07-2020 16:18

Re: Domination and revenge in HL2 Deathmatch
 
The plugin is working well. Just compile it for sm 1.8. The forum compiles it for the last version (1.10)

VSG 03-08-2020 05:33

Re: Domination and revenge in HL2 Deathmatch
 
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.

Ilusion9 03-08-2020 06:58

Re: Domination and revenge in HL2 Deathmatch
 
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.


All times are GMT -4. The time now is 09:24.

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