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

ROUNDSOUND CS:GO problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
adamujhazi
Junior Member
Join Date: Apr 2015
Old 04-09-2015 , 13:13   ROUNDSOUND CS:GO problem
Reply With Quote #1

Hello.
I have problem with edited CS:GO plugin roundsound.
When I inserted to code ClientCommand(0, "play *music/rauk/<name>.mp3"); sound doesn't play, and when I change it to ClientCommand(client, "play *music/rauk/<name>.mp3"); compiler says: /home/groups/sourcemod/upload_tmp/phpp4u7Ry.sp(140) : error 017: undefined symbol "client"

Code:
/* *
 * RoundSound BY TUMMIETUM (TUMTUM)
 * -------------------------
 * Changelog Original Roundsound++ by ANTiCHRiST
 * -------------------------
 * by TanaToS aka ANTiCHRiST
 */
#include <sourcemod>
#include <sdktools>
#include <sdktools_sound>
#include <console>
#include <string>

#pragma semicolon 1

#define PLUGIN_VERSION "1.1.0"
#define MAX_FILE_LEN 256

new Handle:g_hEnabled = INVALID_HANDLE;
new bool:g_bEnabled = true;

public Plugin:myinfo = {
	name = "RoundSound CS:GO",
	author = "ANTiCHRiST Edited by TumTum, Editoval: XtraEdge/Adam Ujhazi/",
	description = "Hra hudbu na konci kola.",
	version = PLUGIN_VERSION,
	url = "http://www.team-secretforce.com"
};

