Raised This Month: $241 Target: $400
 60% 

Notices

Add levelrank & leveltop


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 05-05-2014 , 04:41   Add levelrank & leveltop
Reply With Quote #1

i need someone to add me /levelrank and /leveltop , thanks

Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>
#include <nvault>
#include <cstrike>
#include <fakemeta>



/*	()		Leve Mod ConfiG		()		*/


/*	Who have flag "t" have vip !	*/
#define VIP_ACCES	ADMIN_LEVEL_H

/*	Who have acces to amx_xp  	 !		*/
#define ADMIN_ACCES	ADMIN_MENU

/*	Who have acces to amx_showxp  	 !		*/
#define ADMIN_ACCES_INFO	ADMIN_ALL




/*	()		----------------------		()	*/




// 	Plugin Info !

new const PLUGIN_NAME[] = "Level Mod";
new const AUTHOR[] = "swapped";
new const hnsxp_version[] = "6.5.8";

new levels[51] = {
	10,		/*	Level 1		*/ 
	50,		/*	Level 2		*/
	100,		/*	Level 3		*/
	400,		/*	Level 4		*/
	800,		/*	Level 5		*/
	1000,		/*	Level 6		*/
	1800,		/*	Level 7		*/
	2400,		/*	Level 8		*/
	3000,		/*	Level 9		*/
	4000,		/*	Level 10	*/
	4800,		/*	Level 11	*/
	5500,		/*	Level 12	*/
	8000,		/*	Level 13	*/
	10000,		/*	Level 14	*/
	12000,		/*	Level 15	*/
	14000,		/*	Level 16	*/
	16000,		/*	Level 17	*/
	18000,		/*	Level 18	*/
	20000,		/*	Level 19	*/
	22050,		/*	Level 20	*/
	23079,		/*	Level 21	*/
	26000,		/*	Level 22	*/
	28070,		/*	Level 23	*/
	29000,		/*	Level 24	*/
	30050,		/*	Level 25	*/
	35000,		/*	Level 26	*/
	40050,		/*	Level 27	*/
	50000,		/*	Level 28	*/
	60050,		/*	Level 29	*/
	70000,		/*	Level 30	*/
	80550,		/*	Level 31	*/
	94000,		/*	Level 32	*/
	95200,		/*	Level 33	*/
	100050,		/*	Level 34	*/
	110000,		/*	Level 35	*/
	140200,		/*	Level 36	*/
	150200,		/*	Level 37	*/
	180200,		/*	Level 38	*/
	190200,		/*	Level 39	*/
	202042, 	/*	Level 40	*/
	300000,		/*	Level 41	*/
	450000,		/*	Level 42	*/
	600000,		/*	Level 43	*/
	780000,		/*	Level 44	*/
	850000,		/*	Level 45	*/
	900000,		/*	Level 46	*/
	1000000,	/*	Level 47	*/
	1200000,	/*	Level 48	*/
	1500000,	/*	Level 49	*/
	1999999,	/*	Level 50	*/
	999999999 	/*    Solver The Error  */
};
	
	



#define is_user_vip(%1)		( get_user_flags(%1) & VIP_ACCES )

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

#define TEAM_T 1
#define TEAM_CT 2

new g_iMaxPlayers;
new hnsxp_playerxp[33];
new hnsxp_playerlevel[33];
new g_hnsxp_vault;
new wxp;
new xlevel;
new xp_kill_cvar;
new xp_hs_cvar;
new xp_vip_cvar;
new xp_win_cvar;
new time_item_cvar;
new g_iDamage_xp;
new speed_per_level;
new money_per_level;
new health_per_level;
new gravity_per_level;
new levelmod_prefix;
new g_item
new Array:Item_Name;
new Array:Item_Cost;
new Array:Item_Desc;
new Array:Item_Team
new g_selected_forward
new g_damage_per_level;
new g_armor_per_level;

enum Color
{
	NORMAL = 1, // clients scr_concolor cvar color
	YELLOW = 1, // NORMAL alias
	GREEN, // Green Color
	TEAM_COLOR, // Red, grey, blue
	GREY, // grey
	RED, // Red
	BLUE, // Blue
}
 
new TeamName[][] =
{
	"",
	"TERRORIST",
	"CT",	
	"SPECTATOR"
}


