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-09-2020 07:18

Re: Domination and revenge in HL2 Deathmatch
 
1 Attachment(s)
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.

Ilusion9 03-09-2020 08:28

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



VSG 03-09-2020 09:13

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

Ilusion9 03-09-2020 15:11

Re: Domination and revenge in HL2 Deathmatch
 
You forgot to copy the last line: "}"

VSG 03-09-2020 16:07

Re: Domination and revenge in HL2 Deathmatch
 
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 03-09-2020 16:57

Re: Domination and revenge in HL2 Deathmatch
 
Green color is working indeed. Donīt worry doing any more work for now, Iīm just very happy with it. :)


All times are GMT -4. The time now is 01:03.

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