Modificare meniu War3FT

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Post Reply
GODX
Utilizator restrictionat
Utilizator restrictionat
Posts: 30
Joined: 10 Jul 2012, 00:41
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Reputatie: Utilizator Restrictionat: WishExec
Has thanked: 6 times
Contact:

25 Jul 2012, 22:58

A. Daca puteti sa modificati meniu change race
default arata asa :
1.Undead
2.Human
3.ORC
4.Elf
5.Blood
6.Shadow Hunter
7.Warden
8.Crypt Lord
9.Chameleon
0. auto chose / cancel

cum vreau eu :
vreau pagina 1

1.Undead
2.Human
3.ORC
4.Elf
5.Blood
6.Shadow Hunter
7.Warden
8.Crypt Lord
9. NEXT
0. EXIT

si dupa ce dau next sa apara:

1.Chameleon

0. Back

B. Sau daca nu puteti sa faceti prima varianta :
puteti sa faceti asta :

1.Undead
2.Human
3.ORC
4.Elf
5.Blood
6.Shadow Hunter
7.Warden
8.Crypt Lord
9.Chameleon
0. A 10 rasa (in codul normal pe 0 este auto chose race sau cancel)

aici sunt functiile care se ocupa de ce am zis eu :

Code: Select all

public MENU_ChangeRace( id, iRaceXP[MAX_RACES] )
{
	
	new szRaceName[MAX_RACES+1][64], i, pos, iKeys = 0, szMenu[512], szXP[16];

	// Get our race names
	for ( i = 0; i < get_pcvar_num( CVAR_wc3_races ); i++ )
	{
		lang_GetRaceName( i + 1, id, szRaceName[i], 63 );
	}

	pos += formatex( szMenu[pos], 512-pos, "%L", id, "MENU_SELECT_RACE" );

	// Then add the experience column
	if ( get_pcvar_num( CVAR_wc3_save_xp ) )
	{
		pos += formatex( szMenu[pos], 512-pos, "\R%L^n^n", id, "MENU_WORD_EXPERIENCE" );
	}
	else
	{
		pos += formatex( szMenu[pos], 512-pos, "^n^n" );
	}

	// Build the changerace menu (for every race)
	for ( i = 0; i < get_pcvar_num( CVAR_wc3_races ); i++ )
	{
		num_to_str( iRaceXP[i], szXP, 15 );
		
		// Add the "Select a Hero" message if necessary
		if ( i == 4 )
		{
			pos += format( szMenu[pos], 512-pos, "%L", id, "SELECT_HERO" );
		}
		
		// User's current race
		if ( i == p_data[id][P_RACE] - 1 )
		{
			pos += formatex( szMenu[pos], 512-pos, "\d%d. %s\d\R%s^n", i + 1, szRaceName[i], ( (get_pcvar_num( CVAR_wc3_save_xp )) ? szXP : " " ) );

			iKeys |= (1<<i);
		}

		// Race the user wants to change to
		else if ( i == p_data[id][P_CHANGERACE] - 1 )
		{
			pos += formatex( szMenu[pos], 512-pos, "\r%d. %s\r\R%s^n", i + 1, szRaceName[i], ( (get_pcvar_num( CVAR_wc3_save_xp )) ? szXP : " " ) );

			iKeys |= (1<<i);
		}

		// All other cases
		else
		{
			/*
			new iRaceLimit = get_pcvar_num( CVAR_wc3_race_limit );
			new bool:bAllowRace = true;

			if ( iRaceLimit > 0 )
			{
				new iTotal[MAX_RACES];

				// Get how many people are using each race
				new iPlayers[32], iNumPlayers, i, iTarget;
				get_players( iPlayers, iNumPlayers );

				for ( i = 0; i < iNumPlayers; i++ )
				{
					iTarget = iPlayers[i];

					if ( iTarget != id && p_data[iTarget][P_RACE] > 0 && p_data[iTarget][P_RACE] <= get_pcvar_num( CVAR_wc3_races ) )
					{
						iTotal[p_data[iTarget][P_RACE]]++;
					}
				}
				
				// Now if we have more races selected than iRaceLimit provides us with, then we need to increase iRaceLimit
				while ( HLPR_TotalUsingRaces( iTotal ) > iRaceLimit * get_playersnum() )
				{
					iRaceLimit++;
				}

				// Check to see if there was an increase that was necessary
				if ( iRaceLimit > get_pcvar_num( CVAR_wc3_race_limit ) )
				{
					WC3_Log( true, "Error, increase wc3_race_limit to at least %d", iRaceLimit );
				}

				if ( iTotal[i+1] >= iRaceLimit )
				{
					bAllowRace = false;

				}
			}*/

			new bool:bAllowRace = true;

			// Check to see if the user can choose this race (are there too many of this race?)
			if ( bAllowRace )
			{
				pos += formatex( szMenu[pos], 512-pos, "\w%d. %s\y\R%s^n", i + 1, szRaceName[i], ( (get_pcvar_num( CVAR_wc3_save_xp )) ? szXP : " " ) );

				iKeys |= (1<<i);
			}

			// If not, display the race, but don't give them a key to press
			else
			{
				pos += formatex( szMenu[pos], 512-pos, "\d%d. %s\y\R%s^n", i + 1, szRaceName[i], ( (get_pcvar_num( CVAR_wc3_save_xp )) ? szXP : " " ) );
			}
		}

	}

	iKeys |= (1<<i);
	
	// This is needed so we can make the Auto-Select option "0" if the number of races is 9
	if ( get_pcvar_num( CVAR_wc3_races ) == 9 )
	{
		i = -1;
	}

	pos += format( szMenu[pos], 512-pos, "%L", id, "SELECT_RACE_FOOTER", i + 1 );
	
	// Add a cancel button to the bottom
	if ( get_pcvar_num( CVAR_wc3_races ) != 9 )
	{
		iKeys |= (1<<9);

		pos += format( szMenu[pos], 512-pos, "^n\w0. %L", id, "WORD_CANCEL" );
	}
	
	// Show the menu to the user!
	show_menu( id, iKeys, szMenu, -1 );

	return;
}

/*HLPR_TotalUsingRaces( iTotalRaces[MAX_RACES] )
{
	new iTotal = 0;
	for ( new i = 1; i <= get_pcvar_num( CVAR_wc3_races ); i++ )
	{
		WC3_Log( true, "%d", i );
		iTotal += iTotalRaces[i];
	}

	return iTotal;
}*/


si a doua functie 

public _MENU_ChangeRace( id, key )
{

	if ( !WC3_Check() )
	{
		return PLUGIN_HANDLED;
	}
	
	// User pressed 0 (cancel)
	if ( get_pcvar_num( CVAR_wc3_races ) < 9 && key - 1 == get_pcvar_num( CVAR_wc3_races ) )
	{
		return PLUGIN_HANDLED;
	}

	// Save the current race data before we change
	DB_SaveXP( id, false );

	new iRace, iAutoSelectKey = KEY_0;
	
	if ( get_pcvar_num( CVAR_wc3_races ) != 9 )
	{
		iAutoSelectKey = get_pcvar_num( CVAR_wc3_races )
	}
	
	// Auto select a race
	if ( key == iAutoSelectKey )
	{
		iRace = random_num( 1, get_pcvar_num( CVAR_wc3_races ) );
	}

	// Otherwise race is set
	else
	{
		iRace = key + 1;
	}

	// User currently has a race
	if ( p_data[id][P_RACE] != 0 )
	{

		// Change the user's race at the start of next round
		if ( iRace != p_data[id][P_RACE] )
		{
			
			// Special message for csdm
			if ( CVAR_csdm_active > 0 && get_pcvar_num( CVAR_csdm_active ) == 1 )
			{
				client_print( id, print_center, "Your race will be changed when you respawn" );
			}	
			else
			{
				client_print( id, print_center, "%L", id, "CENTER_CHANGED_NEXT" );
			}

			p_data[id][P_CHANGERACE] = iRace;
		}

		// Do nothing
		else
		{
			p_data[id][P_CHANGERACE] = 0;
		}
	}

	// User doesn't have a race so give it to him!!!
	else
	{
		WC3_SetRace( id, iRace );
	}

	return PLUGIN_HANDLED;
}



