hud modification

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Потребителски аватар

Автор на темата
esc-Fiv3
Foreigner
Foreigner
Мнения: 110
Регистриран: 24 ное 2018, 19:19
Се отблагодари: 16 пъти

hud modification

Мнение от esc-Fiv3 » 07 яну 2019, 15:12

Hello, can someone help me to edit this hud plugin? Like in this photo? I change the name of team after..just need the same colors and the text to be the same, with the same position.. And there is a problem when you are dead, the hud message apears a bit down, not in the same position..I think is not very well coded. And when you are spec, it doesn't appear. Thanks!

https://i.imgur.com/7BzfTRw.jpg

Код: Избери всички

/* Plugin generated by AMXX-Studio */

	#include < amxmodx >
	#include < dhudmessage >
	
	#pragma semicolon 1

		// --| Credite lui CryWolf pentru 'layout' !!
	new const
		PLUGIN_NAME[ ] 		= "Furien Score & Round",
		PLUGIN_VERSION[ ] 	= "0.2.1";
	
	/* Copyright (c) 2013 Askhanar  @eXtreamCS.com
	
	www.eXtreamCS.com/forum
	www.amxmodx.org
	www.amxmodx.ro
	
	*/
	
	
	// --| Culorile in RRR GGG BBB ( poate fi luata si in paint ).
	// --| Aici sunt culorile de la mesajele: Furien  AntiFurien si Round
	
	#define	iNameRed	0
	#define	iNameGreen	255
	#define	iNameBlue	191
	
	// --| Culorile in RRR GGG BBB ( poate fi luata si in paint ).
	// --| Aici sunt culorile de la mesajele: numarul de castiguri si runde.
	
	#define	iScoreRed	255
	#define	iScoreGreen	255
	#define	iScoreBlue	255
	
	new const
		g_szTeamsMessage[ ] 	= "    |-  Mutants           Defenders  -|    ",
		g_szScoreMessage[ ]	= "%02i                                                %02i",
		g_szRoundMessage[ ]	= "                  Round                     ",
		g_szRound[ ]		= "                    %02i                       ";
		
		
	enum _:iTeamWons
	{
		FURIEN,
		ANTIFURIEN
	}
	
	new g_iTeamWons[ iTeamWons ];
	new g_iRounds;
	
	new SyncHudTeamNames, SyncHudTeamScore;
			
				
public plugin_init( )
{
	
	register_plugin( PLUGIN_NAME, PLUGIN_VERSION, "Askhanar" );
	
	
	register_event( "HLTV", "ev_NewRound", "a", "1=0", "2=0" );
	register_event( "TextMsg", "ev_RoundRestart", "a", "2&#Game_C", "2&#Game_w" );
	
	register_event( "SendAudio", "ev_TerroristWin", "a", "2&%!MRAD_terwin" );
	register_event( "SendAudio", "ev_CtWin", "a", "2&%!MRAD_ctwin" );
	
	g_iRounds = 0;
	g_iTeamWons[ FURIEN ] = 0;
	g_iTeamWons[ ANTIFURIEN ] = 0;
	
	SyncHudTeamNames = CreateHudSyncObj( );
	SyncHudTeamScore = CreateHudSyncObj( );
	
	
	set_task( 1.0, "task_DisplayHudScore", _, _, _, "b", 0 );
	// Add your code here...
}


public ev_NewRound( )		g_iRounds++;
public ev_RoundRestart( )	{	g_iRounds = 0;	g_iTeamWons[ FURIEN ] = 0;	g_iTeamWons[ ANTIFURIEN ] = 0;	}
public ev_TerroristWin( )	g_iTeamWons[ FURIEN ]++;
public ev_CtWin( )	g_iTeamWons[ ANTIFURIEN ]++;

