[Cerere] Clase Furien!

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
yoNNy # Bio
Membru, skill 0
Membru, skill 0
Posts: 2
Joined: 04 Dec 2013, 14:18
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Has thanked: 3 times
Contact:

04 Dec 2013, 14:25

Salut! Cine ma poate ajuta si pe mine sa scot din urmatorul plugin Modelele? Adica cand adaug o clasa sa nu fiu nevoit sa mai adaug si model. Vreau sa-mi scoateti modelul, de fapt !
SMA | Afiseaza codul
/*
	----------------------
	-*- Licensing Info -*-
	----------------------

	Advanced Furien Classes 1.1
	Copyright (C) 2013 by KronoS # GG

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.

	----------------------
	-*-   Changelog    -*-
	----------------------

	* v1.1 - 20.10.2013
	- Extended API
	- Messages when you select a furien class
	- Informing message

	* v1.0 - 19.10.2013
	- Initial release

	----------------------
	-*-    Credits     -*-
	----------------------

	Askhanar - for changing player models with delay

*/

#include < amxmodx >
#include < cstrike >
#include < fakemeta >
#include < fun >
#include < hamsandwich >

// Tasks
#define TASK_MODELS 10100

enum _:FurienClassData
{
    	ClassName[ 32 ],
   	ClassDesc[ 32 ],
	ClassModel[ 32 ],
	ClassHP,
	ClassSpeed,
	ClassGrav
}

new const AFC_Version[ ] = "1.1";

new Array:g_FurienClasses, g_iTotalFurienClasses, g_FurienSelectClassFwd;
new g_FirstSpawn[ 33 ], g_CurFurienClass[ 33 ], g_NextFurienClass[ 33 ];

public plugin_precache( )
{
	// Early register to avoid errors
	register_plugin "Advanced Furien Classes", AFC_Version, "KronoS # GG" ;

	// Create the classes array
	g_FurienClasses = ArrayCreate( FurienClassData );
}

public plugin_init( )
{
	// Disable the plugin if no classes were found
	if ( !g_iTotalFurienClasses )
		set_fail_state( "[AFC] This plugin can't run because no furien classes were found!" );

	RegisterHam( Ham_Spawn, "player", "Event_PlayerSpawn", 1 );
	register_event( "CurWeapon", "Event_CurWeapon", "be", "1=1" );

	// Player commands
	register_clcmd( "say /class", "Func_CmdChangeClass" );
	register_clcmd( "say_team /class", "Func_CmdChangeClass" );

	// Forward
	g_FurienSelectClassFwd = CreateMultiForward( "afc_furien_class_selected", ET_IGNORE, FP_CELL, FP_CELL );

	// Informing message
	set_task( 120.0, "Func_DisplayInfo", _, _, _, "b" );
}

public plugin_natives( )
{
	// Plugin natives
	register_native( "afc_register_furien_class", "native_register_furien_class" );
	register_native( "afc_get_user_furien_class", "native_get_user_furien_class" );
	register_native( "afc_set_user_furien_class", "native_set_user_furien_class" );
}

public client_putinserver( index )
{
	// Reset
	g_CurFurienClass[ index ] = 1;
	g_NextFurienClass[ index ] = 1;
	g_FirstSpawn[ index ] = 1;
}

public Event_PlayerSpawn( index )
{
	// Fix - check if the player was spawned
	if ( is_user_alive( index ) )
	{
		// Check if player is a furien
		if ( cs_get_user_team( index ) == CS_TEAM_T )
		{
			// Check if it's the first time the user is spawned
			if ( g_FirstSpawn[ index ] )
			{
				g_FirstSpawn[ index ] = 0;

				// Display the menu of classes
				Func_ShowFurienClasses( index, .page = 0 );
			}

			// Change the current class if another one was selected
			g_CurFurienClass[ index ] = g_NextFurienClass[ index ];

			// Retrieve the data of the class
    			new eItemData[ FurienClassData ];
			new iClassIndex = g_CurFurienClass[ index ] - 1;
   			ArrayGetArray( g_FurienClasses, iClassIndex, eItemData );

			// Set player attributes
			set_user_health( index, eItemData[ ClassHP ] );
			set_user_gravity( index, Float:eItemData[ ClassGrav ] );

			Func_SplitModelChange( index );
		}
	}
}

// Credits to Askhanar for this method
public Func_SplitModelChange( index )
{
	switch ( index ) 
	{ 
		case 1..6: set_task( 0.1, "Func_ChangeFurienModel", index + TASK_MODELS ); 
		case 7..13: set_task( 0.2, "Func_ChangeFurienModel", index + TASK_MODELS ); 
		case 14..20: set_task( 0.3, "Func_ChangeFurienModel", index + TASK_MODELS ); 
		case 21..26: set_task( 0.4, "Func_ChangeFurienModel", index + TASK_MODELS ); 
		case 27..32: set_task( 0.5, "Func_ChangeFurienModel", index + TASK_MODELS ); 
	} 
}

public Func_ChangeFurienModel( index )
{
	index -= TASK_MODELS;

	// Check is player is still alive
	if ( !is_user_alive( index ) )
		return;

	// Retrieve the data of the class
    	new eItemData[ FurienClassData ];
	new iClassIndex = g_CurFurienClass[ index ] - 1;
   	ArrayGetArray( g_FurienClasses, iClassIndex, eItemData );

	// Change his model
	cs_set_user_model( index, eItemData[ ClassModel ] );
}

public Event_CurWeapon( index )
{
	if ( !is_user_alive( index ) )
		return;

	if ( cs_get_user_team( index ) == CS_TEAM_T )
	{
		// Retrieve the data of the class
    		new eItemData[ FurienClassData ];
		new iClassIndex = g_CurFurienClass[ index ] - 1;
   		ArrayGetArray( g_FurienClasses, iClassIndex, eItemData );

		// Set furien speed
		set_pev( index, pev_maxspeed, float( eItemData[ ClassSpeed ] ) );
	}
}

public Func_CmdChangeClass( index )
{
	// Print the menu starting from the first page
	Func_ShowFurienClasses( index, .page = 0 );
}

Func_ShowFurienClasses( index, page )
{
    	if ( !g_iTotalFurienClasses )
        	return;
    
    	page = clamp( page, 0, ( g_iTotalFurienClasses - 1 ) / 7 );
    
	// Create the classes menu
    	new iMenu = menu_create( "\r[AFC] Choose a Furien class:", "Handler_ClassesMenu" );
    
    	new eItemData[ FurienClassData ], szItem[ 64 ], szNum[ 3 ];
    
	// Loop through each loaded class
    	for ( new class = 0 ; class < g_iTotalFurienClasses ; class++ )
    	{
        	ArrayGetArray( g_FurienClasses, class, eItemData );
        
		if ( class == ( g_NextFurienClass[ index ] - 1 ) )
        		formatex( szItem, charsmax( szItem ), "\d%s [%s]", eItemData[ ClassName ], eItemData[ ClassDesc ] );
		else
	        	formatex( szItem, charsmax( szItem ), "%s \y[%s]", eItemData[ ClassName ], eItemData[ ClassDesc ] );
        
        	num_to_str( class, szNum, charsmax( szNum ) );
        
        	menu_additem( iMenu, szItem, szNum );
    	}

	// Display the classes menu
    	menu_display( index, iMenu, page );
}

// Furien classes menu handler
public Handler_ClassesMenu( index, menu, item )
{
    	if ( item == MENU_EXIT )
    	{
        	menu_destroy( menu );
        	return;
    	}
    
    	new iAccess, szNum[ 3 ], hCallback;
    	menu_item_getinfo( menu, item, iAccess, szNum, charsmax( szNum ), _, _, hCallback );

	// Get the index of the class
    	new iClassIndex = str_to_num( szNum );
    
	// Extract class data from the array
    	new eItemData[ FurienClassData ];
    	ArrayGetArray( g_FurienClasses, iClassIndex, eItemData );
    
	// Set the next furien class for player
	g_NextFurienClass[ index ] = str_to_num( szNum ) + 1;

	client_print( index, print_chat, "[AFC] Your furien class after the next spawn will be %", eItemData[ ClassName ] );
	client_print( index, print_chat, "[AFC] HP: %i | Speed: %i | Gravity: %i", eItemData[ ClassHP ], eItemData[ ClassSpeed ], floatround( eItemData[ ClassGrav ] * 800.0 ) );
    
    	menu_destroy( menu );

	// Inform external plugins that a class has been selected
        new iReturn;
        ExecuteForward( g_FurienSelectClassFwd, iReturn, index, iClassIndex );
}