public plugin_init()
{
        register_plugin(PLUGIN_NAME, hnsxp_version, AUTHOR);

	register_event("DeathMsg", "hnsxp_playerdie", "a");
	register_event("Damage", "give_bonus_dmh", "b", "2!0", "3=0", "4!0");
	register_event("CurWeapon", "Ham_CheckSpeed_Bonus", "be", "1=1");
        register_event("SendAudio", "t_win", "a", "2&%!MRAD_terwin")

	xp_kill_cvar = register_cvar("levelmod_kill","10")
	xp_hs_cvar = register_cvar("levelmod_hs","20")
	xp_vip_cvar = register_cvar("levelmod_vip_xp","100")
	xp_win_cvar = register_cvar("levelmod_tero_win","30")
	time_item_cvar  = register_cvar("levelmod_time_item","15.0");
	g_iDamage_xp = register_cvar("levelmod_damage_xp","4");
	speed_per_level = register_cvar("levelmod_speed_per_level","3");
	health_per_level = register_cvar("levelmod_health_per_level","10");
	money_per_level = register_cvar("levelmod_money_per_level","1");
	gravity_per_level = register_cvar("levelmod_gravity_per_level","5");
	levelmod_prefix = register_cvar("levelmod_tag","LEVEL MOD");
	g_damage_per_level = register_cvar("levelmod_damage_per_level","5");
	g_armor_per_level = register_cvar("levelmod_armor_per_level", "10");

       	register_clcmd("say /level","plvl");
        register_clcmd("say /xp","plvl");
        register_clcmd("say /lvl","plvl");
        register_clcmd("say /levels","plvl");
	register_clcmd("say /levelmodmenu", "_open_the_menu");
	register_clcmd("say /lvlmenu", "_open_the_menu");
	register_clcmd("say /levelmenu", "_open_the_menu");
        register_clcmd("say_team /levels","plvl");
        register_clcmd("say_team /level","plvl");
        register_clcmd("say_team /xp","plvl");
        register_clcmd("say_team /lvl","plvl");
	register_clcmd("say_team /levelmodmenu", "_open_the_menu");
	register_clcmd("say_team /lvlmenu", "_open_the_menu");
	register_clcmd("say_team /levelmenu", "_open_the_menu");

        g_hnsxp_vault = nvault_open("levelmod_xp_vault");

	register_concmd("amx_xp","cmd_xp",ADMIN_ACCES,"<NUME> <XP>");
	register_concmd("amx_showxp","cmd_xp_info",ADMIN_ACCES_INFO,"Retrive player xp,level information.");

        xlevel = CreateMultiForward("levelmod_client_updatelevel", ET_IGNORE, FP_CELL);
        wxp = CreateMultiForward("levelmod_client_hook_xp", ET_IGNORE, FP_CELL);
	g_selected_forward = CreateMultiForward("levelmod_selected_item", ET_IGNORE, FP_CELL, FP_CELL)	
	
	register_forward(FM_ClientUserInfoChanged, "ClientUserInfoChanged") 
	
	g_iMaxPlayers = get_maxplayers ( )
	RegisterHam ( Ham_TakeDamage, "player", "Player_TakeDamage");
        RegisterHam(Ham_Spawn, "player", "hnsxp_spawn", 1);
}

public give_bonus_dmh(id)
{
	static value; value = read_data( 2 );
	static attacker; attacker = get_user_attacker(id)
	new szName[33]; get_user_name(id, szName, 32);
	new TAG[60];
	get_pcvar_string( levelmod_prefix, TAG, charsmax( TAG ) - 1 );

	if(!is_user_alive(attacker) || !attacker || !id || id == attacker)
		return PLUGIN_HANDLED;

	
	GiveExp( attacker, get_pcvar_num( g_iDamage_xp ) );
	ColorChat(attacker, TEAM_COLOR, "^1[ ^3%s^1 ] You received ^4%iXP^1 because you give ^4%i^1 damage on ^4%s^1 !",TAG,get_pcvar_num(g_iDamage_xp),value,szName);	
	UpdateLevel(attacker);
	return PLUGIN_CONTINUE;
	
}

public _open_the_menu( id )
{
	_open_menu( id )
	return PLUGIN_HANDLED
}

public _open_menu( id )
{
	new TAG[60];
	get_pcvar_string( levelmod_prefix, TAG, charsmax( TAG ) - 1 );

	if(!is_user_alive(id))
	{
		ColorChat(id, TEAM_COLOR, "^1[ ^3%s^1 ] You can buy when you are dead !",TAG)
		return PLUGIN_HANDLED
	}
	
	if(g_item == 0)
	{
		ColorChat(id, TEAM_COLOR, "^1[ ^3%s^1 ] Menu are empty !",TAG)
		return PLUGIN_HANDLED		
	}
	
	static temp_menu[64]
	static menu, temp_string1[33], temp_integer1, temp_string2[33], temp_string3[5]
	
	if(get_user_team(id) == 2)
	{
		menu = menu_create("Levelmod CT Menu:", "menu1_handle_ct")
		
		for(new i = 0; i < g_item; i++)
		{
			if(ArrayGetCell(Item_Team, i) == TEAM_CT)
			{
				ArrayGetString(Item_Name, i, temp_string1, sizeof(temp_string1))
				temp_integer1 = ArrayGetCell(Item_Cost, i)
				ArrayGetString(Item_Desc, i, temp_string2, sizeof(temp_string2))
				
				formatex(temp_menu, sizeof(temp_menu), " %s - %i XP ", temp_string1, temp_integer1)
				
				num_to_str(i, temp_string3, sizeof(temp_string3))
				menu_additem(menu, temp_menu, temp_string3)
			}
		}
		
		menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
		menu_display(id, menu, 0)	
		
	} else if(get_user_team(id) == 1) {
		menu = menu_create("Levelmod Tero menu:", "menu1_handle_tero")
		
		for(new i = 0; i < g_item; i++)
		{
			if(ArrayGetCell(Item_Team, i) == TEAM_T) 
			{
				ArrayGetString(Item_Name, i, temp_string1, sizeof(temp_string1))
				temp_integer1 = ArrayGetCell(Item_Cost, i)
				ArrayGetString(Item_Desc, i, temp_string2, sizeof(temp_string2))
				
				formatex(temp_menu, sizeof(temp_menu), "%s - %i XP ", temp_string1, temp_integer1)
				
				num_to_str(i, temp_string3, sizeof(temp_string3))
				menu_additem(menu, temp_menu, temp_string3)			
			}
		}
		
		menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
		menu_display(id, menu, 0)	
	}
	
	return PLUGIN_CONTINUE
}