public OnPluginStart() {
	CreateConVar("sm_roundsound_version", PLUGIN_VERSION, "RoundSound version.", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
	g_hEnabled = CreateConVar("sm_roundsound_enable", "1", "RoundSound Enable/Disable CVar.", FCVAR_PLUGIN|FCVAR_NOTIFY);

	HookEvent("round_end", EventRoundEnd);
	HookConVarChange(g_hEnabled, CVarEnabled);
}

public OnMapStart()
{
    decl String:tewin_snd1[MAX_FILE_LEN];
    decl String:tewin_snd2[MAX_FILE_LEN];
    decl String:tewin_snd3[MAX_FILE_LEN];
    decl String:tewin_snd4[MAX_FILE_LEN];
    decl String:tewin_snd5[MAX_FILE_LEN];
    decl String:tewin_snd6[MAX_FILE_LEN];
    decl String:tewin_snd7[MAX_FILE_LEN];
    decl String:ctwin_snd1[MAX_FILE_LEN];
    decl String:ctwin_snd2[MAX_FILE_LEN];
    decl String:ctwin_snd3[MAX_FILE_LEN];
    decl String:ctwin_snd4[MAX_FILE_LEN];
    decl String:ctwin_snd5[MAX_FILE_LEN];
    decl String:ctwin_snd6[MAX_FILE_LEN];
    decl String:ctwin_snd7[MAX_FILE_LEN];

    Format(tewin_snd1, sizeof(tewin_snd1), "sound/music/rauk/cheri_cheri_lady_new_version.mp3");
    Format(tewin_snd2, sizeof(tewin_snd2), "sound/music/rauk/tolouse.mp3");
    Format(tewin_snd3, sizeof(tewin_snd3), "sound/music/rauk/calin_neon_light.mp3");
    Format(tewin_snd4, sizeof(tewin_snd4), "sound/music/rauk/lovers_on_the_sun.mp3");
    Format(tewin_snd5, sizeof(tewin_snd5), "sound/music/rauk/tentacion.mp3");
    Format(tewin_snd6, sizeof(tewin_snd6), "sound/music/rauk/macarena.mp3");
    Format(tewin_snd7, sizeof(tewin_snd7), "sound/music/rauk/she_makes_me_go.mp3");
    Format(ctwin_snd1, sizeof(ctwin_snd1), "sound/music/rauk/beautiful_lies.mp3");
    Format(ctwin_snd2, sizeof(ctwin_snd2), "sound/music/rauk/i_could_be_the_one.mp3");
    Format(ctwin_snd3, sizeof(ctwin_snd3), "sound/music/rauk/calin_break_my_fall.mp3");
    Format(ctwin_snd4, sizeof(ctwin_snd4), "sound/music/rauk/nu.mp3");
    Format(ctwin_snd5, sizeof(ctwin_snd5), "sound/music/rauk/children.mp3");
    Format(ctwin_snd6, sizeof(ctwin_snd6), "sound/music/rauk/blue.mp3");
    Format(ctwin_snd7, sizeof(ctwin_snd7), "sound/music/rauk/chica_bomb.mp3");

	if(FileExists(tewin_snd1) && FileExists(tewin_snd2) && FileExists(tewin_snd3) && FileExists(tewin_snd4) && FileExists(tewin_snd5) && FileExists(tewin_snd6) && FileExists(tewin_snd7) && FileExists(ctwin_snd1) && FileExists(ctwin_snd2) && FileExists(ctwin_snd3) && FileExists(ctwin_snd4) && FileExists(ctwin_snd5) && FileExists(ctwin_snd6) && FileExists(ctwin_snd7)) {
        AddFileToDownloadsTable(tewin_snd1);
        AddFileToDownloadsTable(tewin_snd2);
        AddFileToDownloadsTable(tewin_snd3);
        AddFileToDownloadsTable(tewin_snd4);
        AddFileToDownloadsTable(tewin_snd5);
        AddFileToDownloadsTable(tewin_snd6);
        AddFileToDownloadsTable(tewin_snd7);
        AddFileToDownloadsTable(ctwin_snd1);
        AddFileToDownloadsTable(ctwin_snd2);
        AddFileToDownloadsTable(ctwin_snd3);
        AddFileToDownloadsTable(ctwin_snd4);
        AddFileToDownloadsTable(ctwin_snd5);
        AddFileToDownloadsTable(ctwin_snd6);
        AddFileToDownloadsTable(ctwin_snd7);

        PrecacheSound("music/rauk/beautiful_lies.mp3", true);
        PrecacheSound("music/rauk/i_could_be_the_one.mp3", true);
        PrecacheSound("music/rauk/calin_break_my_fall.mp3", true);
        PrecacheSound("music/rauk/nu.mp3", true);
        PrecacheSound("music/rauk/children.mp3", true);
        PrecacheSound("music/rauk/blue.mp3", true);
        PrecacheSound("music/rauk/chica_bomb.mp3", true);
        PrecacheSound("music/rauk/cheri_cheri_lady_new_version.mp3", true);
        PrecacheSound("music/rauk/tolouse.mp3", true);
        PrecacheSound("music/rauk/calin_neon_light.mp3", true);
        PrecacheSound("music/rauk/lovers_on_the_sun.mp3", true);
        PrecacheSound("music/rauk/tentacion.mp3", true);
        PrecacheSound("music/rauk/macarena.mp3", true);
        PrecacheSound("music/rauk/she_makes_me_go.mp3", true);
	}
	else {
		LogError("Nie vsetky subory existuju, uprav plugin.");
		LogError("Vypinam plugin.");
		ServerCommand("sm plugins unload \"RoundSound.smx\"");
	}
}

public OnConfigsExecuted() {
	if(GetConVarBool(g_hEnabled)) {
		g_bEnabled = true;
	}
	else if(!GetConVarBool(g_hEnabled)) {
		g_bEnabled = false;
	}
	else {
		g_bEnabled = true;
		LogError("Neplatna hodnota plugin continued");
	}
}

public CVarEnabled(Handle:convar, const String:oldValue[], const String:newValue[]) {
	if(GetConVarBool(g_hEnabled)) {
		g_bEnabled = true;
	}
	else if(!GetConVarBool(g_hEnabled)) {
		g_bEnabled = false;
	}
	else {
		g_bEnabled = true;
		LogError("Neplatna hodnota plugin continued");
	}
}

public EventRoundEnd(Handle:event, const String:name[], bool:dontBroadcast) {
	new rnd_sound = GetRandomInt(1, 7);
	new ev_winner = GetEventInt(event, "winner");
	if(g_bEnabled) {
		if(ev_winner == 2) {
			if(rnd_sound == 1) {
				ClientCommand(0, "play *music/rauk/cheri_cheri_lady_new_version.mp3");
			}
			else if(rnd_sound == 2) {
				ClientCommand(0, "play *music/rauk/tolouse.mp3");
			}
			else if(rnd_sound == 3) {
				ClientCommand(0, "play *music/rauk/calin_neon_light.mp3");
			}
            else if(rnd_sound == 4) {
				ClientCommand(0, "play *music/rauk/lovers_on_the_sun.mp3");
			}
            else if(rnd_sound == 5) {
				ClientCommand(0, "play *music/rauk/tentacion.mp3");
			}
            else if(rnd_sound == 6) {
				ClientCommand(0, "play *music/rauk/macarena.mp3");
			}
            else if(rnd_sound == 7) {
				ClientCommand(0, "play *music/rauk/she_makes_me_go.mp3");
			}
			else {
				LogError("Random Sound CVar Error (T TEAM).");
			}
		}
		else if(ev_winner == 3) {
			if(rnd_sound == 1) {
				ClientCommand(0, "play *music/rauk/beautiful_lies.mp3");
			}
			else if(rnd_sound == 2) {
				ClientCommand(0, "play *music/rauk/i_could_be_the_one.mp3");
			}
			else if(rnd_sound == 3) {
				ClientCommand(0, "play *music/rauk/calin_break_my_fall.mp3");
			}
            else if(rnd_sound == 4) {
				ClientCommand(0, "play *music/rauk/nu.mp3");
			}
            else if(rnd_sound == 5) {
				ClientCommand(0, "play *music/rauk/children.mp3");
			}
            else if(rnd_sound == 6) {
				ClientCommand(0, "play *music/rauk/blue.mp3");
			}
            else if(rnd_sound == 7) {
				ClientCommand(0, "play *music/rauk/chica_bomb.mp3");
			}
			else {
				LogError("Random Sound CVar Error (CT TEAM).");
			}
		}
		else {
			LogError("Ziaden tym nevyhral kolo.");
		}
	}
}

Last edited by adamujhazi; 04-09-2015 at 13:18.
adamujhazi is offline
Kolapsicle
Senior Member
Join Date: Oct 2014
Old 04-09-2015 , 15:29   Re: ROUNDSOUND CS:GO problem
Reply With Quote #2

You haven't define what a client is, you can get clients of events with userids.

PHP Code:
new client GetClientOfUserId(GetEventInt(event"userid")); 

Last edited by Kolapsicle; 04-09-2015 at 15:30.
Kolapsicle is offline
adamujhazi
Junior Member
Join Date: Apr 2015
Old 04-10-2015 , 02:16   Re: ROUNDSOUND CS:GO problem
Reply With Quote #3

Quote:
Originally Posted by Kolapsicle View Post
You haven't define what a client is, you can get clients of events with userids.

PHP Code:
new client GetClientOfUserId(GetEventInt(event"userid")); 
Thanks, but where I need to insert it? I inserted it after public EventRoundEnd() but still not work.

Code:
public EventRoundEnd(Handle:event, const String:name[], bool:dontBroadcast) {
	new client = GetClientOfUserId(GetEventInt(event, "userid")); 
        new rnd_sound = GetRandomInt(1, 7);
	new ev_winner = GetEventInt(event, "winner");
	if(g_bEnabled) {
		if(ev_winner == 2) {
			if(rnd_sound == 1) {
				ClientCommand(client, "play *music/rauk/cheri_cheri_lady_new_version.mp3");
			}
			else if(rnd_sound == 2) {
				ClientCommand(client, "play *music/rauk/tolouse.mp3");
			}
			else if(rnd_sound == 3) {
				ClientCommand(client, "play *music/rauk/calin_neon_light.mp3");
			}
                        else if(rnd_sound == 4) {
				ClientCommand(client, "play *music/rauk/lovers_on_the_sun.mp3");
			}
                        else if(rnd_sound == 5) {
				ClientCommand(client, "play *music/rauk/tentacion.mp3");
			}
                        else if(rnd_sound == 6) {
				ClientCommand(client, "play *music/rauk/macarena.mp3");
			}
                        else if(rnd_sound == 7) {
				ClientCommand(client, "play *music/rauk/she_makes_me_go.mp3");
			}
			else {
				LogError("Random Sound CVar Error (T TEAM).");
			}
		}
	    	else if(ev_winner == 3) {
			if(rnd_sound == 1) {
				ClientCommand(client, "play *music/rauk/beautiful_lies.mp3");
			}
			else if(rnd_sound == 2) {
				ClientCommand(client, "play *music/rauk/i_could_be_the_one.mp3");
			}
			else if(rnd_sound == 3) {
				ClientCommand(client, "play *music/rauk/calin_break_my_fall.mp3");
			}
                        else if(rnd_sound == 4) {
				ClientCommand(client, "play *music/rauk/nu.mp3");
			}
                        else if(rnd_sound == 5) {
				ClientCommand(client, "play *music/rauk/children.mp3");
			}
                        else if(rnd_sound == 6) {
				ClientCommand(client, "play *music/rauk/blue.mp3");
			}
                        else if(rnd_sound == 7) {
				ClientCommand(client, "play *music/rauk/chica_bomb.mp3");
			}
			else {
				LogError("Random Sound CVar Error (CT TEAM).");
			}
		}
		else {
			LogError("Ziaden tym nevyhral kolo.");
		}
	}
adamujhazi is offline
Kolapsicle
Senior Member
Join Date: Oct 2014
Old 04-10-2015 , 07:06   Re: ROUNDSOUND CS:GO problem
Reply With Quote #4

Sorry, I wasn't paying much attention when I replied. Not all events hold a userid or client information at all. You can view events on the wiki https://wiki.alliedmods.net/Game_Events_%28Source%29 Generic Source Events contains information on events such as round_end.

In your case because you cannot get a client of a userid, you will need to loop the clients yourself.

PHP Code:
for (new 0<= MaxClientsi++)
{
    
/* In here you can capture each client as it loops through them.
     * Note that client 0 is not a player. You can start the loop at 1 if you want to exclude it.
     * i is an integer that that holds the client, you can change the variable name. (e.g. new client = 0;)
     */

Kolapsicle is offline
thecount
Veteran Member
Join Date: Jul 2013
Old 04-10-2015 , 17:33   Re: ROUNDSOUND CS:GO problem
Reply With Quote #5

PHP Code:
stock PlaySoundToAll(const String:pathway[]){//For CSGO
    
for(new i=1;i<=MaxClients;i++){
        if(
IsClientInGame(i)){ ClientCommand(i"play *%s"pathway); }
    }

thecount 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 01:56.


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