public Func_DisplayInfo( )
{
	// Print an informing message
	client_print( 0, print_chat, "[AFC] Type /class to change your furien class" );
}

// Native: afc_register_furien_class
public native_register_furien_class( iPlugin, iParams )
{
	// Create an array to hold the data of the registered class
    	new eClassData[ FurienClassData ];
    
	// Get the data of the registered class
    	get_string( 1, eClassData[ ClassName ], charsmax( eClassData[ ClassName ] ) );
    	get_string( 2, eClassData[ ClassDesc ], charsmax( eClassData[ ClassDesc ] ) );
    	get_string( 3, eClassData[ ClassModel ], charsmax( eClassData[ ClassModel ] ) );
    
    	eClassData[ ClassHP ] = get_param( 4 );
    	eClassData[ ClassSpeed ] = get_param( 5 );
    	eClassData[ ClassGrav ] = get_param( 6 );

	// Precache the model of the class
	new szClassModel[ 128 ];
	formatex( szClassModel, charsmax( szClassModel ), "models/player/%s/%s.mdl", eClassData[ ClassModel ], eClassData[ ClassModel ] );
	precache_model( szClassModel );
    
	// Add the class to the array
    	ArrayPushArray( g_FurienClasses, eClassData );

	// Increase the number of registered classes
    	g_iTotalFurienClasses++;
    
	// Return the index of the registered class
    	return ( g_iTotalFurienClasses - 1 );
}

// Native: afc_get_user_furien_class
public native_get_user_furien_class( index )
	return g_CurFurienClass[ index ];

// Native: afc_set_user_furien_class
public native_set_user_furien_class( index, class )
{
	if ( class < 0 || class >= g_iTotalFurienClasses )
		return 0;
	
	g_NextFurienClass[ index ] = class;
	return 1;
}
Eu am incercat si nu mi.a iesit !
RoyalServer
User avatar
YONTU
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2466
Joined: 10 May 2013, 14:25
Detinator Steam: Nu
CS Status: Everyone is looking at ur shoes
Reputatie: Moderator ajutator
Fost scripter eXtreamCS
Location: Gura Humorului
Has thanked: 256 times
Been thanked: 288 times
Contact:

04 Dec 2013, 18:07

yoNNy # Bio wrote:Salut! Cine ma poate ajuta si pe mine sa scot din urmatorul plugin Modelele? Adica cand adaug o clasa sa nu fiu nevoit sa mai adaug si model. Vreau sa-mi scoateti modelul, de fapt !
SMA | Afiseaza codul
/*
	----------------------
	-*- Licensing Info -*-
	----------------------

	Advanced Furien Classes 1.1
	Copyright (C) 2013 by KronoS # GG

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.

	----------------------
	-*-   Changelog    -*-
	----------------------

	* v1.1 - 20.10.2013
	- Extended API
	- Messages when you select a furien class
	- Informing message

	* v1.0 - 19.10.2013
	- Initial release

	----------------------
	-*-    Credits     -*-
	----------------------

	Askhanar - for changing player models with delay

*/

#include < amxmodx >
#include < cstrike >
#include < fakemeta >
#include < fun >
#include < hamsandwich >

// Tasks
#define TASK_MODELS 10100

enum _:FurienClassData
{
    	ClassName[ 32 ],
   	ClassDesc[ 32 ],
	ClassModel[ 32 ],
	ClassHP,
	ClassSpeed,
	ClassGrav
}

new const AFC_Version[ ] = "1.1";

new Array:g_FurienClasses, g_iTotalFurienClasses, g_FurienSelectClassFwd;
new g_FirstSpawn[ 33 ], g_CurFurienClass[ 33 ], g_NextFurienClass[ 33 ];

