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

Solved game_text l4d2 help


Post New Thread Reply   
 
Thread Tools Display Modes
psychonic

BAFFLED
Join Date: May 2008
Old 11-27-2017 , 08:06   Re: game_text l4d2 help
Reply With Quote #21

You don't need to use VScript to use that HUD. You can do it from SourceMod.
psychonic is offline
Emilio3
Member
Join Date: Aug 2013
Location: London UK
Old 11-27-2017 , 19:38   Re: game_text l4d2 help
Reply With Quote #22

Quote:
Originally Posted by Aceleracion View Post
You could do with VScripts what you want, if you know how to program in Squirrel.

More information: https://developer.valvesoftware.com/wiki/L4D2_Vscripts

Another way would be to modify the file to be an entity script. Then when the player is talking, modify the line of code that contains the data item "dataval", putting the name of the player, and then do a quick reload of the script.
i dont know to do for my speaker plugin read the vscripts
if you give me small help im gratefull

spanish: aceleracion no se como hacerlo pero me printa en el centro del server y me gustaria ke me printara a la derecha abajo. ayudame si tu sabes como conseguirlo, y gracias amigo por resolver el statico logo

PHP Code:
#include <sourcemod>

forward OnClientSpeaking(client);

public 
Extension:__ext_voice 
{
    
name "VoiceHook",
    
file "VoiceHook.ext",
    
autoload 1,
    
required 1,
}

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

public 
void OnPluginStart()
{
    
CreateTimer(0.7UpdateSpeaking_TIMER_REPEAT);
}

public 
OnClientSpeaking(client)
{
    
ClientSpeaking[client] = true;
}