public menu1_handle_ct(id, menu, item)
{
	new TAG[60];
	get_pcvar_string( levelmod_prefix, TAG, charsmax( TAG ) - 1 );

	if(item == MENU_EXIT || get_user_team(id) != 2)
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	static data[6], szName[64], access, callback
	static temp_integer1
	menu_item_getinfo(menu, item, access, data, charsmax(data), szName, charsmax(szName), callback)
	
	temp_integer1 = str_to_num(data)
	
	static cost, wp_name[64], wp_desc[64]
	cost = ArrayGetCell(Item_Cost, temp_integer1)
	ArrayGetString(Item_Name, temp_integer1, wp_name, sizeof(wp_name))
	ArrayGetString(Item_Desc, temp_integer1, wp_desc, sizeof(wp_desc))
	
	if(hnsxp_playerxp[id] >= cost)
	{
		ColorChat(id, TEAM_COLOR, "^1[ ^3%s^1 ] You bought ^4%s^1 for ^4%i^1 XP !",TAG, wp_name, cost)
		ColorChat(id, TEAM_COLOR, "^1[ ^3%s^1 ] %s",TAG,wp_desc)
		
		TakeExp(id, cost);
		
		static g_dummy
		ExecuteForward(g_selected_forward, g_dummy, id, temp_integer1)
	} else {
		ColorChat(id, TEAM_COLOR, "^1[ ^3%s^1 ] You need at least ^4%i^1 XP to buy ^4%s^1 !",TAG, cost, wp_name )
	}
		
	return PLUGIN_CONTINUE
}

public menu1_handle_tero(id, menu, item)
{
	new TAG[60];
	get_pcvar_string( levelmod_prefix, TAG, charsmax( TAG ) - 1 );

	if(item == MENU_EXIT || get_user_team(id) != 1)
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	static data[6], szName[64], access, callback
	static temp_integer1
	menu_item_getinfo(menu, item, access, data, charsmax(data), szName, charsmax(szName), callback)
	
	temp_integer1 = str_to_num(data)
	
	static cost, name[32], desc[32]
	cost = ArrayGetCell(Item_Cost, temp_integer1)
	ArrayGetString(Item_Name, temp_integer1, name, sizeof(name))
	ArrayGetString(Item_Desc, temp_integer1, desc, sizeof(desc))

	if(hnsxp_playerxp[id] >= cost)
	{
		ColorChat(id, TEAM_COLOR, "^1[ ^3%s^1 ] You bought ^4%s^1 for ^4%i^1 XP !",TAG, name, cost)
		ColorChat(id, TEAM_COLOR, "^1[ ^3%s^1 ] %s",TAG,desc)
		
		TakeExp(id, cost);
		
		static g_dummy
		ExecuteForward(g_selected_forward, g_dummy, id, temp_integer1)
	} else {
		ColorChat(id, TEAM_COLOR, "^1[ ^3%s^1 ] You need at least ^4%i^1 XP to buy ^4%s^1 !",TAG, cost, name )
	}
		
	return PLUGIN_CONTINUE	
}


public Player_TakeDamage ( iVictim, iInflictor, iAttacker, Float:fDamage ) {
    
	if ( iInflictor == iAttacker && IsPlayer ( iAttacker ) && hnsxp_playerlevel[iAttacker]) 
	{
    
		SetHamParamFloat ( 4, fDamage + ( get_pcvar_num( g_damage_per_level ) * hnsxp_playerlevel[ iAttacker ] ) );
		return HAM_HANDLED;
       	}
    
	return HAM_IGNORED;
    
}

public ClientUserInfoChanged( id, szBuffer )
{
	if ( !is_user_connected( id ) ) 
		return FMRES_IGNORED;
	
	static szNewName[ 32 ];
	new g_szName[ 32 ];
	get_user_name(id, g_szName, 31 );

	
	engfunc( EngFunc_InfoKeyValue, szBuffer, "name", szNewName, sizeof ( szNewName ) -1 );
	
	if ( equal( szNewName, g_szName ) )
		return FMRES_IGNORED;
	
	
	hnsxp_playerlevel[ id ] = 0;
	hnsxp_playerxp[ id ] = 0;

	set_task( 0.10 , "LoadData", id );
	set_task( 0.50, "TryFuckUp", id );

	return FMRES_IGNORED;
}

public TryFuckUp( id ) 
	UpdateLevel( id );
public cmd_xp(id,level,cid)
{
	if(!cmd_access(id,level,cid,3))
		return PLUGIN_HANDLED;
	
	new arg[33], amount[33]
	read_argv(1, arg, charsmax(arg) - 1)
	read_argv(2, amount, charsmax(amount) - 1)
	new target = cmd_target(id, arg, 7)
	new admin_name[35], player_name[35];
	get_user_name(target, player_name, charsmax(player_name) - 1);
	get_user_name(id, admin_name, charsmax(admin_name) - 1);
	new TAG[60];
	get_pcvar_string( levelmod_prefix, TAG, charsmax( TAG ) - 1 );



	new wors = str_to_num(amount)
	
	
	if(!target)
	{
		return 1
	}

	if( wors > 1999999 )
	{
		hnsxp_playerxp[target] = 1999999;
		UpdateLevel(target);
		return 1;
	}
	
        new ret;
        ExecuteForward(wxp, ret, target);
	hnsxp_playerxp[target] = wors;
	ColorChat(0, TEAM_COLOR, "^1[ ^3%s^1 ] Admin ^4%s^1 set ^4%i^1 xp on ^4%s^1 !",TAG,admin_name,wors,player_name);
	UpdateLevel(target);
	return 0
}
  
