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

Solved game_text l4d2 help


Post New Thread Reply   
 
Thread Tools Display Modes
Aceleracion
Member
Join Date: Jul 2017
Location: Ecuador
Old 12-02-2017 , 19:04   Re: game_text l4d2 help
Reply With Quote #41

Quote:
Originally Posted by Vip4ik View Post
but this plugin not work
Really do not you get the HUD layout ?, As the image that is up ?. This is rare.
Tell me what you see in the server console, some error or message, apart from the one you indicated to me.
__________________
by Aceleración
To succeed in your goals, use your true potential
Aceleracion is offline
Vip4ik
New Member
Join Date: Aug 2017
Old 12-02-2017 , 19:46   Re: game_text l4d2 help
Reply With Quote #42

Quote:
Originally Posted by Aceleracion View Post
Really do not you get the HUD layout ?, As the image that is up ?. This is rare.
Tell me what you see in the server console, some error or message, apart from the one you indicated to me.
just nothing happens and spamming in console ,doesnt have errors in log file .
Vip4ik is offline
Aceleracion
Member
Join Date: Jul 2017
Location: Ecuador
Old 12-02-2017 , 20:38   Re: game_text l4d2 help
Reply With Quote #43

Quote:
Originally Posted by Vip4ik View Post
just nothing happens and spamming in console ,doesnt have errors in log file .
Check if you have the extension requested by the plugin.
Check if you have the file "speakerhud.nut" in the folder "left4dead2/scripts/vscripts". Also check if you have updated the game to the latest versions. The latest version is 2.1.5.0. I think that in versions prior to 2.1.1 it will not work.
Also check the cvar "cl_drawhud" is with the value equal to 1.

Greetings.
__________________
by Aceleración
To succeed in your goals, use your true potential

Last edited by Aceleracion; 12-02-2017 at 22:34.
Aceleracion is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 12-02-2017 , 22:21   Re: game_text l4d2 help
Reply With Quote #44

I installed the Voice Hook extension and the Speakers List HUD plugin but both of them fail to load every time. Any ideas why?
__________________

Last edited by Psyk0tik; 12-02-2017 at 22:21.
Psyk0tik is offline
Aceleracion
Member
Join Date: Jul 2017
Location: Ecuador
Old 12-02-2017 , 22:46   Re: game_text l4d2 help
Reply With Quote #45

Quote:
Originally Posted by Crasher_3637 View Post
I installed the Voice Hook extension and the Speakers List HUD plugin but both of them fail to load every time. Any ideas why?
I tried with my own plugin, which uses the library of the following plugin: https://forums.alliedmods.net/showthread.php?t=245384, which at the same time uses the extension DHooks, and works perfectly. Emilio3 has another similar plugin that runs with the VoiceHook extension, which also works, but I have not tried it because he said it had already worked for him. Ask him personally.
Check for errors in your records file and show it here to help you.

Greetings.
__________________
by Aceleración
To succeed in your goals, use your true potential
Aceleracion is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 12-03-2017 , 05:43   Re: game_text l4d2 help
Reply With Quote #46

Quote:
Originally Posted by Aceleracion View Post
I tried with my own plugin, which uses the library of the following plugin: https://forums.alliedmods.net/showthread.php?t=245384, which at the same time uses the extension DHooks, and works perfectly. Emilio3 has another similar plugin that runs with the VoiceHook extension, which also works, but I have not tried it because he said it had already worked for him. Ask him personally.
Check for errors in your records file and show it here to help you.

Greetings.
Could you link me to the VoiceHook that you use? I've only found a couple but they either seem to be outdated or don't work. Would I also need to download that VoiceAnnounceEX plugin?
__________________
Psyk0tik is offline
Aceleracion
Member
Join Date: Jul 2017
Location: Ecuador
Old 12-03-2017 , 11:46   Re: game_text l4d2 help
Reply With Quote #47

Quote:
Originally Posted by Crasher_3637 View Post
Could you link me to the VoiceHook that you use? I've only found a couple but they either seem to be outdated or don't work. Would I also need to download that VoiceAnnounceEX plugin?
If the "VoiceHook" extension in this forum does not work for you, use the "VoiceAnnounceEX" plugin to use the library of this plugin. To plugin l4d2_speakers only the function "OnClientSpeaking" must be changed to "OnClientSpeakingEx".

PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <sdktools>
#include <basecomm>
#include <voiceannounce_ex>

#define PLUGINS_NAME        "l4d2_speakers"
#define PLUGIN_FCVAR        FCVAR_PLUGIN | FCVAR_NOTIFY
#define PLUGIN_VERSION      "1.2"

