Cerere plugin Clase Furien

Cereri de resurse: addons-uri, modele, sunete, etc.

Moderators: Moderatori ajutatori, Moderatori

Post Reply
User avatar
puNx
Membru, skill 0
Membru, skill 0
Posts: 81
Joined: 07 Aug 2015, 17:26
Detinator Steam: Da
CS Status: :)
SteamID: puNx
Fond eXtream: 0
Contact:

26 Mar 2019, 23:39

Salut,as vrea si eu un plugin de clase furien exact ca din link-ul de aici
| Afiseaza codul
http://forum.cs16.ro/topic/200249-arhiv ... urien-v11/
Imagine: Image
Image
Hell.Mixarena.Ro[+18][VIP CLASSIC][Admine Free]

Ofer suport tehnic si incredere pentru servere de CS 1.6 !
Contact me:
Skype: vlad.vlad604
Y!M: andruvlad@ymail.com
Steam: zeT # ANUBIS (link: http://steamcommunity.com/id/vladpuNx/ )
Forum: puNx (PM me)
Pretul difera in functie de ce doreste clientul !
User avatar
Laurentiu P.
Super moderator
Super moderator
Posts: 2208
Joined: 10 Jul 2013, 20:26
Detinator Steam: Da
CS Status: Activitate scazuta !
Detinator server CS: Da
SteamID: trust_ro
Reputatie: Moderator > Super moderator
Nume anterior: Do[N]e ;3
Fond eXtream: 1
Location: Constanta
Has thanked: 4 times
Been thanked: 15 times

26 Mar 2019, 23:52

Image
User avatar
puNx
Membru, skill 0
Membru, skill 0
Posts: 81
Joined: 07 Aug 2015, 17:26
Detinator Steam: Da
CS Status: :)
SteamID: puNx
Fond eXtream: 0
Contact:

27 Mar 2019, 00:25

"Site ul nu mai este disponibil" :)))))
Image
Hell.Mixarena.Ro[+18][VIP CLASSIC][Admine Free]

Ofer suport tehnic si incredere pentru servere de CS 1.6 !
Contact me:
Skype: vlad.vlad604
Y!M: andruvlad@ymail.com
Steam: zeT # ANUBIS (link: http://steamcommunity.com/id/vladpuNx/ )
Forum: puNx (PM me)
Pretul difera in functie de ce doreste clientul !
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2305
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 33 times
Been thanked: 365 times
Contact:

29 Mar 2019, 14:52

Code: Select all

/*
	----------------------
	-*- 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;
}
Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
În cazul în care utilizați ceva din addonsurile postate de mine aici, e bine să fiți la curent cu modificările aduse unor plugine, aici.
Post Reply

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests