Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

HUD


Najlepsza odpowiedź Rivit, 10.08.2019 11:58

Spoiler
Przejdź do postu


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
13 odpowiedzi w tym temacie

#1 Roughster

    Profesjonalista

  • Użytkownik

Reputacja: 16
Początkujący

  • Postów:180
  • GG:
  • Steam:steam
  • Imię:Damian
  • Lokalizacja:localhost
Offline

Napisano 08.08.2019 21:55

Witam. Gdy jestem w TT/CT i ktoś mnie zabije to hud znika, zamiast pokazywać Nick, Rangę, Postęp, czy ma VIP'a itp.

 

Mógłby ktoś spojrzeć na kod i podesłać mi działający hud?

 

rangi_amxx.sma

#include <amxmodx>
#include <csx>
#include <fakemeta>

#define ForArray(%1,%2) for(new %1 = 0; %1 < sizeof %2; %1++)

#define TASK_DISPLAYHUD 1337

new const rankName[][] =
{
	"Silver I",
	"Silver II",
	"Silver III",
	"Silver IV",
	"Silver Elite",
	"Silver Elite Master",
	"Gold Nova I",
	"Gold Nova II",
	"Gold Nova III",
	"Gold Nova IV",
	"Gold Nova Master",
	"Master Guardian I",
	"Master Guardian II",
	"Master Guardian Elite",
	"Distinguished Master Guardian",
	"Legendary Eagle",
	"Legendary Eagle Master",
	"Supreme Master First Class",
	"The Global Elite"
};

new const rankKills[][] =
{
	{ 0, 29 },
	{ 30, 59 },
	{ 60, 119 },
	{ 120, 209 },
	{ 210, 324 },
	{ 325, 499 },
	{ 500, 729 },
	{ 730, 999 },
	{ 100, 1399 },
	{ 1400, 1849 },
	{ 1850, 2299 },
	{ 2300, 2899 },
	{ 2900, 3549 },
	{ 4200, 4999 },
	{ 5000, 5899 },
	{ 5900, 6899 },
	{ 6900, 7999 },
	{ 8000, 9299 },
	{ 9300, 12000 }
};

new const hudToggleCommands[][] =
{
	"/hud"
};

new hudObject,
	bool:hudEnabled[33];

public plugin_init()
{
	register_plugin("Info Hud I Rangi CsGo", "1.0", "ProToTyp");
	
	registerCommands(hudToggleCommands, sizeof(hudToggleCommands), "toggleHud");
	
	hudObject = CreateHudSyncObj();
}

public client_putinserver(index)
{
	hudEnabled[index] = true;

	setHudTask(index);
}

public client_disconnect(index)
{
	if(!task_exists(index + TASK_DISPLAYHUD))
	{
		return;
	}

	remove_task(index + TASK_DISPLAYHUD);
}

public displayHud(taskIndex)
{
	new index = taskIndex - TASK_DISPLAYHUD;

	if(!is_user_connected(index) || !hudEnabled[index])
	{
		return;
	}

	new target;
	
	if(!is_user_alive(index))
	{
		target = pev(index, pev_iuser2);

		if(!is_user_alive(target))
		{
			return;
		}
	}
	else
	{
		target = index;
	}
	
	static userName[33],
		requiredKills,
		userPosition,
		userRankIndex,
		userStats[8],
		blank[8];
	
	get_user_name(target, userName, charsmax(userName));
	
	userRankIndex = getRankIndex(target);
	userPosition = get_user_stats(target, userStats, blank);	
	requiredKills = (userRankIndex + 1 == sizeof(rankKills) ? rankKills[userRankIndex][1] : rankKills[userRankIndex + 1][0]);
	
	set_hudmessage(0, 255, 0, 0.01, 0.17, 0, 6.0, 1.2, 0.1, 0.1);
	ShowSyncHudMsg(target, hudObject, "Nick: %s^nRanga: %s^nPostep: %i/%i^nFragi: %i^nRanking: %i/%i^nVip: %s", userName, rankName[userRankIndex], userStats[0], requiredKills, get_user_frags(target), userPosition, get_statsnum(), get_user_flags(target) & ADMIN_LEVEL_H ? "Tak" : "Nie");
}