public plugin_precache( )
{
	// Early register to avoid errors
	register_plugin "Advanced Furien Classes", AFC_Version, "KronoS # GG" ;

	// Create the classes array
	g_FurienClasses = ArrayCreate( FurienClassData );
}

public plugin_init( )
{
	// Disable the plugin if no classes were found
	if ( !g_iTotalFurienClasses )
		set_fail_state( "[AFC] This plugin can't run because no furien classes were found!" );

	RegisterHam( Ham_Spawn, "player", "Event_PlayerSpawn", 1 );
	register_event( "CurWeapon", "Event_CurWeapon", "be", "1=1" );

	// Player commands
	register_clcmd( "say /class", "Func_CmdChangeClass" );
	register_clcmd( "say_team /class", "Func_CmdChangeClass" );

	// Forward
	g_FurienSelectClassFwd = CreateMultiForward( "afc_furien_class_selected", ET_IGNORE, FP_CELL, FP_CELL );

	// Informing message
	set_task( 120.0, "Func_DisplayInfo", _, _, _, "b" );
}

public plugin_natives( )
{
	// Plugin natives
	register_native( "afc_register_furien_class", "native_register_furien_class" );
	register_native( "afc_get_user_furien_class", "native_get_user_furien_class" );
	register_native( "afc_set_user_furien_class", "native_set_user_furien_class" );
}

public client_putinserver( index )
{
	// Reset
	g_CurFurienClass[ index ] = 1;
	g_NextFurienClass[ index ] = 1;
	g_FirstSpawn[ index ] = 1;
}

public Event_PlayerSpawn( index )
{
	// Fix - check if the player was spawned
	if ( is_user_alive( index ) )
	{
		// Check if player is a furien
		if ( cs_get_user_team( index ) == CS_TEAM_T )
		{
			// Check if it's the first time the user is spawned
			if ( g_FirstSpawn[ index ] )
			{
				g_FirstSpawn[ index ] = 0;

				// Display the menu of classes
				Func_ShowFurienClasses( index, .page = 0 );
			}

			// Change the current class if another one was selected
			g_CurFurienClass[ index ] = g_NextFurienClass[ index ];

			// Retrieve the data of the class
    			new eItemData[ FurienClassData ];
			new iClassIndex = g_CurFurienClass[ index ] - 1;
   			ArrayGetArray( g_FurienClasses, iClassIndex, eItemData );

			// Set player attributes
			set_user_health( index, eItemData[ ClassHP ] );
			set_user_gravity( index, Float:eItemData[ ClassGrav ] );

			Func_SplitModelChange( index );
		}
	}
}

// Credits to Askhanar for this method
public Func_SplitModelChange( index )
{
	switch ( index ) 
	{ 
		case 1..6: set_task( 0.1, "Func_ChangeFurienModel", index + TASK_MODELS ); 
		case 7..13: set_task( 0.2, "Func_ChangeFurienModel", index + TASK_MODELS ); 
		case 14..20: set_task( 0.3, "Func_ChangeFurienModel", index + TASK_MODELS ); 
		case 21..26: set_task( 0.4, "Func_ChangeFurienModel", index + TASK_MODELS ); 
		case 27..32: set_task( 0.5, "Func_ChangeFurienModel", index + TASK_MODELS ); 
	} 
}

public Func_ChangeFurienModel( index )
{
	index -= TASK_MODELS;

	// Check is player is still alive
	if ( !is_user_alive( index ) )
		return;

	// Retrieve the data of the class
    	new eItemData[ FurienClassData ];
	new iClassIndex = g_CurFurienClass[ index ] - 1;
   	ArrayGetArray( g_FurienClasses, iClassIndex, eItemData );

	// Change his model
	cs_set_user_model( index, eItemData[ ClassModel ] );
}

