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

/rs z przebudowanym komunikatem w hud


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

#1 no-reference

    Początkujący

  • Użytkownik

Reputacja: 0
Nowy

  • Postów:10
  • Imię:Adam
Offline

Napisano 04.04.2026 08:17

Cześć,

 

Czy byłby ktoś w stanie przerobic następujący kod, żeby komunikat o 5-sekundowym info na udzielenie feedbacku po śmierci wyświetlał się w HUD? 

 

Podobnie do tego screena z załącznika.

 

Plugin oczywiście z: https://amxx.pl/topi...1-reset-score/ 

 

Kod: 

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>


#define adtime  600.0 //Default of 10 minuites


new pcvar_Advertise
new pcvar_Display


public plugin_init()
{
register_plugin("Reset Score", "1.0", "Silenttt")


//You may type /resetscore or /restartscore
register_clcmd("say /resetscore", "reset_score")
register_clcmd("say /restartscore", "reset_score")
register_clcmd("say /rs", "reset_score")


//This command by default will be set at 0
//Change it to 1 in server.cfg if you want
//A message to be shown to advertise this.
pcvar_Advertise = register_cvar("sv_rsadvertise", "0")
//This command by default is also 0
//Change it to 1 in server.cfg if you want
//It to show who reset their scores when they do it
pcvar_Display = register_cvar("sv_rsdisplay", "0")


if(get_cvar_num("sv_rsadvertise") == 1)
{
set_task(adtime, "advertise", _, _, _, "b")
}
}


public reset_score(id)
{
//These both NEED to be done twice, otherwise your frags wont
//until the next round
cs_set_user_deaths(id, 0)
set_user_frags(id, 0)
cs_set_user_deaths(id, 0)
set_user_frags(id, 0)


if(get_pcvar_num(pcvar_Display) == 1)
{
new name[33]
get_user_name(id, name, 32)
client_print(0, print_chat, "%s wlasnie zresetowal sobie statystyki", name)
}
else
{
client_print(id, print_chat, "Wlasnie zresetowales sobie statystki")
}
}


public advertise()
{
set_hudmessage(255, 0, 0, -1.0, 0.20, 0, 0.2, 12.0)
show_hudmessage(0, "Wpisz /resetscore aby zresetowac swoje statystyki")
}


public client_putinserver(id)
{
if(get_pcvar_num(pcvar_Advertise) == 1)
{
set_task(10.0, "connectmessage", id, _, _, "a", 1)
}
}


public connectmessage(id)
{
if(is_user_connected(id))
{
client_print(id, print_chat, "Wpisz /resetscore aby zresetowac swoje statystyki. Mozesz to zrobic w kazdym momencie gry")
}
}

 

 

Załączone miniatury

  • rs.jpg

  • +
  • -
  • 0

#2 N1K1Cz

    Profesjonalista

  • Użytkownik

Reputacja: 48
Pomocny

  • Postów:154
  • GG:
  • Steam:steam
  • Imię:/\^-^/\
Offline

Napisano 04.04.2026 11:30

Masz tu gotowy plugin na info po śmierci.

Dorzuciłem do niego po prostu kod na hud z odliczaniem.

Nie bardzo wiem po co chcesz dodawać to do resetscore - trochę bez sensu.

 

Nie testowane, lecz powinno śmigać

#include <amxmodx>
#include <colorchat>
#include <fakemeta>

#define PLUGIN "Info po smierci"
#define VERSION "1.0"
#define AUTHOR "DarkGL"

new maxPlayers,
	Float: taskTimeStop,
	bool:bCan[ 33 ],
	Float:fTimeLeft[33];

public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_cvar( "info_smierci_czas" , "5.0" );
	
	register_event("DeathMsg", "DeathMsg", "a")
	
	register_clcmd("say","sayHandle")
	register_clcmd("say_team","sayHandle")
	
	register_forward(FM_Voice_SetClientListening, "Forward_SetClientListening");
	
	maxPlayers = get_maxplayers();
}

