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

Najlepszy gracz rundy


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

#1 LageR#

    Zaawansowany

  • Użytkownik

Reputacja: -2
Nowy

  • Postów:76
  • GG:
  • Imię:Artur
  • Lokalizacja:Kujawsko - Pomorskie
Offline

Napisano 21.10.2013 16:17

Witam. Pobrałem plugin Najlepszy.amxx, który pokazuję najlepszego gracza rundy w say.

Chciałem, żeby pokazywało tak

 

[AMXX] Najlepszy gracz w tej rundzie: ###

[AMXX] Zdobyl 1 fraga

[AMXX] Trafil 1 raz(y) w glowe

a pokazuję się tak:

[AMXX] Najlepszy gracz w tej rundzie: ###

[AMXX] Zdobyl A ?raga

[AMXX] Trafil 1 raz(y) w glowe

 

Edytowałem go tak jak chciałem, ale chyba mi coś nie wyszło. Pomożecie? Z góry dziękuję.

I jeszcze jedno: jak wchodzę na serwer, a nikogo nie ma to jest pokazane tak jak u góry tylko, że zamiast nicku jest nazwa serwera. Da to się jakoś usunąć, żeby nie pokazywało to się na początku rundy/wejścia na serwer?

Daję .sma

#include <amxmodx>

#define PLUGIN "BestPlayer"
#define VERSION "1.0"
#define AUTHOR "KaMaZZ"

new g_iKills[33]
new g_iDeaths[33]
new g_hs[33]

new bestplayer = 0, g_iMaxPlayers;

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_event("DeathMsg", "death_event", "a", "1>0");
	register_event("HLTV", "eHLTV", "a", "1=0", "2=0");
	register_logevent("wiadomosc",2,"1=Round_End")
	g_iMaxPlayers = get_maxplayers();
}

/*============================================ ============================================= =======*/
/*************************************** [Color Chat] *********************************************/
/*============================================ =================================R=E=Y=M=O=N= =A=R=G=*/


enum Color
{
	NORMAL = 1, // clients scr_concolor cvar color
	GREEN, // Green Color
	TEAM_COLOR, // Red, grey, blue
	GREY, // grey
	RED, // Red
	BLUE, // Blue
}

new TeamName[][] = 
{
	"",
	"TERRORIST",
	"CT",
	"SPECTATOR"
}

ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
{
	new message[256];

	switch(type)
	{
	case NORMAL: // clients scr_concolor cvar color
		{
			message[0] = 0x01;
		}
	case GREEN: // Green
		{
			message[0] = 0x04;
		}
	default: // White, Red, Blue
		{
			message[0] = 0x03;
		}
	}

	vformat(message[1], 251, msg, 4);

	// Make sure message is not longer than 192 character. Will crash the server.
	message[192] = '^0';

	new team, ColorChange, index, MSG_Type;

	if(id)
	{
		MSG_Type = MSG_ONE;
		index = id;
	} else {
		index = FindPlayer();
		MSG_Type = MSG_ALL;
	}

	team = get_user_team(index);
	ColorChange = ColorSelection(index, MSG_Type, type);

	ShowColorMessage(index, MSG_Type, message);

	if(ColorChange)
	{
		Team_Info(index, MSG_Type, TeamName[team]);
	}
}

ShowColorMessage(id, type, message[])
{
	static bool:saytext_used;
	static get_user_msgid_saytext;
	if(!saytext_used)
	{
		get_user_msgid_saytext = get_user_msgid("SayText");
		saytext_used = true;
	}
	message_begin(type, get_user_msgid_saytext, _, id);
	write_byte(id) 
	write_string(message);
	message_end(); 
}

Team_Info(id, type, team[])
{
	static bool:teaminfo_used;
	static get_user_msgid_teaminfo;
	if(!teaminfo_used)
	{
		get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
		teaminfo_used = true;
	}
	message_begin(type, get_user_msgid_teaminfo, _, id);
	write_byte(id);
	write_string(team);
	message_end();

	return 1;
}

ColorSelection(index, type, Color:Type)
{
	switch(Type)
	{
	case RED:
		{
			return Team_Info(index, type, TeamName[1]);
		}
	case BLUE:
		{
			return Team_Info(index, type, TeamName[2]);
		}
	case GREY:
		{
			return Team_Info(index, type, TeamName[0]);
		}
	}

	return 0;
}

FindPlayer()
{
	new i = -1;

	while(i <= get_maxplayers())
	{
		if(is_user_connected(++i))
		return i;
	}

	return -1;
}

public client_connect(id) 
{
	g_iKills[id] = 0
	g_iDeaths[id] = 0
}