public Event_CurWeapon( index )
{
	if ( !is_user_alive( index ) )
		return;

	if ( cs_get_user_team( index ) == CS_TEAM_T )
	{
		// Retrieve the data of the class
    		new eItemData[ FurienClassData ];
		new iClassIndex = g_CurFurienClass[ index ] - 1;
   		ArrayGetArray( g_FurienClasses, iClassIndex, eItemData );

		// Set furien speed
		set_pev( index, pev_maxspeed, float( eItemData[ ClassSpeed ] ) );
	}
}

public Func_CmdChangeClass( index )
{
	// Print the menu starting from the first page
	Func_ShowFurienClasses( index, .page = 0 );
}

Func_ShowFurienClasses( index, page )
{
    	if ( !g_iTotalFurienClasses )
        	return;
    
    	page = clamp( page, 0, ( g_iTotalFurienClasses - 1 ) / 7 );
    
	// Create the classes menu
    	new iMenu = menu_create( "\r[AFC] Choose a Furien class:", "Handler_ClassesMenu" );
    
    	new eItemData[ FurienClassData ], szItem[ 64 ], szNum[ 3 ];
    
	// Loop through each loaded class
    	for ( new class = 0 ; class < g_iTotalFurienClasses ; class++ )
    	{
        	ArrayGetArray( g_FurienClasses, class, eItemData );
        
		if ( class == ( g_NextFurienClass[ index ] - 1 ) )
        		formatex( szItem, charsmax( szItem ), "\d%s [%s]", eItemData[ ClassName ], eItemData[ ClassDesc ] );
		else
	        	formatex( szItem, charsmax( szItem ), "%s \y[%s]", eItemData[ ClassName ], eItemData[ ClassDesc ] );
        
        	num_to_str( class, szNum, charsmax( szNum ) );
        
        	menu_additem( iMenu, szItem, szNum );
    	}

	// Display the classes menu
    	menu_display( index, iMenu, page );
}

// Furien classes menu handler
public Handler_ClassesMenu( index, menu, item )
{
    	if ( item == MENU_EXIT )
    	{
        	menu_destroy( menu );
        	return;
    	}
    
    	new iAccess, szNum[ 3 ], hCallback;
    	menu_item_getinfo( menu, item, iAccess, szNum, charsmax( szNum ), _, _, hCallback );

	// Get the index of the class
    	new iClassIndex = str_to_num( szNum );
    
	// Extract class data from the array
    	new eItemData[ FurienClassData ];
    	ArrayGetArray( g_FurienClasses, iClassIndex, eItemData );
    
	// Set the next furien class for player
	g_NextFurienClass[ index ] = str_to_num( szNum ) + 1;

	client_print( index, print_chat, "[AFC] Your furien class after the next spawn will be %", eItemData[ ClassName ] );
	client_print( index, print_chat, "[AFC] HP: %i | Speed: %i | Gravity: %i", eItemData[ ClassHP ], eItemData[ ClassSpeed ], floatround( eItemData[ ClassGrav ] * 800.0 ) );
    
    	menu_destroy( menu );

	// Inform external plugins that a class has been selected
        new iReturn;
        ExecuteForward( g_FurienSelectClassFwd, iReturn, index, iClassIndex );
}

public Func_DisplayInfo( )
{
	// Print an informing message
	client_print( 0, print_chat, "[AFC] Type /class to change your furien class" );
}

// Native: afc_register_furien_class
public native_register_furien_class( iPlugin, iParams )
{
	// Create an array to hold the data of the registered class
    	new eClassData[ FurienClassData ];
    
	// Get the data of the registered class
    	get_string( 1, eClassData[ ClassName ], charsmax( eClassData[ ClassName ] ) );
    	get_string( 2, eClassData[ ClassDesc ], charsmax( eClassData[ ClassDesc ] ) );
    	get_string( 3, eClassData[ ClassModel ], charsmax( eClassData[ ClassModel ] ) );
    
    	eClassData[ ClassHP ] = get_param( 4 );
    	eClassData[ ClassSpeed ] = get_param( 5 );
    	eClassData[ ClassGrav ] = get_param( 6 );

	// Precache the model of the class
	new szClassModel[ 128 ];
	formatex( szClassModel, charsmax( szClassModel ), "models/player/%s/%s.mdl", eClassData[ ClassModel ], eClassData[ ClassModel ] );
	precache_model( szClassModel );
    
	// Add the class to the array
    	ArrayPushArray( g_FurienClasses, eClassData );

	// Increase the number of registered classes
    	g_iTotalFurienClasses++;
    
	// Return the index of the registered class
    	return ( g_iTotalFurienClasses - 1 );
}