public cmd_xp_info(id,level,cid)
{
	if(!cmd_access(id,level,cid,2))
		return PLUGIN_HANDLED;

	new arg[33]
	read_argv(1, arg, 32)

	new target = cmd_target(id, arg, 7)

	new player_name[35];
	get_user_name(target, player_name, charsmax(player_name) - 1);
	new TAG[60];
	get_pcvar_string( levelmod_prefix, TAG, charsmax( TAG ) - 1 );
	
	
	if(!target)
	{
		return 1;
	}
	
	ColorChat(0, TEAM_COLOR, "^1[ ^3%s^1 ] Player ^3%s^1 have level ^4%i^1 [ ^4%i^1 / ^4%i^1 ]",TAG,player_name,hnsxp_playerlevel[target], hnsxp_playerxp[target],levels[hnsxp_playerlevel[target]]); 
	return 0;
}

/*      Speed Check      */
public Ham_CheckSpeed_Bonus( id )
{
	if(is_user_alive(id))
	{
		set_user_maxspeed( id, 250.0 + ( get_pcvar_num( speed_per_level ) * hnsxp_playerlevel[ id ] ) );
	}		
}

GiveExp(index, value)
{
	if(value >= 1999999)
	{
		hnsxp_playerxp[index] = 1999999 ;
		return 1;
	}
	if(hnsxp_playerxp[index] >= 1999999)
	{
		hnsxp_playerxp[index] = 1999999;
		return 1;
	}

        new ret;
        ExecuteForward(wxp, ret, index);

	client_cmd(0, "spk buttons/bell1");
	hnsxp_playerxp[index] = hnsxp_playerxp[index] + value;
	return 0;
}

TakeExp(index, value)
{
	if(hnsxp_playerxp[index] >= value)
	{
		hnsxp_playerxp[index] = hnsxp_playerxp[index] - value;
	}

	else
	{
		hnsxp_playerxp[index] = 0;
	}
}

public plugin_precache()
{
	Item_Name = ArrayCreate(64, 1)
	Item_Cost = ArrayCreate(1, 1)
	Item_Desc = ArrayCreate(64, 1)
	Item_Team = ArrayCreate(1, 1)
}

public plugin_natives()
{
        register_native("levelmod_get_user_xp","_get_user_xp");
        register_native("levelmod_get_user_level","_get_user_level");
	register_native("levelmod_get_user_next_level", "_next_level");
	register_native("levelmod_get_user_xp_needed", "_xp_needed");
        register_native("levelmod_set_user_xp","_set_user_xp");
        register_native("levelmod_set_user_level","_set_user_level");
	register_native("levelmod_updatelevel","_update");
	register_native("levelmod_open_menu","_open");
	register_native("levelmod_menu_register_item", "native_register_item", 1)

}

public _open(pluin, params)
{
	new id = get_param( 1 );

	if( is_user_alive( id ) )
	{
		_open_menu( id );
	}	
}

public _update(pluin, params)
{
	new ids = get_param( 1 );

	if( is_user_connected( ids ) )
	{
		UpdateLevel( ids );
	}
}

public _get_user_xp(plugin, params)
{
        return hnsxp_playerxp[get_param(1)];
}

public _get_user_level(plugin, params)
{
        return hnsxp_playerlevel[get_param(1)];
}

public _next_level(plugin, params)
{
	return hnsxp_playerlevel[get_param(1)] + 1;
}

public _xp_needed(pluin, params)
{
	return levels[hnsxp_playerlevel[get_param(1)]];
}

public _set_user_xp(plugin, xer)
{
	new id = get_param(1)
	new value = get_param(2)

	if(is_user_connected(id))
	{
		hnsxp_playerxp[id] = value;
		return 0
	}

	else
	{
		log_error(AMX_ERR_NATIVE,"User %d is not connected !",id)
		return 0
	}
	return 1
}


public _set_user_level(plugin, eat)
{
	new id = get_param(1)
	new valuex = get_param(2)

	if(is_user_connected(id))
	{
		hnsxp_playerlevel[id] = valuex;
		return 0
	}

	else
	{
		log_error(AMX_ERR_NATIVE,"User %d is not connected !",id)
		return 0
	}
	return 1
}
public native_register_item(const item_name[], const item_cost, const item_desc[], const item_team)
{
	param_convert(1)
	param_convert(3)
	
	ArrayPushString(Item_Name, item_name)
	ArrayPushCell(Item_Cost, item_cost)
	ArrayPushString(Item_Desc, item_desc)
	ArrayPushCell(Item_Team, item_team)
	
	g_item++
	
	return g_item - 1
}