public death_event()
{
	new iKiller = read_data(1), iVictim = read_data(2), iHitplace = read_data(3);

	if (iKiller == iVictim)
	{
		g_iDeaths[iKiller]++;
		return;
	}

	g_iKills[iKiller]++;
	g_iDeaths[iVictim]++;

	if(iHitplace)
	{
		g_hs[iKiller]++;
	}
}

public wiadomosc() 
{ 
	if(get_playersnum() < 2)
	return

	for(new i=1; i <= g_iMaxPlayers; i++)
	{
		if (g_iKills[i] > g_iKills[bestplayer] || g_iKills[i] == g_iKills[bestplayer] && g_iDeaths[i] < g_iDeaths[bestplayer] || g_iKills[i] == g_iKills[bestplayer] && g_hs[i] > g_hs[bestplayer])
		{
			bestplayer = i;
		}
	}

	new name[32];
	get_user_name(bestplayer, name, 31);

	new iKills = g_iKills[bestplayer]
	new iHS = g_hs[bestplayer]

	ColorChat(0, GREEN,"^x04[AMXX] ^x03Najlepszy gracz w tej rundzie: ^x04%s", name)
	if(iKills >= 5 || iKills == 0)
	{
		ColorChat(0, GREEN, "^x04[AMXX] ^x03Zdobyl ^x04%d ^x03fragow", iKills)
	}
	else if(iKills > 1 && iKills < 5)
	{
		ColorChat(0, GREEN, "^x04[AMXX] ^x03Zdobyl ^x04%d ^x03fragi", iKills)
	}
	else if(iKills == 1)
	{
		ColorChat(0, GREEN, "^x04[AMXX] ^x03Zdobyl ^x041 ^x03fraga")
	}
	ColorChat(0, GREEN, "^x04[AMXX] ^x03Trafil ^x04%d ^x03raz(y) w glowe", iHS)
}

public eHLTV()
{
	for( new i = 1 ; i <= g_iMaxPlayers ; i++ )
	{
		g_iKills[ i ] = 0;
		g_iDeaths[ i ] = 0;
		g_hs[ i ] = 0;
	}
}

Użytkownik LageR# edytował ten post 21.10.2013 16:19

  • +
  • -
  • 0

#2 sNH.

    Czy MisieQ ukradł ciasteczko?

  • Power User

Reputacja: 299
Wszechwidzący

  • Postów:1 070
  • Steam:steam
  • Imię:Bartek
  • Lokalizacja:Ełk
Offline

Napisano 21.10.2013 16:35

Spoglądając na szybko zauważyłem 1 błąd:

 

ColorChat(0, GREEN, "^x04[AMXX] ^x03Zdobyl ^x041 ^x03fraga")

Dokładnie tu: ^x041 Zrób spację. Postaram się wieczorem poprawić, żeby działało.

 

Edit: Bo nie jestem pewny czy ten sposób z 041 zadziała


  • +
  • -
  • 0

#3 mastah7991

    Wszechpomocny

  • Użytkownik

Reputacja: 154
Profesjonalista

  • Postów:388
  • Lokalizacja:Polska
Offline

Napisano 21.10.2013 16:58

#include <amxmodx>

#define PLUGIN "BestPlayer"
#define VERSION "1.0"
#define AUTHOR "KaMaZZ"

new g_iKills[33]
new g_iDeaths[33]
new g_hs[33]

new bestplayer = 0, g_iMaxPlayers;

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_event("DeathMsg", "death_event", "a", "1>0");
	register_event("HLTV", "eHLTV", "a", "1=0", "2=0");
	register_logevent("wiadomosc",2,"1=Round_End")
	g_iMaxPlayers = get_maxplayers();
}

/*============================================ ============================================= =======*/
/*************************************** [Color Chat] *********************************************/
/*============================================ =================================R=E=Y=M=O=N= =A=R=G=*/


enum Color
{
	NORMAL = 1, // clients scr_concolor cvar color
	GREEN, // Green Color
	TEAM_COLOR, // Red, grey, blue
	GREY, // grey
	RED, // Red
	BLUE, // Blue
}

new TeamName[][] = 
{
	"",
	"TERRORIST",
	"CT",
	"SPECTATOR"
}

ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
{
	new message[256];

	switch(type)
	{
	case NORMAL: // clients scr_concolor cvar color
		{
			message[0] = 0x01;
		}
	case GREEN: // Green
		{
			message[0] = 0x04;
		}
	default: // White, Red, Blue
		{
			message[0] = 0x03;
		}
	}

	vformat(message[1], 251, msg, 4);

	// Make sure message is not longer than 192 character. Will crash the server.
	message[192] = '^0';

	new team, ColorChange, index, MSG_Type;

	if(id)
	{
		MSG_Type = MSG_ONE;
		index = id;
	} else {
		index = FindPlayer();
		MSG_Type = MSG_ALL;
	}

	team = get_user_team(index);
	ColorChange = ColorSelection(index, MSG_Type, type);

	ShowColorMessage(index, MSG_Type, message);

	if(ColorChange)
	{
		Team_Info(index, MSG_Type, TeamName[team]);
	}
}