GODX
Utilizator restrictionat
Utilizator restrictionat
Posts: 30
Joined: 10 Jul 2012, 00:41
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Reputatie: Utilizator Restrictionat: WishExec
Has thanked: 6 times
Contact:

25 Jul 2012, 23:16

Cineva pe un forum a zis sa fac changeracemenu2

if ( key == iAutoSelectKey )//buttons 0
{
menurace(index)
}

dar nu stiu prin ce sa referit cu menurace(index)

probabil sa arate asa :

1.Undead
2.Human
3.ORC
4.Elf
5.Blood
6.Shadow Hunter
7.Warden
8.Crypt Lord
9.Chameleon
0. Next si asa este bine ... dar nu ma prea pricep ... pentru voi ca fiind profesionisti cu siguranta va fi usor sa intelegeti meniurile astea
User avatar
Ulquiorra
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2054
Joined: 25 Jul 2010, 16:29
Detinator Steam: Da
CS Status: A mai trecut o zi asteptand una mai buna
Detinator server CS: Retras.
SteamID: STEAM_0:1:318247XX
Reputatie: Scripter eXtreamCS
Nick anterior: sPuf ?, a^ml), Loca Tapioca, Askhanar
Fost Moderator ajutator
Location: Braila, Romania.
Has thanked: 214 times
Been thanked: 1131 times
Contact:

26 Jul 2012, 16:09

din pacate meniul este creat automat.. luand numele raselor din fisierul din data/lang.. si nu sunt adaugate manual..
ca sa faci acest lucru nu sunt sigur ca va mai functiona normal.. si vor fi multe bug`uri.. + ca nu trebuie modificat doar ce ai dat tu.. ci si HANDLER-ul de la meniu + callback..
""Copilarie, iarta-ma c-am vrut sa fiu om mare.. ""
GODX
Utilizator restrictionat
Utilizator restrictionat
Posts: 30
Joined: 10 Jul 2012, 00:41
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Reputatie: Utilizator Restrictionat: WishExec
Has thanked: 6 times
Contact:

27 Jul 2012, 16:39

stiu datele sunt luate din alte foldere ale modului .. deja am facut partea asta ...

problema e sa scot butonu 0 (care face autochoserace / cancel ) si sa il fac tot pentru rasa ... gen

// This is needed so we can make the Auto-Select option "0" if the number of races is 9
if ( get_pcvar_num( CVAR_wc3_races ) == 9 )
{
i = -1;
}

pos += format( szMenu[pos], 512-pos, "%L", id, "SELECT_RACE_FOOTER", i + 1 );

// Add a cancel button to the bottom
if ( get_pcvar_num( CVAR_wc3_races ) != 9 )
{
iKeys |= (1<<9);

pos += format( szMenu[pos], 512-pos, "^n\w0. %L", id, "WORD_CANCEL" );
}

e ceva legat de astea ...
OWNX
Utilizator restrictionat
Utilizator restrictionat
Posts: 247
Joined: 23 Aug 2013, 23:09
Detinator Steam: Da
CS Status: dani_ownx@yahoo.com
Detinator server CS: Server Privat
SteamID: Privat
Reputatie: Utilizator Restrictionat: WishExec
Location: Bragadiru
Has thanked: 10 times
Been thanked: 24 times
Contact:

19 Sep 2013, 13:14

te pot ajuta eu ... da-mi add dani_ownx
Email :[/color] dani_ownx@yahoo.com


* Privat War3FT V5.0 ( 10 Euro AMXX + SMA ) : http://www.extreamcs.com/forum/anunturi ... 15532.html
DEMO : 93.119.26.151
* Privat UWC3X V4.0 ( 15 Euro AMXX ) : http://www.extreamcs.com/forum/anunturi ... l#p1810595
DEMO : 89.39.13.139

Accept Oferte si Negocieri prin PM
Post Reply

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 21 guests