public gItem(id)
{
	new TAG[60];
	get_pcvar_string( levelmod_prefix, TAG, charsmax( TAG ) - 1 );

        new dgl = give_item(id, "weapon_deagle")

	new hp = get_pcvar_num( health_per_level ) * hnsxp_playerlevel[ id ];
	new money = get_pcvar_num( money_per_level ) * hnsxp_playerlevel[ id ];
	new armor = get_pcvar_num( g_armor_per_level ) * hnsxp_playerlevel[ id ];


        if(is_user_alive(id))
        {
                switch(hnsxp_playerlevel[id])
                {
                
                        case 0:
                        {
                                set_user_health( id, get_user_health( id ) + hp );
				set_user_armor( id, get_user_armor( id ) + armor );
				cs_set_user_money( id, cs_get_user_money( id ) + money )

				if( dgl )
				{
                            		cs_set_weapon_ammo(dgl, 1);
				}

                            	ColorChat(id, TEAM_COLOR,"^1[^3 %s^1 ] You got ^4 %iHP ^1, ^4 %iMONEY ^1, ^4 %iARMOR ^1, ^4 1DGL ^1, ^4 0SG ^1, ^4 0FL ^1, ^4 0HE ^1!",TAG,hp,money, armor);
                                remove_task(id);
                        }
                        
                        case 1..9:
                        {
                                give_item(id, "weapon_hegrenade");
                                give_item(id, "weapon_flashbang");
                                give_item(id, "weapon_smokegrenade");

                                cs_set_user_bpammo(id, CSW_HEGRENADE, 1);
                                cs_set_user_bpammo(id, CSW_FLASHBANG, 1);
                                cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 1);

                                set_user_health( id, get_user_health( id ) + hp );
				set_user_armor( id, get_user_armor( id ) + armor );
				cs_set_user_money( id, cs_get_user_money( id ) + money )

				if( dgl )
				{
                                	cs_set_weapon_ammo(dgl, 1);
				}

                                ColorChat(id, TEAM_COLOR,"^1[^3 %s^1 ] You got ^4 %iHP ^1, ^4 %iMONEY ^1, ^4 %iARMOR ^1, ^4 1DGL ^1, ^4 1SG ^1, ^4 1FL ^1, ^4 1HE ^1!",TAG,hp,money,armor);
                         
				remove_task(id);
                
                        }

                        case 10..19:
                        {
                                give_item(id, "weapon_hegrenade");
                                give_item(id, "weapon_flashbang");
                                give_item(id, "weapon_smokegrenade");

                                cs_set_user_bpammo(id, CSW_HEGRENADE, 1);
                                cs_set_user_bpammo(id, CSW_FLASHBANG, 1);
                                cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 2);

                                set_user_health( id, get_user_health( id ) + hp );
				set_user_armor( id, get_user_armor( id ) + armor );
				cs_set_user_money( id, cs_get_user_money( id ) + money )

				if( dgl )
				{
                                	cs_set_weapon_ammo(dgl, 1);
				}

                                ColorChat(id, TEAM_COLOR,"^1[^3 %s^1 ] You got ^4 %iHP ^1, ^4 %iMONEY ^1, ^4 %iARMOR ^1, ^4 1DGL ^1, ^4 2SG ^1, ^4 1FL ^1, ^4 1HE ^1!",TAG,hp,money,armor);
                                remove_task(id);
                
                        }

                        case 20..29:
                        {
                                give_item(id, "weapon_hegrenade");
                                give_item(id, "weapon_flashbang");
                                give_item(id, "weapon_smokegrenade");

                                cs_set_user_bpammo(id, CSW_HEGRENADE, 2);
                                cs_set_user_bpammo(id, CSW_FLASHBANG, 1);
                                cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 2);

                                set_user_health( id, get_user_health( id ) + hp );
				set_user_armor( id, get_user_armor( id ) + armor );
				cs_set_user_money( id, cs_get_user_money( id ) + money )

				if( dgl )
				{
                                	cs_set_weapon_ammo(dgl, 2);
				}

                                ColorChat(id, TEAM_COLOR,"^1[^3 %s^1 ] You got ^4 %iHP ^1, ^4 %iMONEY ^1, ^4 %iARMOR ^1, ^4 2DGL ^1, ^4 2SG ^1, ^4 1FL ^1, ^4 2HE ^1!",TAG,hp,money,armor);
                                remove_task(id);
                
                        }

                        case 30..39:
                        {
                                give_item(id, "weapon_hegrenade");
                                give_item(id, "weapon_flashbang");
                                give_item(id, "weapon_smokegrenade");

                                cs_set_user_bpammo(id, CSW_HEGRENADE, 2);
                                cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
                                cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 3);

                                set_user_health( id, get_user_health( id ) + hp );
				cs_set_user_money( id, cs_get_user_money( id ) + money )
				set_user_armor( id, get_user_armor( id ) + armor );

 				if( dgl )
				{
                                	cs_set_weapon_ammo(dgl, 3);
				}

                                ColorChat(id, TEAM_COLOR,"^1[^3 %s^1 ] You got ^4 %iHP ^1, ^4 %iMONEY ^1, ^4 %iARMOR ^1, ^4 3DGL ^1, ^4 3SG ^1, ^4 2FL ^1, ^4 2HE ^1!",TAG,hp,money,armor);
                                remove_task(id);
                
                        }

                        case 40..49:
                        {
                                give_item(id, "weapon_hegrenade");
                                give_item(id, "weapon_flashbang");
                                give_item(id, "weapon_smokegrenade");

                                cs_set_user_bpammo(id, CSW_HEGRENADE, 3);
                                cs_set_user_bpammo(id, CSW_FLASHBANG, 3);
                                cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 4);

                                set_user_health( id, get_user_health( id ) + hp );
				set_user_armor( id, get_user_armor( id ) + armor );
				cs_set_user_money( id, cs_get_user_money( id ) + money );

				if( dgl )
				{
                                	cs_set_weapon_ammo(dgl, 4);
				}

                                ColorChat(id, TEAM_COLOR,"^1[^3 %s^1 ] You got ^4 %iHP ^1, ^4 %iMONEY ^1, ^4 %iARMOR ^1, ^4 4DGL ^1, ^4 4SG ^1, ^4 3FL ^1, ^4 3HE ^1!",TAG,hp,money,armor);
                                remove_task(id);
			}


                        case 50:
                        {
                                give_item(id, "weapon_hegrenade");
                                give_item(id, "weapon_flashbang");
                                give_item(id, "weapon_smokegrenade");

                                cs_set_user_bpammo(id, CSW_HEGRENADE, 5);
                                cs_set_user_bpammo(id, CSW_FLASHBANG, 5);
                                cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 5);

                                set_user_health( id, get_user_health( id ) + hp );
				cs_set_user_money( id, cs_get_user_money( id ) + money );
				set_user_armor( id, get_user_armor( id ) + armor );

				if( dgl )
				{
                                	cs_set_weapon_ammo(dgl, 7);
				}

                                ColorChat(id, TEAM_COLOR,"^1[^3 %s^1 ] You got ^4 %iHP ^1, ^4 %iMONEY ^1, ^4 %iARMOR ^1, ^4 7DGL ^1, ^4 5SG ^1, ^4 5FL ^1, ^4 5HE ^1!",TAG,hp,money,armor);
                                remove_task(id);
			}
                
     
                        
 
                }
                        
        }

}