ShowColorMessage(id, type, message[])
{
	static bool:saytext_used;
	static get_user_msgid_saytext;
	if(!saytext_used)
	{
		get_user_msgid_saytext = get_user_msgid("SayText");
		saytext_used = true;
	}
	message_begin(type, get_user_msgid_saytext, _, id);
	write_byte(id) 
	write_string(message);
	message_end(); 
}

Team_Info(id, type, team[])
{
	static bool:teaminfo_used;
	static get_user_msgid_teaminfo;
	if(!teaminfo_used)
	{
		get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
		teaminfo_used = true;
	}
	message_begin(type, get_user_msgid_teaminfo, _, id);
	write_byte(id);
	write_string(team);
	message_end();

	return 1;
}

ColorSelection(index, type, Color:Type)
{
	switch(Type)
	{
	case RED:
		{
			return Team_Info(index, type, TeamName[1]);
		}
	case BLUE:
		{
			return Team_Info(index, type, TeamName[2]);
		}
	case GREY:
		{
			return Team_Info(index, type, TeamName[0]);
		}
	}

	return 0;
}

FindPlayer()
{
	new i = -1;

	while(i <= get_maxplayers())
	{
		if(is_user_connected(++i))
		return i;
	}

	return -1;
}

public client_connect(id) 
{
	g_iKills[id] = 0
	g_iDeaths[id] = 0
}

public death_event()
{
	new iKiller = read_data(1), iVictim = read_data(2), iHitplace = read_data(3);

	if (iKiller == iVictim)
	{
		g_iDeaths[iKiller]++;
		return;
	}

	g_iKills[iKiller]++;
	g_iDeaths[iVictim]++;

	if(iHitplace)
	{
		g_hs[iKiller]++;
	}
}

public wiadomosc() 
{ 
	if(get_playersnum() < 2)
	return

	for(new i=1; i <= g_iMaxPlayers; i++)
	{
		if (g_iKills[i] > g_iKills[bestplayer] || g_iKills[i] == g_iKills[bestplayer] && g_iDeaths[i] < g_iDeaths[bestplayer] || g_iKills[i] == g_iKills[bestplayer] && g_hs[i] > g_hs[bestplayer])
		{
			bestplayer = i;
		}
	}

	new name[32];
	get_user_name(bestplayer, name, 31);

	new iKills = g_iKills[bestplayer]
	new iHS = g_hs[bestplayer]

	ColorChat(0, GREEN,"[AMXX] ^x03Najlepszy gracz w tej rundzie: ^x04%s", name)
	ColorChat(0, GREEN,"[AMXX] ^x03Zdobyl ^x04%d ^x03fragow",iKills)
	ColorChat(0, GREEN,"[AMXX] ^x03Trafil ^x04%d ^x03raz(y) w glowe",iHS)
	
}

public eHLTV()
{
	for( new i = 1 ; i <= g_iMaxPlayers ; i++ )
	{
		g_iKills[ i ] = 0;
		g_iDeaths[ i ] = 0;
		g_hs[ i ] = 0;
	}
}

  • +
  • -
  • 0

#4 LageR#

    Zaawansowany

  • Autor tematu
  • Użytkownik

Reputacja: -2
Nowy

  • Postów:76
  • GG:
  • Imię:Artur
  • Lokalizacja:Kujawsko - Pomorskie
Offline

Napisano 21.10.2013 17:58

@mastah7991, jest tak jak chciałem, tylko znowu zamiast

fragow

jest

?ragow

  • +
  • -
  • 0

#5 szelbi

    Hero

  • Power User

Reputacja: 373
Wszechpomocny

  • Postów:1 032
  • Steam:steam
  • Imię:Norbert
  • Lokalizacja:Częstochowa
Offline

Napisano 21.10.2013 18:01

ColorChat(0, GREEN,"[AMXX] ^x03Zdobyl ^x04%d ^x03fragow",iKills)

na

ColorChat(0, GREEN,"[AMXX] ^x03Zdobyl^x04 %d^x03 fragow",iKills)

  • +
  • -
  • 1

#6 LageR#

    Zaawansowany

  • Autor tematu
  • Użytkownik

Reputacja: -2
Nowy

  • Postów:76
  • GG:
  • Imię:Artur
  • Lokalizacja:Kujawsko - Pomorskie
Offline

Napisano 21.10.2013 19:46

Dzięki! Działa!


  • +
  • -
  • 0




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

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