Raised This Month: $32 Target: $400
 8% 

Solved [CSGO] taunts command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jmytch
New Member
Join Date: Jan 2018
Location: The Land Down Under
Old 01-10-2018 , 06:13   [CSGO] taunts command
Reply With Quote #1

Requesting to make a command "!taunts" without quotes that contains sounds for terrorist teams only where they can type !taunts and can play the sound 6 times per round for everybody to hear the sound.

I have the mp3 sound files if you need them, it will be called laugh.mp3, roar.mp3 etc

Please dont let CT to use the !taunt commands at all.

Last edited by jmytch; 01-10-2018 at 17:22.
jmytch is offline
fraise
Member
Join Date: Sep 2016
Location: Paris, France
Old 01-10-2018 , 09:43   Re: [CSGO] taunts command
Reply With Quote #2

Do you want a menu where the T choose the sound ? or it's play randomly ?
__________________
\o/
fraise is offline
jmytch
New Member
Join Date: Jan 2018
Location: The Land Down Under
Old 01-10-2018 , 09:50   Re: [CSGO] taunts command
Reply With Quote #3

Quote:
Originally Posted by fraise View Post
Do you want a menu where the T choose the sound ? or it's play randomly ?
Yep to the T to choose the sound from the list on the menu.

Like this

Taunts
1. Roar (then it plays the sound)
2. Laugh
3. Etc

Can only play sound probably 4 or 6 times per round.
jmytch is offline
fraise
Member
Join Date: Sep 2016
Location: Paris, France
Old 01-10-2018 , 10:45   Re: [CSGO] taunts command
Reply With Quote #4

ok, i'll try to do it when i get the time =)
__________________
\o/
fraise is offline
nhnkl159
Senior Member
Join Date: Jul 2012
Location: Israel 3>
Old 01-10-2018 , 11:38   Re: [CSGO] taunts command
Reply With Quote #5

Haven't tested it, I've attached the compiled plugin and config in the zip.

PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "nhnkl159"
#define PLUGIN_VERSION "1.0"

#include <sourcemod>
#include <sdktools>
#include <colors>
#include <emitsoundany>

char gS_Config[PLATFORM_MAX_PATH];
Handle gH_kv;

int gI_TauntsUsed[MAXPLAYERS 1];

ConVar gC_AllowedTeam;
ConVar gC_MaxTimes;

public 
Plugin myinfo 
{
    
name "[CS:GO / ANY ?] Taunts"
    
author PLUGIN_AUTHOR
    
description "Allow player to play some sounds to the world."
    
version PLUGIN_VERSION
    
url "keepomod.com"
};

public 
void OnPluginStart()
{
    
CreateConVar("sm_taunts_version"PLUGIN_VERSION"plugin info"FCVAR_SPONLY FCVAR_REPLICATED FCVAR_NOTIFY FCVAR_DONTRECORD);
    
    
gC_AllowedTeam CreateConVar("sm_taunts_team""2""Only team that can use taunts command (0 = Both)");
    
gC_MaxTimes CreateConVar("sm_taunts_maxtimes""4""Max times that player can use this command per round.");
    
    
RegConsoleCmd("sm_taunts"CMD_Taunts"Command for player to open the taunts menu.");
    
RegAdminCmd("sm_reloadtaunts"CMD_ReloadADMFLAG_BAN"Command for admins to reload the taunts menu.");
    
    
HookEvent("round_start"Event_RoundStart);
    
    
RefreshSounds();
    
    
AutoExecConfig(true"sm_taunts");
}

public 
void OnMapStart()
{
    
DownloadAndPre();
}

public 
void OnClientConnected(int client)
{
    
gI_TauntsUsed[client] = 0;
}


public 
void Event_RoundStart(Event e, const char[] namebool dontBroadcast)
{
    for (
int i 0<= MaxClientsi++)
    {
        if(
IsValidClient(i))
        {
            
gI_TauntsUsed[i] = 0;
        }
    }
}

public 
Action CMD_Reload(int clientint args)
{
    
RefreshSounds();
    
    
CPrintToChat(client"\x05You have reloaded the ini files.");
    return 
Plugin_Handled;
}