UpdateLevel(id)
{
	new ret;
        ExecuteForward(xlevel, ret, id);

        if((hnsxp_playerlevel[id] < 50) && (hnsxp_playerxp[id] >= levels[hnsxp_playerlevel[id]]))
        {
                while(hnsxp_playerxp[id] >= levels[hnsxp_playerlevel[id]])
                {
                        hnsxp_playerlevel[id]++;
                }
        }
}

public hnsxp_spawn(id)
{
        set_task(get_pcvar_float(time_item_cvar), "gItem", id);

	new GRAVITYCheck = 800 - ( get_pcvar_num( gravity_per_level ) * hnsxp_playerlevel[ id ] );

	if(is_user_alive(id))
	{

		set_user_gravity( id, float( GRAVITYCheck ) / 800.0 );
		UpdateLevel(id);
	
	}


}

public plvl(id)
{	
	static host_name[32];
	new szName[33];
	get_user_name( id, szName, 32 );

	get_cvar_string("hostname", host_name, 31);
	
	static motd[1501], len;
	
	len = format(motd, 1500,"<body bgcolor=#000000><font color=#87cefa><pre>");
	len += format(motd[len], 1500-len,"<center>%s %s by %s</center>",PLUGIN_NAME,hnsxp_version,AUTHOR);
	len += format(motd[len], 1500-len,"<center><h4><font color=^"blue^"> You'r statistics in '%s' </font></h4></center>", host_name);
	len += format(motd[len], 1500-len,"<left><font color=^"red^"><B>Nume :</B> <font color=^"white^">%s </color></left>^n", szName);
	len += format(motd[len], 1500-len,"<left><font color=^"red^"><B>Level :</B> <font color=^"white^">%d </color></left>^n", hnsxp_playerlevel[id]);
	len += format(motd[len], 1500-len,"<left><font color=^"red^"><B>XP :</B> <font color=^"white^">%d / %d</color></left>^n", hnsxp_playerxp[id], levels[hnsxp_playerlevel[id]]);

	
	
	show_motd(id, motd, "You'r Rank");
	
	return 1;
}

public hnsxp_playerdie() 
{
	new iVictim = read_data( 2 )
	new attacker = read_data( 1 )
	new headshot = read_data( 3 )

        
        if( !attacker || attacker == iVictim )
                return;
        
        GiveExp(attacker, get_pcvar_num(xp_kill_cvar));
        
        
        UpdateLevel(attacker);
        UpdateLevel(iVictim);


	if(headshot)
	{ 
		GiveExp(attacker, get_pcvar_num(xp_hs_cvar));

	}

        if(is_user_vip(attacker))
        {
		GiveExp(attacker, get_pcvar_num(xp_vip_cvar));

        }

}

public client_putinserver(id)
{
	UpdateLevel(id);
}

public client_connect(id)
{ 
        LoadData(id);            
}
public client_disconnect(id)
{ 
        SaveData(id);
}

public SaveData(id)
{
        new PlayerName[35];
        get_user_name(id,PlayerName,34);
       
        new vaultkey[64],vaultdata[256];
        format(vaultkey,63,"%s",PlayerName);
        format(vaultdata,255,"%i`i%",hnsxp_playerxp[id],hnsxp_playerlevel[id]);
        nvault_set(g_hnsxp_vault,vaultkey,vaultdata);
        return PLUGIN_CONTINUE;
}
public LoadData(id)
{
        new PlayerName[35];
        get_user_name(id,PlayerName,34);
       
        new vaultkey[64],vaultdata[256];
        format(vaultkey,63,"%s",PlayerName);
        format(vaultdata,255,"%i`%i",hnsxp_playerxp[id],hnsxp_playerlevel[id]);
        nvault_get(g_hnsxp_vault,vaultkey,vaultdata,255);
       
        replace_all(vaultdata, 255, "`", " ");
       
        new playerxp[32], playerlevel[32];
       
        parse(vaultdata, playerxp, 31, playerlevel, 31);
       
        hnsxp_playerxp[id] = str_to_num(playerxp);
        hnsxp_playerlevel[id] = str_to_num(playerlevel);
       
        return PLUGIN_CONTINUE;
}

public t_win(id)
{
      	new TAG[60];
	get_pcvar_string( levelmod_prefix, TAG, charsmax( TAG ) - 1 );
  
        new iPlayer [ 32 ], iNum;
        get_players(iPlayer, iNum, "ae", "TERRORIST")
        for ( new i = 0; i < iNum; i++ ) 
        {
        	if(is_user_alive(iPlayer[i]))
		{
	                GiveExp(iPlayer [ i ], get_pcvar_num(xp_win_cvar));
	                ColorChat(iPlayer[i], TEAM_COLOR,"^1[^3 %s^1 ] You got ^4 %iXP^1 because your team has win the round !",TAG,get_pcvar_num(xp_win_cvar));
	                UpdateLevel(iPlayer[i]);
                }
        }
}
ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
{
	new message[256];
 
	switch(type)
	{
		case NORMAL: // clients scr_concolor cvar color
		{
			message[0] = 0x01;
		}
		case GREEN: // Green
		{
			message[0] = 0x04;
		}
		default: // White, Red, Blue
		{
			message[0] = 0x03;
		}
	}
	 
	vformat(message[1], 251, msg, 4);
 
	// Make sure message is not longer than 192 character. Will crash the server.
	message[191] = '^0';
 
	new team, ColorChange, index, MSG_Type;
	if(id)
	{
		MSG_Type = MSG_ONE;
		index = id;
	} else {
		index = FindPlayer();
		MSG_Type = MSG_ALL;
	}

	team = get_user_team(index);
	ColorChange = ColorSelection(index, MSG_Type, type);
 

	ShowColorMessage(index, MSG_Type, message);
	if(ColorChange)
	{
		Team_Info(index, MSG_Type, TeamName[team]);
	}
}
 
ShowColorMessage(id, type, message[])
{
	static get_user_msgid_saytext;
	if(!get_user_msgid_saytext)
	{
		get_user_msgid_saytext = get_user_msgid("SayText");
	}
	message_begin(type, get_user_msgid_saytext, _, id);
	write_byte(id)	
	write_string(message);
	message_end();	
}
 
Team_Info(id, type, team[])
{
	static bool:teaminfo_used;
	static get_user_msgid_teaminfo;
	if(!teaminfo_used)
	{
		get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
		teaminfo_used = true;
	}
	message_begin(type, get_user_msgid_teaminfo, _, id);
	write_byte(id);
	write_string(team);
	message_end();
 
	return 1;
}
 
ColorSelection(index, type, Color:Type)
{
	switch(Type)
	{
		case RED:
		{
			return Team_Info(index, type, TeamName[1]);
		}
		case BLUE:
		{
			return Team_Info(index, type, TeamName[2]);
		}
		case GREY:
		{
			return Team_Info(index, type, TeamName[0]);
		}
	}
 
	return 0;
}
 
FindPlayer()
{
	new i = -1;
	static iMaxPlayers;
	if( !iMaxPlayers )
	{
		iMaxPlayers = get_maxplayers( );
	}
	while(i <= iMaxPlayers)
	{
		if(is_user_connected(++i))
			return i;
	}
 
	return -1;
}

stock Float:accuracy(stats[8])
{
	if(!stats[4])
		return ( 0.0 );
	new Float:result
	result = 100.0 * float( stats[5] ) / float( stats[4] );
	return (result > 100.0) ? 100.0 : result
}

stock Float:effec(stats[8])
{
	if(!stats[0])
		return ( 0.0 );
	new Float:result
	result = 100.0 * float( stats[0] ) / float( stats[0] + stats[1] );
	return (result > 100.0) ? 100.0 : result
}
Edit:

Optionaly if u think is more easy, you can make an external plugin using levelmod.inc :

Code:
#if defined _levelmod_included
	#endinput
#endif
#define _levelmod_included

#define TEAM_CT 2
#define TEAM_T 1

#define LEVELMOD_VERSION "6.5.8"

enum Color
{
	NORMAL = 1, // clients scr_concolor cvar color
	YELLOW = 1, // NORMAL alias
	GREEN, // Green Color
	TEAM_COLOR, // Red, grey, blue
	GREY, // grey
	RED, // Red
	BLUE, // Blue
}
 
new TeamName[][] =
{
	"",
	"TERRORIST",
	"CT",	
	"SPECTATOR"
}



forward levelmod_selected_item(id, item);
forward levelmod_client_updatelevel(id);
forward levelmod_client_hook_xp(id);

native levelmod_get_user_xp(id);
native levelmod_get_user_level(id);
native levelmod_get_user_next_level(id);
native levelmod_get_user_xp_needed(id);
native levelmod_set_user_xp(id, value);
native levelmod_set_user_level(id, value);
native levelmod_open_menu(id);
native levelmod_updatelevel(id);
native levelmod_menu_register_item(const item_name[], const item_cost, const item_desc[], const item_team)

stock levelmod_give_user_xp( id, value )
{
	levelmod_set_user_xp( id, levelmod_get_user_xp( id ) + value );
}

stock levelmod_give_user_level( id, value )
{
	levelmod_set_user_level( id, levelmod_get_user_level( id ) + value );
}

stock levelmod_take_user_xp( id, value )
{
	levelmod_set_user_xp( id, levelmod_get_user_xp( id ) - value );
}

stock levelmod_take_user_level( id, value )
{
	levelmod_set_user_level( id, levelmod_get_user_level( id ) - value );
}