ConVar cvar_speakerlist_type;
int iSpeakListType;

bool ClientSpeaking[MAXPLAYERS+1];
int iCount;
char SpeakingPlayers[128];

char sPath_VscriptHUD[PLATFORM_MAX_PATH];

public 
Plugin myinfo =
{
    
name PLUGINS_NAME,
    
author "Aceleracion and Emilio3",
    
description "Player Speakers List in Hud",
    
version PLUGIN_VERSION,
    
url "n/a"
}

public 
void OnPluginStart()
{
    
cvar_speakerlist_type CreateConVar("voice_speakerlist_type",  "0""Speaker list type (0: Center text, 1: Hud Layout) [DEFAULT: 0]"PLUGIN_FCVARtrue0.0true1.0);

    
RegAdminCmd("sm_runvscript"Command_RunVscriptADMFLAG_ROOT);

    
HookConVarChange(cvar_speakerlist_typeCvar_Changed);

    
char sPath[PLATFORM_MAX_PATH];
    
strcopy(sPathsizeof(sPath), "scripts/vscripts");
    if(
DirExists(sPath) == false)
    {
        
CreateDirectory(sPath511);
    }

    
Format(sPath_VscriptHUDsizeof(sPath_VscriptHUD), "scripts/vscripts/speakerhud.nut");
    if(
FileExists(sPath_VscriptHUD) == false || FileSize(sPath_VscriptHUD) == 0)
    {
        
SaveVscriptHUD();
    }

    
CreateTimer(0.8UpdateSpeaking_TIMER_REPEAT);
}

public 
void OnClientSpeakingEx(int client)
{
    if (
BaseComm_IsClientMuted(client))
    {
        return;
    }
    if (
GetClientListeningFlags(client) == 1)
    {
        return;
    }
    
ClientSpeaking[client] = true;
}

public 
void OnConfigsExecuted()
{
    
GetCvars();
}

public 
void Cvar_Changed(ConVar convar, const char[] oldValue, const char[] newValue)
{
    
GetCvars();
}

void GetCvars()
{
    
iSpeakListType GetConVarInt(cvar_speakerlist_type);
}

public 
Action Command_RunVscript(int clientint args)
{
    if(
args 1)
    {
        return 
Plugin_Handled;
    }

    
char vscriptFile[40];
    
GetCmdArg(1vscriptFilesizeof(vscriptFile));

    
int entity CreateEntityByName("logic_script");
    if( 
entity != -)
    {
        
DispatchKeyValue(entity"vscripts"vscriptFile);
        
DispatchSpawn(entity);
        
SetVariantString("OnUser1 !self:RunScriptCode::0:-1");
        
AcceptEntityInput(entity"AddOutput");
        
SetVariantString("OnUser1 !self:Kill::1:-1");
        
AcceptEntityInput(entity"AddOutput");
        
AcceptEntityInput(entity"FireUser1");
    }
    return 
Plugin_Handled;
}

public 
Action UpdateSpeaking(Handle timer)
{
    
iCount 0;
    
SpeakingPlayers[0] = '\0';
    for (
int i 1<= MaxClientsi++)
    {
        if (
ClientSpeaking[i])
        {
            if (!
IsClientInGame(i)) continue;
            
            if(
iSpeakListType)
            {
                
Format(SpeakingPlayerssizeof(SpeakingPlayers), "%s\\n> %N"SpeakingPlayersi);
            }
            else
            {
                
Format(SpeakingPlayerssizeof(SpeakingPlayers), "%s\n%N"SpeakingPlayersi);
            }
            
iCount++;
        }
        
ClientSpeaking[i] = false;
    }
    if (
iCount 0)
    {
        if(
iSpeakListType)
        {
            
UpdateDatavalHUD("Players Speaking:%s"SpeakingPlayers);
            
ServerCommand("sm_runvscript speakerhud");
            
//ServerCommand("script_execute speakerhud.nut"); //Try this if the previous command does not work
        
}
        else
        {
            
PrintCenterTextAll("Players Speaking:%s"SpeakingPlayers);
        }
    }
    else
    {
        if(
iSpeakListType)
        {
            
ResetHUD();
            
ServerCommand("sm_runvscript speakerhud");
            
//ServerCommand("script_execute speakerhud.nut"); //Try this if the previous command does not work
        
}
    }
}

void UpdateDatavalHUD(const char[] formatany ...)
{
    
char buffer[200];
    
VFormat(buffersizeof(buffer), format2);

    
SaveVscriptHUD(buffer);
}

void ResetHUD()
{
    
SaveVscriptHUD();
}