public 
Action CMD_Taunts(int clientint args)
{
    if (!
IsValidClient(client))
    {
        return 
Plugin_Handled;
    }
    
    if (
gI_TauntsUsed[client] >= gC_MaxTimes.IntValue)
    {
        
CPrintToChat(client"\x05You have already used your maximum amount of taunts (%d/%d)."gI_TauntsUsed[client], gC_MaxTimes.IntValue);
        return 
Plugin_Handled;
    }
    
    if (
GetClientTeam(client) != gC_AllowedTeam.IntValue && gC_AllowedTeam.IntValue != 0)
    {
        
CPrintToChat(client"\x05You are not allowed to use this command (Team Blocked).");
        return 
Plugin_Handled;
    }
    
    
char MenuTitle[128];
    
FormatEx(MenuTitle128"Taunts Menu\nTaunts Left : %d"gC_MaxTimes.IntValue gI_TauntsUsed[client]);
    
    
char FileName[256], SoundFile[256], SoundFile2[256];
    
    
    
Menu menu = new Menu(TauntsMenuHandler);
    
menu.SetTitle(MenuTitle);
    if (
KvGotoFirstSubKey(gH_kv))
    {
        do
        {
            
KvGetString(gH_kv"file"SoundFile256);
            
Format(SoundFile2256"sound/%s"SoundFile);
            if (!
FileExists(SoundFile2) && !FileExists(SoundFile2true))continue;
            
KvGetSectionName(gH_kvFileName256);
            
menu.AddItem(SoundFileFileName);
            
        } while (
KvGotoNextKey(gH_kv));
    }
    
KvRewind(gH_kv);
    
    
menu.Display(clientMENU_TIME_FOREVER);
    
    return 
Plugin_Handled;
}

public 
int TauntsMenuHandler(Menu menuMenuAction actionint clientint param2)
{
    switch (
action)
    {
        case 
MenuAction_Select:
        {
            if (
GetClientTeam(client) != gC_AllowedTeam.IntValue && gC_AllowedTeam.IntValue != 0)
            {
                
CPrintToChat(client"\x05You are not allowed to use this command (Team Blocked).");
                return;
            }
            
            
char paramitem[256];
            
GetMenuItem(menuparam2paramitemsizeof(paramitem));
            
            
float origin[3];
            
GetClientAbsOrigin(clientorigin);
            
EmitAmbientSoundAny(paramitemorigin);
            
            
CPrintToChat(client"\x05Playing : %s."paramitem);
            
            
gI_TauntsUsed[client]++;
            
            
KvRewind(gH_kv);
            
            
        }
        case 
MenuAction_Cancel:
        {
            if (
param2 == MenuCancel_ExitBack)
            {
                
delete menu;
            }
        }
        
    }
}

stock bool IsValidClient(int clientbool alive falsebool bots false)
{
    if (
client && client <= MaxClients && IsClientInGame(client) && (alive == false || IsPlayerAlive(client)) && (bots == false && !IsFakeClient(client)))
    {
        return 
true;
    }
    return 
false;
}

void RefreshSounds()
{
    
BuildPath(Path_SMgS_ConfigPLATFORM_MAX_PATH"configs/taunts/sounds.ini");
    
    if (
gH_kv != INVALID_HANDLE)CloseHandle(gH_kv);
    
    
gH_kv CreateKeyValues("Taunts");
    
FileToKeyValues(gH_kvgS_Config);
}

void DownloadAndPre()
{
    
char gS_Temp[256];
    if (
KvGotoFirstSubKey(gH_kv))
    {
        do
        {
            
KvGetString(gH_kv"file"gS_Temp256);
            
PrecacheSoundAny(gS_Temp);
            
char gS_Temp2[256];
            
Format(gS_Temp2256"sound/%s"gS_Temp);
            
AddFileToDownloadsTable(gS_Temp2);
            
        } while (
KvGotoNextKey(gH_kv));
    }
    
KvRewind(gH_kv);

Attached Files
File Type: zip Taunts.zip (13.9 KB, 159 views)
__________________

Last edited by nhnkl159; 01-10-2018 at 11:40.
nhnkl159 is offline
Send a message via Skype™ to nhnkl159
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 01-10-2018 , 12:58   Re: [CSGO] taunts command
Reply With Quote #6

On a kind of related note, I've noticed lots of things about taunts in CSGO game files so I think valve is planning on adding something like this.

Last edited by hmmmmm; 01-10-2018 at 12:58.
hmmmmm is offline
jmytch
New Member
Join Date: Jan 2018
Location: The Land Down Under
Old 01-10-2018 , 16:53   Re: [CSGO] taunts command
Reply With Quote #7

The plugins works, thanks nhnkl159.

Question, how do I remove the Playing : song name please?


EDIT: I found the line to remove the Playing : song but when I try to compile the scripting, it come up with an error of color and others. It wouldn't compile into .smx :-/

EDIT2: Don't worry, I downloaded colors.inc and emitsoundany.inc and put them in include folder and it compiles fine now. Thank you for your time to create this.

Last edited by jmytch; 01-10-2018 at 17:22.
jmytch 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 06:27.


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