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

Clutch plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alphaearth
Senior Member
Join Date: Feb 2018
Location: Turkey
Old 10-28-2018 , 17:17   Clutch plugin
Reply With Quote #1

Plugin Request Subject. If you want to help, do it free.
I want that say message when the player clutch in the server like alphaearth clutch 1vs4. And ballon effect on the players when they clutch. Can you help me?
__________________
alphaearth is offline
alexr153
AlliedModders Donor
Join Date: Jul 2015
Location: In a house
Old 10-28-2018 , 18:26   Re: Clutch plugin
Reply With Quote #2

This is for CSGO correct?

Edit:
If it is for CSGO you can try this
PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "hAlexrr"
#define PLUGIN_VERSION "1.0"

#include <sourcemod>
#include <sdktools>
#include <emitsoundany>
#include <cstrike>

#pragma newdecls required

ConVar sm_players_alive_clutch;

Handle g_hTimer;

int g_iTeamT;
int g_iTeamCT;
int g_iOpponents;

bool g_bInClutch;

public 
Plugin myinfo 
{
    
name "Player Clutched",
    
author PLUGIN_AUTHOR,
    
description "Gives an announcement when a player clutches the round",
    
version PLUGIN_VERSION,
    
url "NUN"
};

public 
void OnPluginStart()
{
    
sm_players_alive_clutch CreateConVar("sm_players_alive_clutch""3""The amount of players needed to be alive on the opposite team for it to be considered a clutch");
    
    
HookEvent("round_end"Event_RoundEnd);
}

public 
void OnMapStart()
{
    
//// Vortex - https://forums.alliedmods.net/showthread.php?t=299964
    
PrecacheSoundAny("weapons/party_horn_01.wav"); // End
    
    
if(g_hTimer == INVALID_HANDLE)
        
g_hTimer CreateTimer(0.5getAlivePlayers_TIMER_REPEAT TIMER_FLAG_NO_MAPCHANGE);
}

public 
Action getAlivePlayers(Handle timer)
{
    
int CTT;
    for (
int i 1<= MaxClientsi++)
    {
        if(
IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i))
        {
            if(
GetClientTeam(i) == CS_TEAM_CT)
                
CT++;
            else if(
GetClientTeam(i) == CS_TEAM_T)
                
T++;
        }
    }
    
    
g_iTeamCT CT;
    
g_iTeamT T;
    
    if(
g_iTeamT == 1  && g_iTeamCT >= sm_players_alive_clutch.IntValue && !g_bInClutch)
    {
        
g_bInClutch true;
        
g_iOpponents g_iTeamCT;
    } else if(
g_iTeamCT == 1  && g_iTeamT >= sm_players_alive_clutch.IntValue && !g_bInClutch)
    {
        
g_bInClutch true;
        
g_iOpponents g_iTeamT;
    }
}

public 
Action Event_RoundEnd(Event eventchar[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
    if(
g_bInClutch && g_iOpponents >= sm_players_alive_clutch.IntValue)
    {
        
PrintToChatAll("[\x06NOTIFY\x01] Player %N has clutched a 1v%i"g_iOpponents);
        
CreateParticle(client"weapon_confetti_balloons"5.0);
        
g_bInClutch false;
        
g_iTeamCT 0;
        
g_iTeamT 0;
        
g_iOpponents 0;
    }
}

// Vortex - https://forums.alliedmods.net/showthread.php?t=299964
stock void CreateParticle(int entchar[] particleTypefloat time)
{
    
int particle CreateEntityByName("info_particle_system");
    
    
char name[64];
    
    if (
IsValidEdict(particle))
    {
        
float position[3];
        
GetEntPropVector(entProp_Send"m_vecOrigin"position);
        
TeleportEntity(particlepositionNULL_VECTORNULL_VECTOR);
        
GetEntPropString(entProp_Data"m_iName"namesizeof(name));
        
DispatchKeyValue(particle"targetname""tf2particle");
        
DispatchKeyValue(particle"parentname"name);
        
DispatchKeyValue(particle"effect_name"particleType);
        
DispatchSpawn(particle);
        
SetVariantString(name);
        
AcceptEntityInput(particle"SetParent"particleparticle0);
        
ActivateEntity(particle);
        
AcceptEntityInput(particle"start");
        
CreateTimer(timeDeleteParticleparticle);
    }
    
EmitSoundToAllAny("weapons/party_horn_01.wav");  
}

public 
Action DeleteParticle(Handle timerany particle)
{
    if (
IsValidEntity(particle))
    {
        
char classN[64];
        
GetEdictClassname(particleclassNsizeof(classN));
        if (
StrEqual(classN"info_particle_system"false))
        {
            
RemoveEdict(particle);
        }
    }
}  
// End 
I have not testing it BTW

Last edited by alexr153; 10-28-2018 at 22:22.
alexr153 is offline
alphaearth
Senior Member
Join Date: Feb 2018
Location: Turkey
Old 10-29-2018 , 05:24   Re: Clutch plugin
Reply With Quote #3

plugin send the "console 1vs3 clutch" message in the every round begining. Can you fix this fault?
__________________
alphaearth is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 10-29-2018 , 06:57   Re: Clutch plugin
Reply With Quote #4

I have rewritten it with improvements, try this.

Edit: Tested and works well!

Edit2: Plugin moved to this -> https://forums.alliedmods.net/showthread.php?p=2621750
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.


Last edited by Franc1sco; 10-29-2018 at 07:29.
Franc1sco is offline
Send a message via MSN to Franc1sco
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 11:34.


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