Jump to content

- Advertisement -
Photo

Cum pui submeniuri[Nerezolvat]


  • This topic is locked This topic is locked
6 replies to this topic

#1
D3luxe

D3luxe

    Advanced Member

  • Membru
  • 179 posts
  • 22 topics
  • Joined 28-June 14
  • Country: Country Flag
Cum spune si titlul vreau sa imi spuneti cum pun submeniuri la un meniu .Si cum modific dmg unui knife anume (un model) ms anticipat :).Am sa dau si sma daca trebuie si puteti sa modificati :)

#2
Andrei;

Andrei;

    Administrator

  • Administrator
  • 3201 posts
  • 398 topics
  • Joined 16-December 12
  • Country: Country Flag

Topic mutat la CS16-Scrpting -> Help. 

 

In caseul respectiv pui ceva genu ShowSubMenu( id ) sau numele publicului in care ai celalalt meniul pe care vrei sa il arati. Pentru dmg, inregistrezi Ham_TakeDamage, verifici daca arma e knife si folosesti SetHamParamFloat.



#3
D3luxe

D3luxe

    Advanced Member

  • Topic Starter

  • Membru
  • 179 posts
  • 22 topics
  • Joined 28-June 14
  • Country: Country Flag

Topic mutat la CS16-Scrpting -> Help. 
 
In caseul respectiv pui ceva genu ShowSubMenu( id ) sau numele publicului in care ai celalalt meniul pe care vrei sa il arati. Pentru dmg, inregistrezi Ham_TakeDamage, verifici daca arma e knife si folosesti SetHamParamFloat.

Topic mutat la CS16-Scrpting -> Help. 
 
In caseul respectiv pui ceva genu ShowSubMenu( id ) sau numele publicului in care ai celalalt meniul pe care vrei sa il arati. Pentru dmg, inregistrezi Ham_TakeDamage, verifici daca arma e knife si folosesti SetHamParamFloat.

Nu vreau sa te supar insa sunt la inceput cu acest limbaj :)) am incercat sa modific insa imi da eroare la compilare iar cu submeniurile vroiam sa pun asa meniu armament
meniu knife
meniu abilitati
10000$
insa am incercat si tot nu am reusit primeam mai multe erori la compilare..
uite aici sma daca ai putea sa imi arat i cum sa modific dmg pentru unul din acele knif-uri din vip menu si cum sa fac submeniurile mai concret ar fi foarte frumos :)
Spoiler


#4
Andrei;

Andrei;

    Administrator

  • Administrator
  • 3201 posts
  • 398 topics
  • Joined 16-December 12
  • Country: Country Flag

Ok.

 

1. SubMeniu:

public func( id )
{
	new menu = menu_create( "test", "test_handler" )
	menu_additem( menu, "t", "", 0 )
	menu_additem( menu, "t1", "", 0 )
}

public test_handler( id, menu, item )
{
	if( item == MENU_EXIT )
	{
		menu_destroy( menu )
	}
	
	switch( item )
	{
		//corespunde itemului t
		case 0:
		{
			client_print( id, print_chat, "Ai ales t" )
		}
		
		//corespunde itemului t1
		//t1 va trimite catre un sub meniu
		case 1:
		{
			ShowSecondMenu( id )
		}
	}
	
	menu_destroy( menu )
	return 1
}

public ShowSecondMenu( id )
{
	new menu = menu_create( "sub_menu", "sub_menu_handler" )
	menu_additem( menu, "s", "", 0 )
	menu_additem( menu, "s1", "", 0 )
}

public sub_menu_handler( id, menu, item )
{
	if( item == MENU_EXIT )
	{
		menu_destroy( menu )
	}
	
	switch( item )
	{
		//corespunde itemului s
		case 0:
		{
			client_print( id, print_chat, "Ai ales s" )
		}
		
		//corespunde itemului s1
		case 1:
		{
			client_print( id, print_chat, "Ai ales s1" )
		}
	}
	
	menu_destroy( menu )
	return 1
}

Un exemplu simplu, e imposibil sa nu intelegi. Cam asa vine: meniu_principal -> handler -> meniu_secundar -> handler_meniu_secundar

 

2. Pentru DMG:

#include < fakemeta > //doar daca folosesti global_get
#include < hamsandwich >