public 
Action UpdateSpeaking(Handle timer)
{
    
iCount 0;
    
SpeakingPlayers[0] = '\0';
    for (
int i 1<= MaxClientsi++)
    {
        if (
ClientSpeaking[i])
        {
            if (!
IsClientInGame(i)) continue;
            
            
Format(SpeakingPlayerssizeof(SpeakingPlayers), "%s\n%N"SpeakingPlayersi);
            
iCount++;
        }
        
ClientSpeaking[i] = false;
    }
    if (
iCount 0)
    {
        for (
int i 1<= MaxClientsi++)
        {
            
PrintCenterText(i"Players Speaking:%s"SpeakingPlayers);
        }
    }


Last edited by Emilio3; 11-27-2017 at 19:52.
Emilio3 is offline
Emilio3
Member
Join Date: Aug 2013
Location: London UK
Old 11-27-2017 , 19:41   Re: game_text l4d2 help
Reply With Quote #23

Quote:
Originally Posted by psychonic View Post
You don't need to use VScript to use that HUD. You can do it from SourceMod.
i try to many diferents ways making in sourcemod but still not working
show me the way if you know to do

Last edited by Emilio3; 11-27-2017 at 19:44.
Emilio3 is offline
psychonic

BAFFLED
Join Date: May 2008
Old 11-27-2017 , 21:12   Re: game_text l4d2 help
Reply With Quote #24

There are gamerules netprops for all parts of it.
psychonic is offline
Aceleracion
Member
Join Date: Jul 2017
Location: Ecuador
Old 11-27-2017 , 21:22   Re: game_text l4d2 help
Reply With Quote #25

Quote:
Originally Posted by psychonic View Post
You don't need to use VScript to use that HUD. You can do it from SourceMod.
I'm sorry but for left 4 dead 2 the Sourcemod's HudSynchronizer method does not work, neither when creating entities for the HUD of this game, nor generating User's HUD messages with StartMessage. Left 4 dead 2 is a special case. I researched about it, and I do not know another solution.

Greetings.
__________________
by Aceleración
To succeed in your goals, use your true potential
Aceleracion is offline
Aceleracion
Member
Join Date: Jul 2017
Location: Ecuador
Old 11-28-2017 , 00:31   Re: game_text l4d2 help
Reply With Quote #26

Quote:
Originally Posted by Emilio3 View Post
i dont know to do for my speaker plugin read the vscripts
if you give me small help im gratefull

spanish: aceleracion no se como hacerlo pero me printa en el centro del server y me gustaria ke me printara a la derecha abajo. ayudame si tu sabes como conseguirlo, y gracias amigo por resolver el statico logo

PHP Code:
#include <sourcemod>

forward OnClientSpeaking(client);

public 
Extension:__ext_voice 
{
    
name "VoiceHook",
    
file "VoiceHook.ext",
    
autoload 1,
    
required 1,
}

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

public 
void OnPluginStart()
{
    
CreateTimer(0.7UpdateSpeaking_TIMER_REPEAT);
}

public 
OnClientSpeaking(client)
{
    
ClientSpeaking[client] = true;
}

public 
Action UpdateSpeaking(Handle timer)
{
    
iCount 0;
    
SpeakingPlayers[0] = '\0';
    for (
int i 1<= MaxClientsi++)
    {
        if (
ClientSpeaking[i])
        {
            if (!
IsClientInGame(i)) continue;
            
            
Format(SpeakingPlayerssizeof(SpeakingPlayers), "%s\n%N"SpeakingPlayersi);
            
iCount++;
        }
        
ClientSpeaking[i] = false;
    }
    if (
iCount 0)
    {
        for (
int i 1<= MaxClientsi++)
        {
            
PrintCenterText(i"Players Speaking:%s"SpeakingPlayers);
        }
    }


I had the idea of doing it this way, but I have not tried it so I do not know if it will work. It is already warned.

VScript by default: "speakerhud.nut"
Code:
HUDTable <-
{
    Fields = 
    {
        speak = 
        {
            slot = HUD_MID_BOX,
            dataval = "",
            flags = HUD_FLAG_ALIGN_LEFT| HUD_FLAG_NOBG,
            name = "speak" 
        }
    }
}

HUDSetLayout(HUDTable)
HUDPlace(HUD_MID_BOX, 0.8 , 0.5 , 0.2 , 0.1)
//g_RoundState
The plugin should create it by default, but since I have not tried xdd.

PHP Code:
#include <sourcemod>

forward OnClientSpeaking(client);

public 
Extension:__ext_voice 
{
    
name "VoiceHook",
    
file "VoiceHook.ext",
    
autoload 1,
    
required 1,
}

ConVar cvar_speakerlist_type;
int iSpeakListType;

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

char sPath_VscriptHUD[PLATFORM_MAX_PATH];

public 
void OnPluginStart()
{
    
cvar_speakerlist_type CreateConVar("l4d2_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.7UpdateSpeaking_TIMER_REPEAT);
}

public 
OnClientSpeaking(client)
{
    
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
        {
            for (
int i 1<= MaxClientsi++)
            {
                
PrintCenterText(i"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"HUDTable <-");
        
WriteFileLine(hFile"{");
        
WriteFileLine(hFile"    Fields = ");
        
WriteFileLine(hFile"    {");
        
WriteFileLine(hFile"        speak = ");
        
WriteFileLine(hFile"        {");
        
WriteFileLine(hFile"            slot = HUD_MID_BOX,");
        if(!
StrEqual(dataval""))
        {
            
WriteFileLine(hFile"            dataval = \"%s\","dataval);
        }
        
WriteFileLine(hFile"            flags = HUD_FLAG_ALIGN_LEFT| HUD_FLAG_NOBG,");
        
WriteFileLine(hFile"            name = \"speak\"");
        
WriteFileLine(hFile"        }");
        
WriteFileLine(hFile"    }");
        
WriteFileLine(hFile"}");
        
WriteFileLine(hFile"HUDSetLayout(HUDTable)");
        
WriteFileLine(hFile"HUDPlace(HUD_MID_BOX, 0.8 , 0.5 , 0.2 , 0.1)");
        
//WriteFileLine(hFile, "g_RoundState");
        
CloseHandle(hFile);
    }

I upload the beta plugin that I have made.
Attached Files
File Type: sp Get Plugin or Get Source (speakerlisthud.sp - 207 views - 5.1 KB)
__________________
by Aceleración
To succeed in your goals, use your true potential
Aceleracion is offline
Emilio3
Member
Join Date: Aug 2013
Location: London UK
Old 11-28-2017 , 09:01   Re: game_text l4d2 help
Reply With Quote #27

Quote:
Originally Posted by Aceleracion View Post
I had the idea of doing it this way, but I have not tried it so I do not know if it will work. It is already warned.

VScript by default: "speakerhud.nut"
Code:
HUDTable <-
{
    Fields = 
    {
        speak = 
        {
            slot = HUD_MID_BOX,
            dataval = "",
            flags = HUD_FLAG_ALIGN_LEFT| HUD_FLAG_NOBG,
            name = "speak" 
        }
    }
}

HUDSetLayout(HUDTable)
HUDPlace(HUD_MID_BOX, 0.8 , 0.5 , 0.2 , 0.1)
//g_RoundState
The plugin should create it by default, but since I have not tried xdd.

PHP Code:
#include <sourcemod>

forward OnClientSpeaking(client);

public 
Extension:__ext_voice 
{
    
name "VoiceHook",
    
file "VoiceHook.ext",
    
autoload 1,
    
required 1,
}

ConVar cvar_speakerlist_type;
int iSpeakListType;

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

char sPath_VscriptHUD[PLATFORM_MAX_PATH];

public 
void OnPluginStart()
{
    
cvar_speakerlist_type CreateConVar("l4d2_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.7UpdateSpeaking_TIMER_REPEAT);
}

public 
OnClientSpeaking(client)
{
    
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
        {
            for (
int i 1<= MaxClientsi++)
            {
                
PrintCenterText(i"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"HUDTable <-");
        
WriteFileLine(hFile"{");
        
WriteFileLine(hFile"    Fields = ");
        
WriteFileLine(hFile"    {");
        
WriteFileLine(hFile"        speak = ");
        
WriteFileLine(hFile"        {");
        
WriteFileLine(hFile"            slot = HUD_MID_BOX,");
        if(!
StrEqual(dataval""))
        {
            
WriteFileLine(hFile"            dataval = \"%s\","dataval);
        }
        
WriteFileLine(hFile"            flags = HUD_FLAG_ALIGN_LEFT| HUD_FLAG_NOBG,");
        
WriteFileLine(hFile"            name = \"speak\"");
        
WriteFileLine(hFile"        }");
        
WriteFileLine(hFile"    }");
        
WriteFileLine(hFile"}");
        
WriteFileLine(hFile"HUDSetLayout(HUDTable)");
        
WriteFileLine(hFile"HUDPlace(HUD_MID_BOX, 0.8 , 0.5 , 0.2 , 0.1)");
        
//WriteFileLine(hFile, "g_RoundState");
        
CloseHandle(hFile);
    }

I upload the beta plugin that I have made.
i try but still not working
PHP Code:
logic_script executing scriptspeakerhud

AN ERROR HAS OCCURED 
[the index 'HUD_MID_BOX' does not exist]

CALLSTACK
*FUNCTION [main()] c:/serverl4d2/left4dead2/left4dead2/scripts/vscripts/speakerhud.nut line [1]

LOCALS
[vargv] ARRAY
[
thisTABLE
SCRIPT PERF WARNING 
--- "main" ran long at 5.162896ms 
Attached Files
File Type: sp Get Plugin or Get Source (speakerlisthud.sp - 827 views - 5.1 KB)
File Type: smx speakerlisthud.smx (6.5 KB, 455 views)

Last edited by Emilio3; 11-29-2017 at 05:42.
Emilio3 is offline
psychonic

BAFFLED
Join Date: May 2008
Old 11-28-2017 , 11:24   Re: game_text l4d2 help
Reply With Quote #28

Quote:
Originally Posted by Aceleracion View Post
I'm sorry but for left 4 dead 2 the Sourcemod's HudSynchronizer method does not work, neither when creating entities for the HUD of this game, nor generating User's HUD messages with StartMessage. Left 4 dead 2 is a special case. I researched about it, and I do not know another solution.

Greetings.
I wasn't referring to HudText/HudSynchronizer. I was referring to the EMS scripting HUD.
psychonic is offline
Aceleracion
Member
Join Date: Jul 2017
Location: Ecuador
Old 11-28-2017 , 13:27   Re: game_text l4d2 help
Reply With Quote #29

Quote:
Originally Posted by Emilio3 View Post
i try but still not working
PHP Code:
logic_script executing scriptspeakerhud

AN ERROR HAS OCCURED 
[the index 'HUD_MID_BOX' does not exist]

CALLSTACK
*FUNCTION [main()] c:/serverl4d2/left4dead2/left4dead2/scripts/vscripts/speakerhud.nut line [1]

LOCALS
[vargv] ARRAY
[
thisTABLE
SCRIPT PERF WARNING 
--- "main" ran long at 5.162896ms 
Change the value of HUD_MID_BOX to HUD_MID_BOT and try again.
Attached Files
File Type: sp Get Plugin or Get Source (speakerlisthud.sp - 237 views - 5.1 KB)
__________________
by Aceleración
To succeed in your goals, use your true potential
Aceleracion is offline
Aceleracion
Member
Join Date: Jul 2017
Location: Ecuador
Old 11-28-2017 , 13:31   Re: game_text l4d2 help
Reply With Quote #30

Quote:
Originally Posted by psychonic View Post
I wasn't referring to HudText/HudSynchronizer. I was referring to the EMS scripting HUD.
The HUD of "EMS", I do it with vscripts. I do not know if there is how to do it from sourcemod. If you know, let them know.

Greetings.
__________________
by Aceleración
To succeed in your goals, use your true potential
Aceleracion 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 05:31.


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