stock CC(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
{
	new message[256];
 
	switch(type)
	{
		case NORMAL: // clients scr_concolor cvar color
		{
			message[0] = 0x01;
		}
		case GREEN: // Green
		{
			message[0] = 0x04;
		}
		default: // White, Red, Blue
		{
			message[0] = 0x03;
		}
	}

	vformat(message[1], 251, msg, 4);
 
	// Make sure message is not longer than 192 character. Will crash the server.
	message[191] = '^0';
 
	new team, ColorChange, index, MSG_Type;
	if(id)
	{
		MSG_Type = MSG_ONE;
		index = id;
	} else {
		index = FindPlayer();
		MSG_Type = MSG_ALL;
	}

	team = get_user_team(index);
	ColorChange = ColorSelection(index, MSG_Type, type);
 

	ShowColorMessage(index, MSG_Type, message);
	if(ColorChange)
	{
		Team_Info(index, MSG_Type, TeamName[team]);
	}
}
 
stock ShowColorMessage(id, type, message[])
{
	static get_user_msgid_saytext;
	if(!get_user_msgid_saytext)
	{
		get_user_msgid_saytext = get_user_msgid("SayText");
	}
	message_begin(type, get_user_msgid_saytext, _, id);
	write_byte(id)	
	write_string(message);
	message_end();	
}
 
stock Team_Info(id, type, team[])
{
	static bool:teaminfo_used;
	static get_user_msgid_teaminfo;
	if(!teaminfo_used)
	{
		get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
		teaminfo_used = true;
	}
	message_begin(type, get_user_msgid_teaminfo, _, id);
	write_byte(id);
	write_string(team);
	message_end();
 
	return 1;
}
 
stock ColorSelection(index, type, Color:Type)
{
	switch(Type)
	{
		case RED:
		{
			return Team_Info(index, type, TeamName[1]);
		}
		case BLUE:
		{
			return Team_Info(index, type, TeamName[2]);
		}
		case GREY:
		{
			return Team_Info(index, type, TeamName[0]);
		}
	}
 
	return 0;
}
 
stock FindPlayer()
{
	new i = -1;
	static iMaxPlayers;
	if( !iMaxPlayers )
	{
		iMaxPlayers = get_maxplayers( );
	}
	while(i <= iMaxPlayers)
	{
		if(is_user_connected(++i))
			return i;
	}
 
	return -1;
}

Last edited by swapped; 05-05-2014 at 04:44.
swapped is offline
GinNNy
Senior Member
Join Date: Mar 2014
Old 05-05-2014 , 05:47   Re: Add levelrank & leveltop
Reply With Quote #2

what you mean about levelrank

like show Your level is 120 of 300 or what ;p
GinNNy is offline
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 05-05-2014 , 10:33   Re: Add levelrank & leveltop
Reply With Quote #3

Quote:
Originally Posted by GinNNy View Post
what you mean about levelrank

like show Your level is 120 of 300 or what ;p
Wtf ?

---------

No i want something like : You are on top 5 of 300 with level 39
swapped is offline
ezio_auditore
Senior Member
Join Date: May 2013
Old 05-05-2014 , 11:54   Re: Add levelrank & leveltop
Reply With Quote #4

is this that xp mod you want my Kamehameha plugin for
__________________
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 05-06-2014 , 00:05   Re: Add levelrank & leveltop
Reply With Quote #5

Quote:
Originally Posted by ezio_auditore View Post
is this that xp mod you want my Kamehameha plugin for
yes.
swapped is offline
Old 05-06-2014, 01:28
Kia
This message has been deleted by fysiks. Reason: spam/offtopic
Old 05-06-2014, 02:48
swapped
This message has been deleted by fysiks. Reason: spam/offtopic
Old 05-06-2014, 04:38
Kia
This message has been deleted by fysiks. Reason: spam/offtopic
Old 05-06-2014, 05:07
GinNNy
This message has been deleted by fysiks. Reason: spam/offtopic
Old 05-06-2014, 05:32
ezio_auditore
This message has been deleted by fysiks. Reason: spam/offtopic
Old 05-06-2014, 09:09
ironskillz1
This message has been deleted by fysiks. Reason: spam/offtopic
Old 05-06-2014, 09:48
ezio_auditore
This message has been deleted by fysiks. Reason: spam/offtopic
Old 05-06-2014, 11:32
joshknifer
This message has been deleted by fysiks. Reason: spam/offtopic
Old 05-07-2014, 04:24
swapped
This message has been deleted by fysiks. Reason: spam/offtopic
Old 05-07-2014, 04:50
ezio_auditore
This message has been deleted by fysiks. Reason: spam/offtopic
Old 05-07-2014, 05:10
Kia
This message has been deleted by fysiks. Reason: spam/offtopic
Old 05-07-2014, 06:29
swapped
This message has been deleted by fysiks. Reason: spam/offtopic
Old 05-07-2014, 06:34
ANTICHRISTUS
This message has been deleted by fysiks. Reason: spam/offtopic
Old 05-07-2014, 07:23
ezio_auditore
This message has been deleted by fysiks. Reason: spam/offtopic
Old 05-07-2014, 10:43
swapped
This message has been deleted by fysiks. Reason: spam/offtopic
Old 05-08-2014, 08:26
Freezo Begin
This message has been deleted by fysiks. Reason: spam/offtopic
Old 05-08-2014, 09:56
swapped
This message has been deleted by fysiks. Reason: spam/offtopic
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:28.


Powered by vBulletin®
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Theme made by Freecode