// Native: afc_get_user_furien_class
public native_get_user_furien_class( index )
	return g_CurFurienClass[ index ];

// Native: afc_set_user_furien_class
public native_set_user_furien_class( index, class )
{
	if ( class < 0 || class >= g_iTotalFurienClasses )
		return 0;
	
	g_NextFurienClass[ index ] = class;
	return 1;
}
Eu am incercat si nu mi.a iesit !
BUMMMMM !
| Afiseaza codul
#include < amxmodx >
#include < cstrike >
#include < fakemeta >
#include < fun >
#include < hamsandwich >

enum _:FurienClassData {
	
	ClassName[ 32 ],
	ClassDesc[ 32 ],
	ClassHP,
	ClassSpeed,
	ClassGrav
}

new const AFC_Version[  ] = "1.1";

new Array:g_FurienClasses, g_iTotalFurienClasses, g_FurienSelectClassFwd;
new g_FirstSpawn[ 33 ], g_CurFurienClass[ 33 ], g_NextFurienClass[ 33 ];

public plugin_precache(  ) {
	
	register_plugin( "Advanced Furien Classes", AFC_Version, "KronoS # GG" );
	
	g_FurienClasses = ArrayCreate( FurienClassData );
}

public plugin_init(  ) {
	
	if ( !g_iTotalFurienClasses )
		set_fail_state( "[AFC] This plugin can't run because no furien classes were found!" );
	
	RegisterHam( Ham_Spawn, "player", "Event_PlayerSpawn", 1 );
	register_event( "CurWeapon", "Event_CurWeapon", "be", "1=1" );
	
	register_clcmd( "say /class", "Func_CmdChangeClass" );
	register_clcmd( "say_team /class", "Func_CmdChangeClass" );
	
	g_FurienSelectClassFwd = CreateMultiForward( "afc_furien_class_selected", ET_IGNORE, FP_CELL, FP_CELL );
	
	set_task( 120.0, "Func_DisplayInfo", _, _, _, "b" );
}

public plugin_natives(  ) {
	
	register_native( "afc_register_furien_class", "native_register_furien_class" );
	register_native( "afc_get_user_furien_class", "native_get_user_furien_class" );
	register_native( "afc_set_user_furien_class", "native_set_user_furien_class" );
}

public client_putinserver( index ) {
	
	g_CurFurienClass[ index ] = 1;
	g_NextFurienClass[ index ] = 1;
	g_FirstSpawn[ index ] = 1;
}

public Event_PlayerSpawn( index ) {
	
	if ( is_user_alive( index ) ) {
		
		if ( cs_get_user_team( index ) == CS_TEAM_T ) {
			
			if ( g_FirstSpawn[ index ] ) {
				
				g_FirstSpawn[ index ] = 0;
				
				Func_ShowFurienClasses( index, .page = 0 );
			}
			
			g_CurFurienClass[ index ] = g_NextFurienClass[ index ];
			
			new eItemData[ FurienClassData ];
			new iClassIndex = g_CurFurienClass[ index ] - 1;
			ArrayGetArray( g_FurienClasses, iClassIndex, eItemData );
			
			set_user_health( index, eItemData[ ClassHP ] );
			set_user_gravity( index, Float:eItemData[ ClassGrav ] );
		}
	}
}

public Event_CurWeapon( index ) {
	
	if( !is_user_alive( index ) )
		return;
	
	if( cs_get_user_team( index ) == CS_TEAM_T ) {
		
		new eItemData[ FurienClassData ];
		new iClassIndex = g_CurFurienClass[ index ] - 1;
		ArrayGetArray( g_FurienClasses, iClassIndex, eItemData );
		
		set_pev( index, pev_maxspeed, float( eItemData[ ClassSpeed ] ) );
	}
}

