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

Custom Team Names


  • Zamknięty Temat jest zamknięty
Brak odpowiedzi do tego tematu

#1 becometa

    Życzliwy

  • Użytkownik

Reputacja: 1
Nowy

  • Postów:33
  • GG:
  • Lokalizacja:Łódź
Offline

Napisano 09.12.2009 14:06

Cześć,

Szukałem pluginu umożliwiającego zmianę nazwy Team'ów w ScoreBoard, takowy udało mi się znaleźć jednakże zamienia on tylko nazwy w textowym menu.
Mi zależy tylko i wyłącznie na ScoreBoard, którego autor niestety jeszcze nie zrobił (plugin wydany rok temu).
Czy ktoś jest w stanie dodać taką możliwość i czy w ogóle jest to możliwe.
Jeżeli powyższy tekst jest nie zrozumiały, to po krótce chodzi mi o możliwość zmiany nazw: Counter Terrorist i Terrorist przykładowo na: Drużyna A, Drużyna B ;)

/* AMX Mod X
*   Custom Team Names 1.14
*
* (c) Copyright 2008 by =[UnO]=P@c|Man
*
* This file is provided as is (no warranties)
*
*     DESCRIPTION
*	Use custom team names like "Jedi-Knights" instead of "Counter-Terrorists". You can use
*	own round end sounds, but the default ones are "downed_intro.mp3" and "motor_intro.mp3".
*
*     CVARS
*	ctn_team_t: 	custom name for "Terrorits"
*	ctn_team_ct:	custom name for "Counter-Terrorits"
*	ctn_use_sounds:	do you want to use special round end sounds?
*	ctn_sound_t:	custom round end sound if T win, e.g. "myfolder/sith.mp3" (or *.wav)
*	ctn_sound_ct:	custom round end sound if CT win, e.g. "myfolder/jedi.mp3 (or *.wav)
*
*     CREDITS
*       VEN; plugin "Auto Join on Connect"
*	many; function "cmdBlock"
*	fxfighter, arkshine;
*	All users of AlliedModders;
*/

#include <amxmodx>
#include <fakemeta_util>
#include <cstrike>

#define PLUGIN_NAME "Custom Team Names"
#define PLUGIN_VERSION "1.14"
#define PLUGIN_AUTHOR "=[UnO]=P@c|Man"

// default names
new const TeamT[] = "Sith"		// Terrorists
new const TeamCT[] = "Jedi Knights"	// Counter-Terrorists

// default round end sounds
new const SoundT[] = "music/downed_intro.mp3"
new const SoundCT[] = "music/motor_intro.mp3"

// Some useful code (thx to arkshine)
enum
{
    CS_TEAM_UNASSIGNED = 0,
    CS_TEAM_T,
    CS_TEAM_CT,
    CS_TEAM_SPECTATOR
}

#define OFFSET_TEAM  114 
#define cs_get_user_team(%1)     get_pdata_int( %1, OFFSET_TEAM ) 

#define OFFSET_DEATHS  444
#define cs_get_user_deaths(%1)     get_pdata_int( %1, OFFSET_DEATHS )
#define cs_set_user_deaths(%1,%2)  set_pdata_int( %1, OFFSET_DEATHS, %2 )

// Some variables
new mChooseTeam
new showMsg = 0

new pcTeamT, pcTeamCT, pcSoundT, pcSoundCT, pcUseSounds

public plugin_init() {
	register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);

	register_message(get_user_msgid("ShowMenu"), "message_show_menu");
	register_event("ResetHUD", "set_hud", "be");

	// change round end message / sounds
	register_message(get_user_msgid("SendAudio"), "message_sendaudio");
	register_message(get_user_msgid("TextMsg"), "message_textmsg");

	pcTeamT = register_cvar("ctn_team_t", TeamT);
	pcTeamCT = register_cvar("ctn_team_ct", TeamCT);
	pcUseSounds = register_cvar("ctn_use_sounds", "1");
	pcSoundT  = register_cvar("ctn_sound_t", SoundT);
	pcSoundCT = register_cvar("ctn_sound_ct", SoundCT);
	
	register_clcmd("chooseteam", "cmdBlock");

	createMenu();

	return PLUGIN_CONTINUE;
}

public plugin_precache() {
	new sound_t[128];
	get_pcvar_string(pcSoundT, sound_t, 127);

	if (containi(sound_t, ".mp3") != -1)
	{
		formatex(sound_t, 127, "sound/%s", sound_t);
		precache_generic(sound_t);
	} else
		precache_sound(sound_t);

	new sound_ct[128];
	get_pcvar_string(pcSoundCT, sound_ct, 127);

	if (containi(sound_ct, ".mp3") != -1)
	{
		formatex(sound_t, 127, "sound/%s", sound_ct);
		precache_generic(sound_ct);
	} else
		precache_sound(sound_ct);
}

public client_connect(id)
{
	set_user_info(id, "_vgui_menus", "0");

	return PLUGIN_CONTINUE;
}

public set_hud(id) {
	showMsg = 0;

	set_task(0.2, "fixHUD", id);
	set_task(0.3, "fadeOut", id);

	return PLUGIN_CONTINUE;
}