getRankIndex(index)
{
	static userStats[8],
		blank[8];
	
	get_user_stats(index, userStats, blank);
	
	if(userStats[0] >= rankKills[sizeof(rankKills) - 1][0])
	{
		return sizeof(rankKills) - 1;
	}

	ForArray(i, rankKills)
	{
		if(userStats[0] >= rankKills[i][0])
		{
			continue;
		}

		return i - 1;
	}
	
	return -1;
}

public toggleHud(index)
{
	hudEnabled[index] = !hudEnabled[index]

	if(hudEnabled[index])
	{
		setHudTask(index);

		return;
	}

	if(!task_exists(index + TASK_DISPLAYHUD))
	{
		return;
	}
	
	remove_task(index + TASK_DISPLAYHUD);
}

setHudTask(index)
{
	set_task(1.0, "displayHud", index + TASK_DISPLAYHUD, .flags = "b");
}

stock registerCommands(const array[][], arraySize, function[])
{
	#if !defined ForRange

		#define ForRange(%1,%2,%3) for(new %1 = %2; %1 <= %3; %1++)

	#endif

	#if AMXX_VERSION_NUM > 183
	
	ForRange(i, 0, arraySize - 1)
	{
		ForRange(j, 0, 1)
		{
			register_clcmd(fmt("%s %s", !j ? "say" : "say_team", array[i]), function);
		}
	}

	#else

	new newCommand[33];

	ForRange(i, 0, arraySize - 1)
	{
		ForRange(j, 0, 1)
		{
			formatex(newCommand, charsmax(newCommand), "%s %s", !j ? "say" : "say_team", array[i]);
			register_clcmd(newCommand, function);
		}
	}

	#endif
}

  • +
  • -
  • 0

#2 Roughster

    Profesjonalista

  • Autor tematu
  • Użytkownik

Reputacja: 16
Początkujący

  • Postów:180
  • GG:
  • Steam:steam
  • Imię:Damian
  • Lokalizacja:localhost
Offline

Napisano 09.08.2019 09:22

Ref


  • +
  • -
  • 0

#3 Roughster

    Profesjonalista

  • Autor tematu
  • Użytkownik

Reputacja: 16
Początkujący

  • Postów:180
  • GG:
  • Steam:steam
  • Imię:Damian
  • Lokalizacja:localhost
Offline

Napisano 09.08.2019 16:24

ref2


  • +
  • -
  • 0

#4 Roughster

    Profesjonalista

  • Autor tematu
  • Użytkownik

Reputacja: 16
Początkujący

  • Postów:180
  • GG:
  • Steam:steam
  • Imię:Damian
  • Lokalizacja:localhost
Offline

Napisano 10.08.2019 09:11

ref3


  • +
  • -
  • 0

#5 Rivit

    Godlike

  • Support Team

Reputacja: 1 319
Godlike

  • Postów:4 380
Offline

Napisano 10.08.2019 09:49

zobacz czy problem wystepuje jesli bedziesz mial wlaczony tylko ten plugin


  • +
  • -
  • 0

#6 Roughster

    Profesjonalista

  • Autor tematu
  • Użytkownik

Reputacja: 16
Początkujący

  • Postów:180
  • GG:
  • Steam:steam
  • Imię:Damian
  • Lokalizacja:localhost
Offline

Napisano 10.08.2019 10:21

z tego co widzę, to tak.


  • +
  • -
  • 0

#7 Rivit

    Godlike

  • Support Team

Reputacja: 1 319
Godlike

  • Postów:4 380
Offline

Napisano 10.08.2019 11:58   Najlepsza odpowiedź

Spoiler

  • +
  • -
  • 1

#8 Roughster

    Profesjonalista

  • Autor tematu
  • Użytkownik