public Func_CmdChangeClass( index ) {
	
	Func_ShowFurienClasses( index, .page = 0 );
}

Func_ShowFurienClasses( index, page ) {
	
	if( !g_iTotalFurienClasses )
		return;
	
	page = clamp( page, 0, ( g_iTotalFurienClasses - 1 ) / 7 );
	
	new iMenu = menu_create( "\r[AFC] Choose a Furien class:", "Handler_ClassesMenu" );
	
	new eItemData[ FurienClassData ], szItem[ 64 ], szNum[ 3 ];
	
	for( new class = 0 ; class < g_iTotalFurienClasses ; class++ ) {
		
		ArrayGetArray( g_FurienClasses, class, eItemData );
		
		if ( class == ( g_NextFurienClass[ index ] - 1 ) )
			formatex( szItem, charsmax( szItem ), "\d%s [%s]", eItemData[ ClassName ], eItemData[ ClassDesc ] );
		else
			formatex( szItem, charsmax( szItem ), "%s \y[%s]", eItemData[ ClassName ], eItemData[ ClassDesc ] );
		
		num_to_str( class, szNum, charsmax( szNum ) );
		
		menu_additem( iMenu, szItem, szNum );
	}
	
	menu_display( index, iMenu, page );
}

public Handler_ClassesMenu( index, menu, item ) {
	
	if ( item == MENU_EXIT ) {
		
		menu_destroy( menu );
		return;
	}
	
	new iAccess, szNum[ 3 ], hCallback;
	menu_item_getinfo( menu, item, iAccess, szNum, charsmax( szNum ), _, _, hCallback );
	
	new iClassIndex = str_to_num( szNum );
	
	new eItemData[ FurienClassData ];
	ArrayGetArray( g_FurienClasses, iClassIndex, eItemData );
	
	g_NextFurienClass[ index ] = str_to_num( szNum ) + 1;
	
	client_print( index, print_chat, "[AFC] Your furien class after the next spawn will be %", eItemData[ ClassName ] );
	client_print( index, print_chat, "[AFC] HP: %i | Speed: %i | Gravity: %i", eItemData[ ClassHP ], eItemData[ ClassSpeed ], floatround( eItemData[ ClassGrav ] * 800.0 ) );
	
	menu_destroy( menu );
	
	new iReturn;
	ExecuteForward( g_FurienSelectClassFwd, iReturn, index, iClassIndex );
}

public Func_DisplayInfo(  ) {
	
	client_print( 0, print_chat, "[AFC] Type /class to change your furien class" );
}

public native_register_furien_class( iPlugin, iParams ) {
	
	new eClassData[ FurienClassData ];
	
	get_string( 1, eClassData[ ClassName ], charsmax( eClassData[ ClassName ] ) );
	get_string( 2, eClassData[ ClassDesc ], charsmax( eClassData[ ClassDesc ] ) );
	
	eClassData[ ClassHP ] = get_param( 3 );
	eClassData[ ClassSpeed ] = get_param( 4 );
	eClassData[ ClassGrav ] = get_param( 5 );
	
	ArrayPushArray( g_FurienClasses, eClassData );
	
	g_iTotalFurienClasses++;
	
	return ( g_iTotalFurienClasses - 1 );
}

public native_get_user_furien_class( index ) {
	
	return g_CurFurienClass[ index ];
}

public native_set_user_furien_class( index, class ) {
	
	if( class < 0 || class >= g_iTotalFurienClasses )
		return 0;
	
	g_NextFurienClass[ index ] = class;
	return 1;
}
„Peste douăzeci de ani vei fi dezamăgit din cauza lucrurilor pe care nu le-ai făcut, nu din cauza celor pe care le-ai făcut.” - Mark Twain
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș


Bio.LeagueCs.Ro - Biohazard v4.4 Xmas Edition
discord: IonutC#5114

Experinta in: Java/Spring boot/Angular/C/C++/C#/Javascript/Python/HTML/CSS/Pawn/SQL
Ai nevoie de ajutorul meu? Ma poti gasi doar la adresa de discord de mai sus.
Post Reply

Return to “Cereri”

  • Information