public fixHUD(id) {
	// some fixes if the HUD is destroyed
	if (!user_has_weapon(id, CSW_KNIFE))
	{
		fm_set_user_suit(id);
		fm_give_item(id, "weapon_knife");

		switch (cs_get_user_team(id))
		{
			case CS_TEAM_CT:
			{
				fm_give_item(id, "weapon_usp");
				fm_give_item(id, "ammo_45acp");
			}

			case CS_TEAM_T:
			{
				fm_give_item(id, "weapon_glock18");
				fm_give_item(id, "ammo_9mm");
			}
		}
	}

	return PLUGIN_CONTINUE;
}

// end of a round
public round_end_msg(params[]) {
	if (showMsg == 1)
	{
		client_print(0, print_center, "%s win!", params);
		set_task(0.2, "round_end_msg", 0, params, 128);
	}
}

public message_textmsg(msg_id, msg_dest, msg_entity) {
	static message[20];
	get_msg_arg_string(2, message, sizeof message - 1);

	if (equali(message, "#Terrorists_Win"))
	{
		new params[128];
		formatex(params, 127, "%s", TeamT);

		showMsg = 1;
		set_task(0.2, "round_end_msg", 0, params, 128);

		return PLUGIN_HANDLED;
	}

	if (equali(message, "#CTs_Win"))
	{
		new params[128];
		formatex(params, 127, "%s", TeamCT);

		showMsg = 1;
		set_task(0.2, "round_end_msg", 0, params, 128);

		return PLUGIN_HANDLED;
	}

	return PLUGIN_CONTINUE;
}


// sounds
public fadeOut()
{
	client_cmd(0, "cd fadeout");
	return PLUGIN_CONTINUE;
}


public message_sendaudio(msg_id, msg_dest, msg_entity) {
	static message[20];
	get_msg_arg_string(2, message, sizeof message - 1);

	if (equali(message, "%!MRAD_terwin"))
	{
		if (get_pcvar_num(pcUseSounds) == 1)
		{
			new sound_t[128];
			get_pcvar_string(pcSoundT, sound_t, 127);

			if (containi(sound_t, ".mp3") != -1)
				client_cmd(0, "mp3 play sound/%s", sound_t);
			else
			
				client_cmd(0, "spk %s", sound_t);
		
		}
		
		return PLUGIN_HANDLED;
	}

	if (equali(message, "%!MRAD_ctwin"))
	{
		if (get_pcvar_num(pcUseSounds) == 1)
		{
			new sound_ct[128];
			get_pcvar_string(pcSoundCT, sound_ct, 127);

			if (containi(sound_ct, ".mp3") != -1)
				client_cmd(0, "mp3 play sound/%s", sound_ct);
			else
				client_cmd(0, "spk %s", sound_ct);
		}
			
		return PLUGIN_HANDLED;
	}
	
        return PLUGIN_CONTINUE;
}

public cmdBlock(id)
{
	menu_display(id, mChooseTeam, 0);
	return PLUGIN_HANDLED;
}

// custom menu
public createMenu() {
	mChooseTeam = menu_create("Choose Team", "mh_ChooseTeam");

	new t_name[128], ct_name[128];
	get_pcvar_string(pcTeamT, t_name, 127);
	get_pcvar_string(pcTeamCT, ct_name, 127);

	menu_additem(mChooseTeam, t_name, "ma_ChooseTeam", ADMIN_ALL);
	menu_additem(mChooseTeam, ct_name, "ma_ChooseTeam", ADMIN_ALL);
	menu_additem(mChooseTeam, "Spectator", "ma_ChooseTeam", ADMIN_ALL);

	return PLUGIN_CONTINUE;
}

public message_show_menu(msgid, dest, id) {
	if (get_user_team(id) || task_exists(id))
		return PLUGIN_CONTINUE;

	static team_select[] = "#Team_Select";
	static menu_text_code[sizeof team_select];

	get_msg_arg_string(4, menu_text_code, sizeof menu_text_code - 1);

	if (!equal(menu_text_code, team_select))
		return PLUGIN_CONTINUE;

	set_task(0.1, "force_team_join", id);

	return PLUGIN_HANDLED;
}

public force_team_join(id) {
	engclient_cmd(id, "jointeam", "6");
	menu_display(id, mChooseTeam, 0);

	return PLUGIN_CONTINUE;
}

public mh_ChooseTeam(id, menu, item) {
	switch (item)
	{
		case -3: return PLUGIN_HANDLED;

		case 0:
			if (cs_get_user_team(id) == CS_TEAM_T)
				return PLUGIN_HANDLED;
		
		case 1:
			if (cs_get_user_team(id) == CS_TEAM_CT)
				return PLUGIN_HANDLED;

		case 2:
			if (cs_get_user_team(id) == CS_TEAM_SPECTATOR)
				return PLUGIN_HANDLED;
	}	

	if (cs_get_user_team(id) != CS_TEAM_SPECTATOR)
	{
		user_silentkill(id);
		cs_set_user_deaths(id, cs_get_user_deaths(id) - 1);
	}

	cs_set_user_team(id, item + 1, random_num(1, 5));

	// restart round if there is only one player (excl. bot)
	new Players[32], playerCount;
	get_players(Players, playerCount, "c");

	if (playerCount == 1)
		server_cmd("sv_restart 1");

	return PLUGIN_HANDLED;
}

//Jeżeli ktoś wpadnie na pomysł jak to rozwiązać jestem w stanie zapłacić, symboliczną sumkę ale nagroda będzie. $)

[ Dodano: 11-12-2009, 19:27 ]
Czy ktoś jest w stanie to zrobić?
Nawet $ nikogo nie zachęcają? ;P
  • +
  • -
  • 0




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

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