void SaveVscriptHUD(const char[] dataval "")
{
    
Handle hFile OpenFile(sPath_VscriptHUD"w");
    if(
hFile)
    {
        
WriteFileLine(hFile"ModeHUD <-");
        
WriteFileLine(hFile"{");
        
WriteFileLine(hFile"    Fields = ");
        
WriteFileLine(hFile"    {");
        if(!
StrEqual(dataval""false))
        {
            
WriteFileLine(hFile"        speaker = ");
            
WriteFileLine(hFile"        {");
            
WriteFileLine(hFile"            slot = g_ModeScript.HUD_MID_BOX,");
            
WriteFileLine(hFile"            dataval = \"%s\","dataval);
            
WriteFileLine(hFile"            flags = g_ModeScript.HUD_FLAG_ALIGN_LEFT | g_ModeScript.HUD_FLAG_NOBG,");
            
WriteFileLine(hFile"            name = \"speaker\" ");
            
WriteFileLine(hFile"        }");
        }
        
WriteFileLine(hFile"    }");
        
WriteFileLine(hFile"}");
        
WriteFileLine(hFile"");
        
WriteFileLine(hFile"HUDSetLayout( ModeHUD )");
        if(!
StrEqual(dataval""false))
        {
            
WriteFileLine(hFile"HUDPlace( g_ModeScript.HUD_MID_BOX , 0.75 , 0.6 , 0.25 , 0.1 )");
        }
        
WriteFileLine(hFile"g_ModeScript");
        
CloseHandle(hFile);
    }

Note that I have tried the plugin "VoiceAnnounceEX" in linux and it has worked well for me. In Windows, I get an error and the server is closed That's because of the DHooks extension I had back then. Now they must have corrected those errors, but the results are better in linux.
Attached Files
File Type: smx l4d2_speakers.smx (7.1 KB, 283 views)
File Type: sp Get Plugin or Get Source (l4d2_speakers.sp - 363 views - 8.2 KB)
__________________
by Aceleración
To succeed in your goals, use your true potential

Last edited by Aceleracion; 12-26-2017 at 15:18. Reason: Fixed clean HUD layout
Aceleracion is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 12-04-2017 , 06:01   Re: game_text l4d2 help
Reply With Quote #48

Quote:
Originally Posted by Aceleracion View Post
If the "VoiceHook" extension in this forum does not work for you, use the "VoiceAnnounceEX" plugin to use the library of this plugin. To plugin l4d2_speakers only the function "OnClientSpeaking" must be changed to "OnClientSpeakingEx".

PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <sdktools>
#include <basecomm>
#include <voiceannounce_ex>

#define PLUGINS_NAME        "l4d2_speakers"
#define PLUGIN_FCVAR        FCVAR_PLUGIN | FCVAR_NOTIFY
#define PLUGIN_VERSION      "1.2"

ConVar cvar_speakerlist_type;
int iSpeakListType;

bool ClientSpeaking[MAXPLAYERS+1];
int iCount;
char SpeakingPlayers[128];

char sPath_VscriptHUD[PLATFORM_MAX_PATH];

public 
Plugin myinfo =
{
    
name PLUGINS_NAME,
    
author "Aceleracion and Emilio3",
    
description "Player Speakers List in Hud",
    
version PLUGIN_VERSION,
    
url "n/a"
}

public 
void OnPluginStart()
{
    
cvar_speakerlist_type CreateConVar("voice_speakerlist_type",  "0""Speaker list type (0: Center text, 1: Hud Layout) [DEFAULT: 0]"PLUGIN_FCVARtrue0.0true1.0);

    
RegAdminCmd("sm_runvscript"Command_RunVscriptADMFLAG_ROOT);

    
HookConVarChange(cvar_speakerlist_typeCvar_Changed);

    
char sPath[PLATFORM_MAX_PATH];
    
strcopy(sPathsizeof(sPath), "scripts/vscripts");
    if(
DirExists(sPath) == false)
    {
        
CreateDirectory(sPath511);
    }

    
Format(sPath_VscriptHUDsizeof(sPath_VscriptHUD), "scripts/vscripts/speakerhud.nut")
    if(
FileExists(sPath_VscriptHUD) == false || FileSize(sPath_VscriptHUD) == 0)
    {
        
SaveVscriptHUD();
    }

    
CreateTimer(0.8UpdateSpeaking_TIMER_REPEAT);
}

public 
void OnClientSpeakingEx(client)
{
    if (
BaseComm_IsClientMuted(client))
    {
        return;
    }
    if (
GetClientListeningFlags(client) == 1)
    {
        return;
    }
    
ClientSpeaking[client] = true;
}

public 
void OnConfigsExecuted()
{
    
GetCvars();
}

public 
void Cvar_Changed(ConVar convar, const char[] oldValue, const char[] newValue)
{
    
GetCvars();
}

void GetCvars()
{
    
iSpeakListType GetConVarInt(cvar_speakerlist_type);
}

public 
Action Command_RunVscript(int clientint args)
{
    if(
args 1)
    {
        return 
Plugin_Handled;
    }

    
char vscriptFile[40];
    
GetCmdArg(1vscriptFilesizeof(vscriptFile));

    
int entity CreateEntityByName("logic_script");
    if( 
entity != -)
    {
        
DispatchKeyValue(entity"vscripts"vscriptFile);
        
DispatchSpawn(entity);
        
SetVariantString("OnUser1 !self:RunScriptCode::0:-1");
        
AcceptEntityInput(entity"AddOutput");
        
SetVariantString("OnUser1 !self:Kill::1:-1");
        
AcceptEntityInput(entity"AddOutput");
        
AcceptEntityInput(entity"FireUser1");
    }
    return 
Plugin_Handled;
}

public 
Action UpdateSpeaking(Handle timer)
{
    
iCount 0;
    
SpeakingPlayers[0] = '\0';
    for (
int i 1<= MaxClientsi++)
    {
        if (
ClientSpeaking[i])
        {
            if (!
IsClientInGame(i)) continue;
            
            if(
iSpeakListType)
            {
                
Format(SpeakingPlayerssizeof(SpeakingPlayers), "%s\\n> %N"SpeakingPlayersi);
            }
            else
            {
                
Format(SpeakingPlayerssizeof(SpeakingPlayers), "%s\n%N"SpeakingPlayersi);
            }
            
iCount++;
        }
        
ClientSpeaking[i] = false;
    }
    if (
iCount 0)
    {
        if(
iSpeakListType)
        {
            
UpdateDatavalHUD("Players Speaking:%s"SpeakingPlayers);
            
ServerCommand("sm_runvscript speakerhud");
            
//ServerCommand("script_execute speakerhud.nut"); //Try this if the previous command does not work
        
}
        else
        {
            
PrintCenterTextAll("Players Speaking:%s"SpeakingPlayers);
        }
    }
    else
    {
        if(
iSpeakListType)
        {
            
ResetHUD();
            
ServerCommand("sm_runvscript speakerhud");
            
//ServerCommand("script_execute speakerhud.nut"); //Try this if the previous command does not work
        
}
    }
}

void UpdateDatavalHUD(const char[] formatany ...)
{
    
char buffer[200];
    
VFormat(buffersizeof(buffer), format2);

    
SaveVscriptHUD(buffer);
}

void ResetHUD()
{
    
SaveVscriptHUD();
}

void SaveVscriptHUD(const char[] dataval "")
{
    
Handle hFile OpenFile(sPath_VscriptHUD"w");
    if(
hFile)
    {
        
WriteFileLine(hFile"ModeHUD <-");
        
WriteFileLine(hFile"{");
        
WriteFileLine(hFile"    Fields = ");
        
WriteFileLine(hFile"    {");
        if(!
StrEqual(dataval""false))
        {
            
WriteFileLine(hFile"        speaker = ");
            
WriteFileLine(hFile"        {");
            
WriteFileLine(hFile"            slot = g_ModeScript.HUD_MID_BOX,");
            
WriteFileLine(hFile"            dataval = \"%s\","dataval);
            
WriteFileLine(hFile"            flags = g_ModeScript.HUD_FLAG_ALIGN_LEFT | g_ModeScript.HUD_FLAG_NOBG,");
            
WriteFileLine(hFile"            name = \"speaker\" ");
            
WriteFileLine(hFile"        }");
        }
        
WriteFileLine(hFile"    }");
        
WriteFileLine(hFile"}");
        
WriteFileLine(hFile"");
        
WriteFileLine(hFile"HUDSetLayout( ModeHUD )");
        if(!
StrEqual(dataval""false))
        {
            
WriteFileLine(hFile"HUDPlace( g_ModeScript.HUD_MID_BOX , 0.75 , 0.6 , 0.25 , 0.1 )");
        }
        
WriteFileLine(hFile"g_ModeScript");
        
CloseHandle(hFile);
    }

Note that I have tried the plugin "VoiceAnnounceEX" in linux and it has worked well for me. In Windows, I get an error and the server is closed That's because of the DHooks extension I had back then. Now they must have corrected those errors, but the results are better in linux.
Thank you. I will try this out as soon as possible!

EDIT: It works!
__________________

Last edited by Psyk0tik; 12-08-2017 at 20:39.
Psyk0tik 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 18:58.


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