Reputacja: 16
Początkujący

  • Postów:180
  • GG:
  • Steam:steam
  • Imię:Damian
  • Lokalizacja:localhost
Offline

Napisano 10.08.2019 14:58

nadal nic, pokazuje huda tylko wtedy, kiedy zyje i jestem w jakimś teamie


  • +
  • -
  • 0

#9 Rivit

    Godlike

  • Support Team

Reputacja: 1 319
Godlike

  • Postów:4 380
Offline

Napisano 10.08.2019 15:39

działa, patrz, dokładnie ten sam kod, który Ci dałem

Załączone miniatury

  • Untitled.png

  • +
  • -
  • 0

#10 Roughster

    Profesjonalista

  • Autor tematu
  • Użytkownik

Reputacja: 16
Początkujący

  • Postów:180
  • GG:
  • Steam:steam
  • Imię:Damian
  • Lokalizacja:localhost
Offline

Napisano 10.08.2019 19:40

Rzeczywiście, działa.

 

Mógłbyś jeszcze dodać mi do tego pluginu takie coś?:

 

IsbyKgn.png

 

[HUD] w kolorze czerwonym i Wylaczyles hud. w kolorze zielonym.


  • +
  • -
  • 0

#11 Rivit

    Godlike

  • Support Team

Reputacja: 1 319
Godlike

  • Postów:4 380
Offline

Napisano 10.08.2019 19:52

Majster, ja rozumiem, że nie ogarniasz, ale włoż coś od siebie chociaż troche...

public toggleHud(index)
{
	hudEnabled[index] = !hudEnabled[index]
 
	if(hudEnabled[index])
	{
                //wlaczyles
		setHudTask(index);
 
		return;
	}
        //wylaczyles
	remove_task(index + TASK_DISPLAYHUD);
}

Popatrz jak w innych pluginach są wysylane wiadomosci, nic trudnego


  • +
  • -
  • 2

#12 Roughster

    Profesjonalista

  • Autor tematu
  • Użytkownik

Reputacja: 16
Początkujący

  • Postów:180
  • GG:
  • Steam:steam
  • Imię:Damian
  • Lokalizacja:localhost
Offline

Napisano 10.08.2019 20:30

No wybacz, ale kompletnie tego nie ogarniam ;d


  • +
  • -
  • 0

#13 Toldi

    Czempion

  • Power User

Reputacja: 259
Wszechwidzący

  • Postów:841
  • Imię:Mateusz
  • Lokalizacja:wies
Offline

Napisano 11.08.2019 09:28

pod ostatnim include dopisz

#include <colorchat>
public toggleHud(index)
{
	hudEnabled[index] = !hudEnabled[index]
	ColorChat(index, RED, "[HUD]^4 %s Hud.", hudEnabled[index]?"Wlaczyles":"Wylaczyles");
	
	if(hudEnabled[index])
	{
                //wlaczyles
		setHudTask(index);
 
		return;
	}
        //wylaczyles
	remove_task(index + TASK_DISPLAYHUD);
}

  • +
  • -
  • 1

#14 Roughster

    Profesjonalista

  • Autor tematu
  • Użytkownik

Reputacja: 16
Początkujący

  • Postów:180
  • GG:
  • Steam:steam
  • Imię:Damian
  • Lokalizacja:localhost
Offline

Napisano 11.08.2019 10:05

 

pod ostatnim include dopisz

#include <colorchat>
public toggleHud(index)
{
	hudEnabled[index] = !hudEnabled[index]
	ColorChat(index, RED, "[HUD]^4 %s Hud.", hudEnabled[index]?"Wlaczyles":"Wylaczyles");
	
	if(hudEnabled[index])
	{
                //wlaczyles
		setHudTask(index);
 
		return;
	}
        //wylaczyles
	remove_task(index + TASK_DISPLAYHUD);
}

 

dzięki mistrzu


  • +
  • -
  • 0




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych