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

Domination and revenge in HL2 Deathmatch


Post New Thread Reply   
 
Thread Tools Display Modes
VSG
Member
Join Date: May 2019
Location: Spain
Old 03-09-2020 , 07:18   Re: Domination and revenge in HL2 Deathmatch
Reply With Quote #21

I'm doing a small experiment, I will take this other color.inc from another plugin, and see what happens when I use for your files. This one's code seems to be a bit different.
Attached Files
File Type: inc colors.inc (11.5 KB, 55 views)
VSG is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 03-09-2020 , 08:28   Re: Domination and revenge in HL2 Deathmatch
Reply With Quote #22

I forgot to change PrintToChat to CPrintToChat. Sorry.
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <colorlib_sample>
#pragma newdecls required

public Plugin myinfo =
{
    
name "Dominations and Revenges",
    
author "Ilusion9",
    
description "Print to chat if a player is dominating or it took revenge.",
    
version "1.0",
    
url "https://github.com/Ilusion9/"
};


int g_ConsecutiveKills[MAXPLAYERS 1][MAXPLAYERS 1];
ConVar g_Cvar_DominationKills;

public 
void OnPluginStart()
{
    
LoadTranslations("dominations_revenges.phrases");
    
g_Cvar_DominationKills CreateConVar("sm_dominations_kills""4""After how many consecutive kills players are dominating?"FCVAR_NONEtrue0.0);
    
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 tookRevenge g_ConsecutiveKills[victim][attacker] >= g_Cvar_DominationKills.IntValue;
    
g_ConsecutiveKills[attacker][victim]++
    
g_ConsecutiveKills[victim][attacker] = 0;
    
    if (
tookRevenge)
    {
        
char victimName[MAX_NAME_LENGTH], attackerName[MAX_NAME_LENGTH];
        
GetClientName(victimvictimNamesizeof(victimName));
        
GetClientName(attackerattackerNamesizeof(attackerName));
        
        
CPrintToChat(attacker"%t""You Took Revenge"victimName);
        
CPrintToChat(victim"%t""Player Took Revenge on You"attackerName);
        return;
    }
    
    
int consKills g_ConsecutiveKills[attacker][victim];
    if (
consKills g_Cvar_DominationKills.IntValue)
    {
        return;
    }
    
    
char victimName[MAX_NAME_LENGTH], attackerName[MAX_NAME_LENGTH];
    
GetClientName(victimvictimNamesizeof(victimName));
    
GetClientName(attackerattackerNamesizeof(attackerName));
    
    if (
consKills == g_Cvar_DominationKills.IntValue)
    {
        
CPrintToChat(victim"%t""Is Dominating You"attackerName);
        
CPrintToChat(attacker"%t""You Are Dominating"victimName);
        return;
    }
    
    
CPrintToChat(victim"%t""Is Still Dominating You"attackerName);
    
CPrintToChat(attacker"%t""You Are Still Dominating"victimName);

__________________
Ilusion9 is offline
VSG
Member
Join Date: May 2019
Location: Spain
Old 03-09-2020 , 09:13   Re: Domination and revenge in HL2 Deathmatch
Reply With Quote #23

Another compilation error. Have no idea of what this means...

Quote:
// dominations_revenges.sp
//dominations_revenges.sp(82) : error 030: compound statement not closed at the end of the file (started at line 37)
//1 Error.
//Compilation Time: 1.36 sec
VSG is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 03-09-2020 , 15:11   Re: Domination and revenge in HL2 Deathmatch
Reply With Quote #24

You forgot to copy the last line: "}"
__________________
Ilusion9 is offline
VSG
Member
Join Date: May 2019
Location: Spain
Old 03-09-2020 , 16:07   Re: Domination and revenge in HL2 Deathmatch
Reply With Quote #25

Yes, you are right! Sorry for that. It compiled correctly now.

My testing: Colors are not correct, but it is an improvement. The Domination text appears in black, and the Revenge test appears with the default color (gold). Will try other colors later, changing them on the translations phrases.txt. Maybe with choosing just simple colors like red and green.

Cheers.
VSG is offline
VSG
Member
Join Date: May 2019
Location: Spain
Old 03-09-2020 , 16:57   Re: Domination and revenge in HL2 Deathmatch
Reply With Quote #26

Green color is working indeed. Donīt worry doing any more work for now, Iīm just very happy with it.
VSG 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 14:00.


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