public task_DisplayHudScore( )
{
	static iPlayers[ 32 ];
	static iPlayersNum;
		
	get_players( iPlayers, iPlayersNum, "ch" );
	if( !iPlayersNum )
		return;
		
	static id, i;
	for( i = 0; i < iPlayersNum; i++ )
	{
		id = iPlayers[ i ];
		
		if( 1 <= get_user_team( id ) <= 3 )
		{
			set_dhudmessage( iNameRed, iNameGreen, iNameBlue, -1.0, is_user_alive( id ) ? 0.01 : 0.16 , 0, _, 1.0, _, _, 2 );
			show_dhudmessage( id, SyncHudTeamNames, g_szTeamsMessage );
			
			set_dhudmessage( iScoreRed, iScoreGreen, iScoreBlue, -1.0, is_user_alive( id ) ? 0.01 : 0.16 , 0, _, 1.0, _, _, 3 );
			show_dhudmessage( id, SyncHudTeamScore, g_szScoreMessage,  g_iTeamWons[ FURIEN ], g_iTeamWons[ ANTIFURIEN ]  );
			
			
			set_dhudmessage( iNameRed, iNameGreen, iNameBlue, -1.0, is_user_alive( id ) ? 0.03 : 0.18 , 0, _, 1.0, _, _ );
			show_dhudmessage( id, g_szRoundMessage );
			
			set_dhudmessage( iScoreRed, iScoreGreen, iScoreBlue, -1.0, is_user_alive( id ) ? 0.06 : 0.21 , 0, _, 1.0, _, _ );
			show_dhudmessage( id, g_szRound, g_iRounds );
		}
	
	}
}

Потребителски аватар

OciXCrom TM
Администратор
Администратор
Мнения: 5285
Регистриран: 06 окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 73 пъти
Получена благодарност: 541 пъти
Години: 21
Контакти:

hud modification

Мнение от OciXCrom TM » 07 яну 2019, 16:33

The plugin won't even compile, the person who wrote it doesn't have a clue how DHUD message work. I rewritten it (not tested):

Код: Избери всички

#include <amxmodx>

#if AMXX_VERSION_NUM < 183
	#include <dhudmessage>
#endif

new g_iTScore, g_iCTScore, g_iRounds

public plugin_init()
{
	register_plugin("Score & Round", "1.0", "OciXCrom")
	register_event("HLTV", "OnRoundStart", "a", "1=0", "2=0")
	register_event("TextMsg", "OnRoundRestart", "a", "2&#Game_C", "2&#Game_w")
	register_event("SendAudio", "OnTerroristWin", "a", "2&%!MRAD_terwin")
	register_event("SendAudio", "OnCTWin", "a", "2&%!MRAD_ctwin" )
	set_task(1.0, "ShowInfo", .flags = "b")
}

public OnRoundStart()
	g_iRounds++

public OnRoundRestart()
{
	g_iRounds = 0
	g_iTScore = 0
	g_iCTScore = 0
}

public OnTerroristWin()
	g_iTScore++

public OnCTWin()
	g_iCTScore++

public ShowInfo()
{
	set_dhudmessage(0, 255, 255, 0.3, 0.05, _, _, 1.0)
	show_dhudmessage(0, "SANTA [%i]", g_iCTScore)

	set_dhudmessage(255, 0, 0, 0.7, 0.05, _, _, 1.0)
	show_dhudmessage(0, "[%i] GRINCH", g_iTScore)

	set_dhudmessage(255, 255, 255, -1.0, 0.05, _, _, 1.0)
	show_dhudmessage(0, "vs^nRound %i", g_iRounds)
}

Потребителски аватар

Автор на темата
esc-Fiv3
Foreigner
Foreigner
Мнения: 110
Регистриран: 24 ное 2018, 19:19
Се отблагодари: 16 пъти

hud modification

Мнение от esc-Fiv3 » 07 яну 2019, 17:16

It works but it looks like this: https://imgur.com/a/qzez5Ct
There is a lot of space between santa vs grinch

Потребителски аватар

OciXCrom TM
Администратор
Администратор
Мнения: 5285
Регистриран: 06 окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 73 пъти
Получена благодарност: 541 пъти
Години: 21
Контакти:

hud modification

Мнение от OciXCrom TM » 07 яну 2019, 17:32

Lines 37 and 40 - modify the numbers 0.3 and 0.7 until you get the right position.
Increasing 0.3 will move SANTA to the right.
Decreasing 0.7 will move GRINCH to the left.

Потребителски аватар

Автор на темата
esc-Fiv3
Foreigner
Foreigner
Мнения: 110
Регистриран: 24 ное 2018, 19:19
Се отблагодари: 16 пъти

hud modification

Мнение от esc-Fiv3 » 07 яну 2019, 18:07

I tried everything. It doesn't allow you to make it like this GRINCH [0] VS [0] SANTA . It makes a lot of space betweend 0 and 0. Semms to be like VS block it
Anyway..it looks like this: https://imgur.com/a/0yewuGN
but there are some little problems with the message, 1.every round is rewrited everything
2. when tero make a kill the message is rewritted and if the ct make a kill it just change the score.
It works perfect when you are spec. I mean the hud message is static and it changes only the score and the round number

