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

>> CSGO Center Print


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 07-28-2015 , 15:27   >> CSGO Center Print
Reply With Quote #1

Can I reproduce somehow with a SourceMod plug-in the centered message "MATCH WILL RESTART IN %"?

Minute 10:49

claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
ecca
Sexy Santa
Join Date: Jan 2011
Old 07-28-2015 , 15:35   Re: >> CSGO Center Print
Reply With Quote #2

ESEA emitts center messages from their client, not possible with sourcemod.

The "match restarting in" you see on the screen here is from command mp_restartgame x where x is number of seconds before restart is triggered, the game itself shows that countdown. Also the message triggered by this command isn't editable without changing gamefiles i think.
__________________

Last edited by ecca; 07-28-2015 at 15:38.
ecca is offline
Wilczek
AlliedModders Donor
Join Date: Oct 2012
Location: Poland
Old 07-28-2015 , 15:50   Re: >> CSGO Center Print
Reply With Quote #3

You mean the top or the bottom message?

If the latter, it's pretty easy:
PHP Code:
for (new 1<= MaxClientsi++)
{
   if(
IsClientInGame(i) && !IsFakeClient(i))
       
PrintCenterText(i"%t""String");

__________________
Wilczek is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-28-2015 , 16:40   Re: >> CSGO Center Print
Reply With Quote #4

Quote:
Originally Posted by ecca View Post
The "match restarting in" you see on the screen here is from command mp_restartgame x where x is number of seconds before restart is triggered, the game itself shows that countdown. Also the message triggered by this command isn't editable without changing gamefiles i think.
It may just be a TextMsg usermessage, which has an option for center text.

Granted, you'd need to know which translation phrase it is.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Dr. Api
BANNED
Join Date: Mar 2015
Location: France
Old 07-28-2015 , 17:09   Re: >> CSGO Center Print
Reply With Quote #5

I saw a hunger game server with a message a the top and this message was shaking and changing color too.
Usermessage should do the trick.
Dr. Api is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 07-28-2015 , 18:32   Re: >> CSGO Center Print
Reply With Quote #6

Quote:
Originally Posted by Wilczek View Post
You mean the top or the bottom message?

If the latter, it's pretty easy:
PHP Code:
for (new 1<= MaxClientsi++)
{
   if(
IsClientInGame(i) && !IsFakeClient(i))
       
PrintCenterText(i"%t""String");

This will print a hint-text message.

Quote:
Originally Posted by Powerlord View Post
It may just be a TextMsg usermessage, which has an option for center text.

Granted, you'd need to know which translation phrase it is.
Can you give me an example of how I can call that function?
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-28-2015 , 19:35   Re: >> CSGO Center Print
Reply With Quote #7

Quote:
Originally Posted by claudiuhks View Post
Can you give me an example of how I can call that function?
I don't know if this is valid for CS:GO, but for TF2... say I wanted to print that a player had been autobalanced to the other team.

Code:
	decl String:name[MAX_NAME_LENGTH+1];
	GetClientName(client, name, sizeof(name));
	
	PrintValveTranslationToAll(HUD_PRINTTALK, "#game_player_was_team_balanced", name);
In this case, HUD_PRINTTALK was the destination (chat), "#game_player_was_team_balanced" is the name of the translation string in TF2 prefixed with a #, and name is the first argument to that translation string.

If you pass in a translation string, it will need # in front of it... you can even use a translation string as an argument, such as in this next example:

Code:
		new String:streakString[4];
		GetConVarString(g_Cvar_Arena_Streak, streakString, sizeof(streakString));
		
		new String:teamName[4];
		if (winningTeam == _:TFTeam_Red)
		{
			teamName = "#TF_RedTeam_Name";
		}
		else if (winningTeam == _:TFTeam_Blue)
		{
			teamName = "#TF_BlueTeam_Name";
		}
		
		PrintValveTranslationToAll(HUD_PRINTTALK, "#TF_Arena_MaxStreak", teamName, streakString);
In this case, HUD_PRINTTALK is the destination, "#TF_Arena_MaxStreak" is the translation string prefixed with a #, teamName is the first argument to TF_Arena_MaxStreak and is ALSO a translation string prefixed with a #, and streakString is the second argument.

(winningTeam really should be a TFTeam value but is actually an int. One day I'll fix this in the plugin's next version.)
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 07-28-2015 at 19:36.
Powerlord is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 07-29-2015 , 01:46   Re: >> CSGO Center Print
Reply With Quote #8

Quote:
Originally Posted by Powerlord View Post
It may just be a TextMsg usermessage, which has an option for center text.

Granted, you'd need to know which translation phrase it is.
I found this
Code:
		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		//Notice Text
		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


		"SFUI_Notice_Alert_Match_Point"					"MATCH POINT"
		"SFUI_Notice_Alert_Final_Round"					"FINAL ROUND"
		"SFUI_Notice_Alert_Last_Round_Half"				"LAST ROUND OF FIRST HALF"
		"SFUI_Notice_Alert_Warmup_Period"				"WARMUP %s1"
		"SFUI_Notice_Alert_Warmup_Period_Ending"		"WARMUP ENDING %s1"
		"SFUI_Notice_Alert_Waiting_For_Players"			"WAITING FOR PLAYERS %s1"
		"SFUI_Notice_Alert_Match_Starting_In"			"<font color='#C6E075'>MATCH STARTING IN %s1...</font>"
		"SFUI_Notice_Alert_Match_Starting"			"<font color='#C6E075'>MATCH STARTING</font>"
		"SFUI_Notice_Alert_Match_Restarting_In"			"<font color='#C6E075'>MATCH RESTARTING IN %s1...</font>"
		"SFUI_Notice_Alert_Match_Restarting"			"<font color='#C6E075'>MATCH RESTARTING</font>"
		"SFUI_Notice_Alert_Match_Start"					"MATCH START"
		"SFUI_Notice_Alert_Freeze_Pause"				"MATCH PAUSED"
Seems that is called "Notice Text"


I am testing it. Test code:
PHP Code:
#include <sourcemod>

#define HUD_PRINTNOTIFY        1
#define HUD_PRINTCONSOLE    2
#define HUD_PRINTTALK        3
#define HUD_PRINTCENTER        4

public OnPluginStart()
{
    
RegConsoleCmd("sm_testa"Testa);
}

public 
Action:Testa(clientargs)
{
    
PrintValveTranslationToOne(clientHUD_PRINTTALK"#SFUI_Notice_Alert_Match_Restarting");
}

// Print a Valve translation phrase to a group of players
// Adapted from util.h's UTIL_PrintToClientFilter
stock PrintValveTranslation(clients[],
                            
numClients,
                            
msg_dest,
                            const 
String:msg_name[],
                            const 
String:param1[]="",
                            const 
String:param2[]="",
                            const 
String:param3[]="",
                            const 
String:param4[]="")
{
    new 
Handle:bf StartMessage("TextMsg"clientsnumClientsUSERMSG_RELIABLE);
    
    if (
GetUserMessageType() == UM_Protobuf)
    {
        
PbSetInt(bf"msg_dest"msg_dest);
        
PbAddString(bf"params"msg_name);
        
        
PbAddString(bf"params"param1);
        
PbAddString(bf"params"param2);
        
PbAddString(bf"params"param3);
        
PbAddString(bf"params"param4);
    }
    else
    {
        
BfWriteByte(bfmsg_dest);
        
BfWriteString(bfmsg_name);
        
        
BfWriteString(bfparam1);
        
BfWriteString(bfparam2);
        
BfWriteString(bfparam3);
        
BfWriteString(bfparam4);
    }
    
    
EndMessage();
}  

stock PrintValveTranslationToAll(msg_dest,
                                const 
String:msg_name[],
                                const 
String:param1[]="",
                                const 
String:param2[]="",
                                const 
String:param3[]="",
                                const 
String:param4[]="")
{
    new 
total 0;
    new 
clients[MaxClients];
    for (new 
i=1i<=MaxClientsi++)
    {
        if (
IsClientConnected(i))
        {
            
clients[total++] = i;
        }
    }
    
PrintValveTranslation(clientstotalmsg_destmsg_nameparam1param2param3param4);
}

stock PrintValveTranslationToOne(client,
                                
msg_dest,
                                const 
String:msg_name[],
                                const 
String:param1[]="",
                                const 
String:param2[]="",
                                const 
String:param3[]="",
                                const 
String:param4[]="")
{
    new 
players[1];
    
    
players[0] = client;
    
    
PrintValveTranslation(players1msg_destmsg_nameparam1param2param3param4);

Log error and server crash:
Code:
L 07/29/2015 - 07:20:11: [SM] Native "PbSetInt" reported: Invalid field "msg_dest" for message "CCSUsrMsg_TextMsg"
L 07/29/2015 - 07:20:11: [SM] Displaying call stack trace for plugin "alert_test.smx":
L 07/29/2015 - 07:20:11: [SM]   [0]  Line 33, alert_test.sp::PrintValveTranslation()
L 07/29/2015 - 07:20:11: [SM]   [1]  Line 86, alert_test.sp::PrintValveTranslationToOne()
L 07/29/2015 - 07:20:11: [SM]   [2]  Line 15, alert_test.sp::Testa()
L 07/29/2015 - 07:20:13: [SM] Native "PrintToChat" reported: Could not send a usermessage

I also tried with
Code:
new Handle:bf = StartMessage("NoticeText", players, 1, USERMSG_RELIABLE);
Seems to not exist:
Code:
L 07/29/2015 - 07:35:29: [SM] Native "StartMessage" reported: Invalid message name: "NoticeText"
L 07/29/2015 - 07:35:29: [SM] Displaying call stack trace for plugin "alert_test.smx":
L 07/29/2015 - 07:35:29: [SM]   [0]  Line 18, alert_test.sp::Testa()

I will continue testing it
__________________
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.

Franc1sco is offline
Send a message via MSN to Franc1sco
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 07-29-2015 , 06:43   Re: >> CSGO Center Print
Reply With Quote #9

Code:
L 07/29/2015 - 07:20:11: [SM] Native "PbSetInt" reported: Invalid field "msg_dest" for message "CCSUsrMsg_TextMsg"
It probably means that msg_dest is not a valid field for CSGO's TextMsg message.
Try not to use PbSetInt(..., "msg_dest", ...) anymore. We must figure it out somehow, about what fields we need for CSGO's TextMsg message.

Last edited by claudiuhks; 07-29-2015 at 06:43.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-29-2015 , 09:18   Re: >> CSGO Center Print
Reply With Quote #10

Whoops, it's "msg_dst" instead of msg_dest in CS:GO.

Probably a typo from when I originally wrote it.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 07-29-2015 at 09:18.
Powerlord 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 04:07.


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