#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )  

new g_iMaxPlayers

public plugin_init( id )
{
	RegisterHam( Ham_TakeDamage, "player", "CBasePlayer_TakeDamage" ) 
	
	g_iMaxPlayers = global_get( glb_maxClients ) // sau g_iMaxPlayers = get_maxplayers( )
}

public CBasePlayer_TakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage ) 
{    
    if( iInflictor == iAttacker && IsPlayer ( iAttacker ) && get_user_weapon( id ) == CSW_KNIFE ) 
	{
        SetHamParamFloat( 4, fDamage * 2.0 )
        return HAM_HANDLED;
        
    }
    
    return HAM_IGNORED;
    
}


#5
D3luxe

D3luxe

    Advanced Member

  • Topic Starter

  • Membru
  • 179 posts
  • 22 topics
  • Joined 28-June 14
  • Country: Country Flag

Ok.
 
1. SubMeniu:

public func( id )
{
	new menu = menu_create( "test", "test_handler" )
	menu_additem( menu, "t", "", 0 )
	menu_additem( menu, "t1", "", 0 )
}

public test_handler( id, menu, item )
{
	if( item == MENU_EXIT )
	{
		menu_destroy( menu )
	}
	
	switch( item )
	{
		//corespunde itemului t
		case 0:
		{
			client_print( id, print_chat, "Ai ales t" )
		}
		
		//corespunde itemului t1
		//t1 va trimite catre un sub meniu
		case 1:
		{
			ShowSecondMenu( id )
		}
	}
	
	menu_destroy( menu )
	return 1
}

public ShowSecondMenu( id )
{
	new menu = menu_create( "sub_menu", "sub_menu_handler" )
	menu_additem( menu, "s", "", 0 )
	menu_additem( menu, "s1", "", 0 )
}

public sub_menu_handler( id, menu, item )
{
	if( item == MENU_EXIT )
	{
		menu_destroy( menu )
	}
	
	switch( item )
	{
		//corespunde itemului s
		case 0:
		{
			client_print( id, print_chat, "Ai ales s" )
		}
		
		//corespunde itemului s1
		case 1:
		{
			client_print( id, print_chat, "Ai ales s1" )
		}
	}
	
	menu_destroy( menu )
	return 1
}
Un exemplu simplu, e imposibil sa nu intelegi. Cam asa vine: meniu_principal -> handler -> meniu_secundar -> handler_meniu_secundar
 
2. Pentru DMG:
#include < fakemeta > //doar daca folosesti global_get
#include < hamsandwich >

#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )  

new g_iMaxPlayers

public plugin_init( id )
{
	RegisterHam( Ham_TakeDamage, "player", "CBasePlayer_TakeDamage" ) 
	
	g_iMaxPlayers = global_get( glb_maxClients ) // sau g_iMaxPlayers = get_maxplayers( )
}

public CBasePlayer_TakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage ) 
{    
    if( iInflictor == iAttacker && IsPlayer ( iAttacker ) && get_user_weapon( id ) == CSW_KNIFE ) 
	{
        SetHamParamFloat( 4, fDamage * 2.0 )
        return HAM_HANDLED;
        
    }
    
    return HAM_IGNORED;
    
}

Bun am inteles cu submeniurile.. insa la cutite tot nu prea am inteles eu vr sa pun dmg la un model anume de cutit . pentru ca am mai multe in vipmenu.MS pentru ajutor:)

#6
Andrei;

Andrei;

    Administrator

  • Administrator
  • 3201 posts
  • 398 topics
  • Joined 16-December 12
  • Country: Country Flag

Cand alege cutitul x din meniu seteaza un bool pe true. In Ham_TakeDamage verifica ce valoarea boolului, daca e true ii modifici dmg. Boolul il poti reseta la spawn.



#7
Bogdan ;

Bogdan ;

    Fost Resource Team

  • Retired
  • 4341 posts
  • 386 topics
  • Joined 14-March 13
  • Country: Country Flag

Se vede cat interes dai acestui topic

 

Group Membru Active Posts 179 Member Since 28-June 14 Last Active OFFLINE Sep 04 2014 05:30 PM
In caz ca vrei redeschiderea topicului imi dai pm.

Edited by Bogdan ;, 15 September 2014 - 08:17 PM.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users