public plugin_cfg()
	taskTimeStop =  get_cvar_float( "info_smierci_czas" );

public sayHandle(id)
{
	if( !bCan[ id ] ) return PLUGIN_CONTINUE;
	
	new szTmp[ 256 ],
		szPrint[190],
		szName[64];
	
	read_argv(1,szTmp,charsmax(szTmp));
	trim( szTmp )
	
	get_user_name( id , szName,charsmax( szName ) );
	
	formatex(szPrint,charsmax(szPrint),"[Info od %s] ^x01 %s",szName,szTmp);
	
	ColorChat( id , GREEN , szPrint);
	
	for(new iPlayer = 1;iPlayer <= maxPlayers; iPlayer++)
	{
		if( !is_user_alive( iPlayer ) || get_user_team( iPlayer ) != get_user_team(id)) continue;

		ColorChat( iPlayer , GREEN , szPrint);
	}
	
	return PLUGIN_HANDLED;
}

public DeathMsg()
{
	new idVictim = read_data( 2 );
	
	if( !is_user_connected( idVictim ) || is_user_alive( idVictim ) ) return PLUGIN_CONTINUE;
	
	bCan[ idVictim ] = true;
	
	remove_task( idVictim );
	remove_task(idVictim + 8899);
	
	fTimeLeft[idVictim] = taskTimeStop;
	showHud(idVictim + 8899);

	set_task( taskTimeStop ,"stopInfo" , idVictim );
	set_task( 1.0 , "showHud", idVictim + 8899, .flags = "b" ); 
	
	return PLUGIN_CONTINUE;
}
public showHud(id)
{
	id -= 8899;
	
	if(!is_user_connected(id) || !bCan[id])
	{
		remove_task(id + 8899);
		return;
	}
	
	set_hudmessage(0, 255, 0, -1.0, 0.6, 0, 0.0, 1.0, 0.0, 0.0);
	show_hudmessage(id, "< Info po smierci: %.0f sek >", fTimeLeft[id]);

	fTimeLeft[id] -= 1.0;
	
	if(fTimeLeft[id] < 0.0)
	{
		remove_task(id + 8899);
		return;
	}
}
public client_connect( id ) bCan[ id ] = false;

public client_disconnected( id ) bCan[ id ] = false;

public stopInfo( id )
{
	bCan[ id ] = false;
	
	remove_task(id + 8899); 

	for(new iPlayer = 1;iPlayer <= maxPlayers; iPlayer++)
	{
		if( !is_user_alive( iPlayer ) ) continue;
		
		engfunc(EngFunc_SetClientListening, iPlayer, id, false);
	}
}

public Forward_SetClientListening( iReceiver, iSender, bool:bListen ) 
{
	if( !is_user_connected(iSender) || !is_user_connected( iReceiver ) )
		return FMRES_IGNORED;
	
	if( get_user_team(iSender) != get_user_team( iReceiver ) )
		return FMRES_IGNORED;
	
	if( !bCan[iSender] )
		return FMRES_IGNORED;
	
	engfunc(EngFunc_SetClientListening, iReceiver, iSender, true);
	forward_return(FMV_CELL, true);
	
	return FMRES_SUPERCEDE
}


Użytkownik N1K1Cz edytował ten post 04.04.2026 11:31

  • +
  • -
  • 0

Potrzebujesz pomocy z serwerem/paczką? Napisz do mnie! Chętnie pomogę  ^D^ 

- Discord: N1K1Cz#0751

- GG: 70679564

- Steam: https://steamcommunity.com/id/N1K1Cz/

 


#3 no-reference

    Początkujący

  • Autor tematu
  • Użytkownik

Reputacja: 0
Nowy

  • Postów:10
  • Imię:Adam
Offline

Napisano 04.04.2026 13:00

Chyba miałem zaćmę - działa, dziękuję 


  • +
  • -
  • 0




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

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