Потребителски аватар

OciXCrom TM
Администратор
Администратор
Мнения: 5285
Регистриран: 06 окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 73 пъти
Получена благодарност: 541 пъти
Години: 21
Контакти:

hud modification

Мнение от OciXCrom TM » 07 яну 2019, 22:04

0.3, 0.4, 0.5 are not the only avilable numbers. You can also do 0.31, 0.32. 0,39, 0.45, etc for smaller movements. It's not possible to perfectly align the messages and they'll look different on different resolutions, so better leave more space between them rather than having them very close to each other.

For example, 0.4 with 0.51 works perfectly for my resolution - https://i.imgur.com/kQAciBH.jpg

What do you mean every round everything is rewritten?
If the terrorists win the round, the GRINCH score is increased by 1.
If the CTs win the round, the SANTA score is increased by 1.
When a new round starts, the number of rounds is increased by 1.
If the round is restarted with sv_restartround or the "game commencing" message appears - the score and round will be reset to 0.

It doesn't matter if you're a spectator, dead or alive - the message is displayed for all players unlike the original plugin you used. I just tested it and everything's working fine.

Потребителски аватар

Автор на темата
esc-Fiv3
Foreigner
Foreigner
Мнения: 110
Регистриран: 24 ное 2018, 19:19
Се отблагодари: 16 пъти

hud modification

Мнение от esc-Fiv3 » 08 яну 2019, 10:57

Well you are right, maybe I keep it with a little space between.
About "rewritten" I want to say that when the round starts again it appear again that score hud. Every letter is rewritted. I don't know why it happens. Maybe it is because of the other hud messages? I have CT/T win message and xp hud message which is permanently (your plugin)

And on the terro score it happens everytime when there is added +1 to score, the sentence: SANTA [0] is rewritted with SANTA [1]. The whole sentence, not only the score is changed.

Video: https://streamable.com/6htcy

Потребителски аватар

OciXCrom TM
Администратор
Администратор
Мнения: 5285
Регистриран: 06 окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 73 пъти
Получена благодарност: 541 пъти
Години: 21
Контакти:

hud modification

Мнение от OciXCrom TM » 08 яну 2019, 15:57

Yes, it's because you have too many messages on your screen. You can have only 8 DHUD messages on the screen at the same time. Bear in mind that the message is fully rewritten each second and this plugin is using 3 different messages (one for each color).

It's not possible to change only the number - it must rewrite the entire message, so this is why it's sent every second. The same goes for my rank system plugin - it has another DHUD message which is being sent each second, so you have a total of 4 DHUD messages.

These 4 are repeated each second, so a little delay can cause them to go over 8. Try disabling the DHUD font for the rank system to see if it will fix the problem.

I just tested on my server with the score plugin + DHUD from my rank system and that didn't happen. You may have another plugin that's causing it.

Потребителски аватар

Автор на темата
esc-Fiv3
Foreigner
Foreigner
Мнения: 110
Регистриран: 24 ное 2018, 19:19
Се отблагодари: 16 пъти

hud modification

Мнение от esc-Fiv3 » 08 яну 2019, 20:40

I have the win messages too which modify the ct/tero win message to a hud message + headshot hud message + restart on the first round and messages with best player, etc (3 messages) + voting map hud message + bomb countdown + that plugin with show you how much damage you did to a player
But only xp and score are permanently. Then I have best player, etc every round and for the first round in the game auto restart with hud..
I will try how you said to deactivate some of them to see what happen. Edit: I tried to deactivate a lot of them and didn't work.. The problem is still there
If I keep them like this and this hud will rewrite everytime the message, that can make problems in the future? Like overflow or idk..?

Потребителски аватар

OciXCrom TM
Администратор
Администратор
Мнения: 5285
Регистриран: 06 окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 73 пъти
Получена благодарност: 541 пъти
Години: 21
Контакти:

hud modification

Мнение от OciXCrom TM » 13 яну 2019, 00:20

Sorry for the late response, I was busy with exams.

No, it cannot cause overflow, it will just flicker and be annoying to watch. But like I said - the problem is not from the plugin, you simply have too many messages on your screen. I tested it on my server and it worked without those problems. There's nothing else that can be done if you want to have 3 different colors for the message.

Заключена

Върни се в “Заявки за плъгини”

Кой е на линия

Потребители, разглеждащи този форум: Няма регистрирани потребители и 2 госта