Deathrun XP

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
ang
Membru, skill +1
Membru, skill +1
Posts: 169
Joined: 14 Jan 2012, 18:39
Detinator Steam: Da
Detinator server CS: Da
Location: Africa
Has thanked: 37 times

27 Feb 2014, 14:48

Am o problema la un plugin XP pe Deathrun :) imi arata informatiile despre XP in Hud doar cand esti Terorist , este vorba de meniul verde din stinga .

Image

Vreau sa-mi arate si la CT
| Afiseaza codul
/////////////////////////////////////////////////////////////////////////////
//==============================	
//=  Dr.XqS.Ro XP & Level Mod   =
//==============================	
//
////////////////////////////////////////////////////////////////////

#include <amxmodx>
#include <amxmisc>
#include <nvault>  
#include <colorchat>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>

new Level[33], eXP[33]
new KillXp, HsXp, HeXp/*, KnifeXp*/
new gVault

new const szPrefix[] = "[^4Dr.XqS.Ro XP^3] -"

#define MaxLevels 12
#define IsPlayer(%1) ( 1 <= %1 <=  g_iMaxPlayers )
#define TASK_SHOW_HUD 10113

new g_msgHudSync
new bool:is_user_ignored[ 33 ]

new const Levels[MaxLevels] = 
{
	100, // Incepator #1
	150, // Elev #2
	200, // Jucator Bun #3
	250, // Talentat #4
	300, // Foarte Bun #5
	350, // Smecher #6
	400, // Cunoscut de toti #7
	450, // Veteran #8
	550, // Zmeu #9
	600, // Primul Loc #10
	650, // Deathruner #11
	700 // Jucator Respectat #12
}
new const Prefix[MaxLevels +1][] =
{
	"Incepator", // 0
	"Elev", // 1
	"Jucator Bun",  // 2
	"Talentat", // 3
	"Foarte Bun", // 4
	"Smecher",  // 5
	"Cunoscut de toti", // 6
	"Veteran", // 7
	"Zmeu", // 8
	"Primul Loc", // 9
	"Deathruner", // 10
	"Cel mai bun", // 11
	"Jucator Respectat" // 12
}

// Bonus Stuff
new healthperlevel,
	armorperlevel,
	speedperlevel,
	damageperlevel,
	gravityperlvl
	
new g_iMaxPlayers

// ADMIN CHAT COLORS by ConnorMcLeod
enum _:ADMIN_DATAS 
{ 
    m_szName[32], 
    m_iFlag 
} 

new const AdminsDatas[][ADMIN_DATAS] =  
{ 
    {"Owner", ADMIN_IMMUNITY}, 
    {"Manager", ADMIN_BAN}, 
    // {"SuperAdmin", ADMIN_CFG}, 
    {"Admin", ADMIN_KICK}, 
    {"VIP", ADMIN_RESERVATION} 
};

public plugin_init() 
{
	register_plugin("Deathrun XP & Level Mod", "0.0.9", "aNg*@dy")
	
	register_message(get_user_msgid("SayText"),"Message_SayText"); // CREDITS TO ConnorMcLeod
	
	RegisterHam ( Ham_Spawn, "player", "Ham_CheckOthers_Bonus", 1);
	RegisterHam ( Ham_TakeDamage, "player", "Ham_CheckDamage_Bonus", .Post = false );
	RegisterHam ( Ham_Item_PreFrame, "player", "Ham_CheckSpeed_Bonus", 1);
	
	g_iMaxPlayers = get_maxplayers( );
	
	register_cvar( "AdminChatColors_On", "1" ); // Admin Tag - Example: [Admin] Freestyle
	register_cvar( "XP_Reward_MSG", "1" ); // Message of the XP Gain
	
	// CHAT COMMANDS //
	register_clcmd ( "say /xp", "ShowPlayerXP")
	register_clcmd ( "say_team /xp", "ShowPlayerXP")
	register_clcmd ( "say /level", "ShowPlayerLevel")
	register_clcmd ( "say_team /level", "ShowPlayerLevel")
	
	// XP SYSTEM //
	KillXp	= register_cvar("drxp_per_kill", "5")
	HsXp	= register_cvar("drxp_per_hs", "10")
	HeXp	= register_cvar("drxp_per_nade_kill", "10")
	//KnifeXp	= register_cvar("drxp_per_knife_kill", "10")
	
	// Give & Remove XP //
	register_concmd ( "give_xp", "CmdAddXP", ADMIN_RCON, "<nick, #userid, authid | @all> <xp>" )
	register_concmd ( "remove_xp", "CmdRemoveXP", ADMIN_RCON, "<nick, #userid, authid | @all> <xp>" )
	
	/* Bonus Stuff */
	
	// Health Per Level //
	healthperlevel	= register_cvar("health_per_lvl", "10")
	
	// Armor Per Level //
	armorperlevel	= register_cvar("armor_per_lvl", "10") 
	
	// Speed Per Level //
	speedperlevel	= register_cvar("speed_per_lvl", "10")
	
	// Gravity Per Level //
	gravityperlvl	= register_cvar("gravity_per_lvl", "10") // NERVER MORE THAN 66 PER LVL
	
	// Damage Per Level //
	damageperlevel	= register_cvar("damage_per_lvl", "10")
	
	g_msgHudSync = CreateHudSyncObj()
}

public plugin_cfg( )
{	
	gVault = nvault_open( "DEATHRUN_XP" )
	
	if ( gVault == INVALID_HANDLE )
		set_fail_state( "Error opening nVault" );
}

/*      INFO ABOUT PERSONAL XP/LEVEL      */
public ShowPlayerXP(id)
{
	ColorChat(id, GREY, "%s Ai ^4%i^3 XP si esti levelul ^4%s^3!", szPrefix, eXP[id], Prefix[Level[id]])
}

public ShowPlayerLevel(id)
{
	new name[32]
	get_user_name(id, name, sizeof(name) -1)
		
	ColorChat(id, GREY, "%s Esti levelul ^4%s^3 cu ^4%i^3 XP!", szPrefix, Prefix[Level[id]], eXP[id])
}

public Ham_CheckDamage_Bonus( pevVictim, pevInflictor, pevAttacker, Float:flDamage, iDmgBits ) 
{ 
    if( !( 1 <= pevAttacker <= g_iMaxPlayers) ) 
    { 
        return HAM_HANDLED; 
    } 
     
    if( !is_user_alive( pevAttacker )  ) 
    { 
        return HAM_HANDLED; 
    } 

    SetHamParamFloat( 4 , flDamage + ( get_pcvar_num( damageperlevel ) * Level[ pevAttacker ] ) ) 

    return HAM_IGNORED; 
} 

/*      Speed Check      */
public Ham_CheckSpeed_Bonus( id )
{
	if( !is_user_alive( id ) || cs_get_user_team( id ) != CS_TEAM_T )
	{
		return HAM_IGNORED;
	}
	
	set_user_maxspeed( id, 250.0 + ( get_pcvar_num(speedperlevel) * Level[ id ] ) );
			
	return HAM_IGNORED;
}

/*      HP & AP & Gravity Check      */
public Ham_CheckOthers_Bonus(id)
{
	if( !is_user_alive( id ) || cs_get_user_team( id ) != CS_TEAM_T )
		return HAM_IGNORED;
		
	// HP Check
	new HPCheck = ( get_user_health(id) + get_pcvar_num(healthperlevel) * Level[ id ] );
	set_user_health( id, HPCheck );
	
	// AP Check
	new APCheck = ( get_user_armor(id) + get_pcvar_num(armorperlevel) * Level[ id ] );
	set_user_armor( id, APCheck );
	
	// Gravity
	new GRAVITYCheck = 800 - ( get_pcvar_num( gravityperlvl ) * Level[ id ] );
	
	if(get_pcvar_num(gravityperlvl) > 66)
	{
		set_user_gravity( id, float( 8 ) / 800.0 );
	}
	else
	{
		set_user_gravity( id, float( GRAVITYCheck ) / 800.0 );
	}
	
	remove_task( TASK_SHOW_HUD + id );		

	set_task(0.1, "ShowHud", TASK_SHOW_HUD + id)
			
	return HAM_IGNORED;
}

/*      Respected Player Join / Leave Stuff      */

public LvL_12_PlayerJoin(id)
{
	new name[32]
	get_user_name(id, name, sizeof(name) -1)
		
	ColorChat(0, GREY, "%s ^4Jucator Respectat : ^1%s^4 s-a conectat pe Dr.XqS.Ro cu ^1%i^4 XP!", szPrefix, name, eXP[id])
}

public LvL_12_PlayerRemove(id)
{
	new name[32]
	get_user_name(id, name, sizeof(name) -1)
		
	ColorChat(0, GREY, "%s ^4Jucator Respectat : %s s-a deconectat de pe Dr.XqS.Ro cu %i XP!", szPrefix, name, eXP[id])
}

public plugin_end( )
	nvault_close( gVault )
	
public client_putinserver(id)
{
	LoadData(id)
	set_task( 3.0, "ShowHud", id, .flags = "b" );
	
	if(Level[id] == 12)
	{
		set_task(5.0, "LvL_12_PlayerJoin", id)
	}
}

public client_disconnect(id)
{
	SaveData(id)
	
	if(Level[id] == 12)
	{
		set_task(1.0, "LvL_12_PlayerRemove", id)
	}
}

/*      XP REWARDS      */
public client_death( iKiller, iVictim, wpnindex, hitplace )
{
	new vname[32]
	new kname[32]
	
	get_user_name( iKiller, kname, charsmax( kname ) )
	get_user_name( iVictim, vname, charsmax( vname ) )

	if( is_user_ignored[ iKiller ] )
		return PLUGIN_HANDLED_MAIN
	
	get_user_name( iKiller, kname, charsmax( kname ) )
	get_user_name( iVictim, vname, charsmax( vname ) )
	
	if( iKiller != iVictim && ( 1 <= iKiller <= g_iMaxPlayers ) && ( 1 <= iVictim <= g_iMaxPlayers ) && !( hitplace == HIT_HEAD ) && !( wpnindex == CSW_HEGRENADE ) )
	{
		eXP[iKiller] += get_pcvar_num(KillXp)
		
		if( get_cvar_num("XP_Reward_MSG") == 1 ) 
		{
			ColorChat ( iKiller, GREY, "%s Ai primit^4 %i^3 XP pentru kill^4 %s^3", szPrefix, get_pcvar_num(KillXp), vname )
		}
	}
	
	if( hitplace == HIT_HEAD )
	{
		eXP[iKiller] += get_pcvar_num(HsXp)
		
		if( get_cvar_num("XP_Reward_MSG") == 1 ) 
		{
			ColorChat ( iKiller, GREY, "%s Ai primit ^4%i^3 XP pentru ca l-ai omorat pe ^4%s^3 cu ^4HeadShot", szPrefix, get_pcvar_num (HsXp), vname )
		}
	}
	
	if( wpnindex == CSW_HEGRENADE && iKiller != iVictim )
	{
		eXP[iKiller] += get_pcvar_num(HeXp)
		
		if( get_cvar_num("XP_Reward_MSG") == 1 ) 
		{
			ColorChat( iKiller, GREEN, "%s^1 Ai primit^4 %i^3 XP pentru ca l-ai omorat pe^4 %s^3 cu o ^4Grenada", szPrefix, get_pcvar_num (HeXp), vname )
		}
	}
	CheckLevel(iKiller)
	SaveData(iKiller)
	
	return PLUGIN_CONTINUE
}

public CheckLevel(id)
{
	if(Level[id] < MaxLevels-1)
	{
		while(eXP[id] >= Levels[Level[id]])
		{
			Level[id] += 1 
			ColorChat(id, GREY, "%s Felicitari ai trecut levelul , acum esti levelul : ^4%i^3", szPrefix, Level[id])
		}
	} 
}

/*      HUD PERMANENT INFO      */
public ShowHud(task)
{
	new id = task - TASK_SHOW_HUD
	
	if(!is_user_alive(id))
		return;
	
	set_hudmessage(0, 255, 0, 0.02, 0.33, 0, 0.0, 0.3, 0.0, 0.0)
	ShowSyncHudMsg(id, g_msgHudSync,"[Status : %s]^n[XP : %i]", Prefix[Level[id]], eXP[id])
	
	set_task(0.1, "ShowHud", TASK_SHOW_HUD + id)	
}

/*      nVault Stuff      */
public SaveData(id) 
{ 
	new AuthID[35]
	get_user_authid(id,AuthID,34) 
	new vaultkey[64],vaultdata[256] 
	
	format(vaultkey,63,"%s-Mod",AuthID) 
	format(vaultdata,255,"%i#%i#",eXP[id],Level[id]) 
	
	nvault_set(gVault,vaultkey,vaultdata) 
	
	return PLUGIN_CONTINUE 
} 
public LoadData(id) 
{ 
	new AuthID[35]
	get_user_authid(id,AuthID,34) 
	new vaultkey[64],vaultdata[256] 
	
	format(vaultkey,63,"%s-Mod",AuthID) 
	format(vaultdata,255,"%i#%i#",eXP[id],Level[id]) 
	
	nvault_get(gVault,vaultkey,vaultdata,255) 
	
	replace_all(vaultdata, 255, "#", " ") 
	
	new playerxp[32], playerlevel[32] 
	
	parse(vaultdata, playerxp, 31, playerlevel, 31) 
	
	eXP[id] = str_to_num(playerxp) 
	
	Level[id] = str_to_num(playerlevel) 
	
	return PLUGIN_CONTINUE 
} 

/*      Remove And Add XP      */
public CmdAddXP ( iPlayer, level, cid )
{
	if( !cmd_access( iPlayer, level, cid, 3 ) ) return PLUGIN_HANDLED;
	   
	new arg [ 32 ]
	read_argv ( 1, arg, 31 ) 
 
	new AddXP [ 32 ]
	read_argv ( 2, AddXP, charsmax ( AddXP ) )
 
	new XPtoGive = str_to_num ( AddXP )
	   
	new AdminName [ 32 ]
	new TargetName [ 32 ]
	get_user_name ( iPlayer, AdminName, charsmax ( AdminName ) )
	   
	if( arg[0]=='@' )
	{ 
		if( equali(arg[1],"All") || equali(arg[1],"ALL") )
		{
			new players[32], totalplayers, All
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				All = players[ i ]
					   
				eXP[ All ] += XPtoGive
			}
			
			CheckLevel( All )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to all ^1 players^3!", szPrefix, AdminName, XPtoGive )
		}
		else if( equali(arg[1],"T") || equali(arg[1],"t") )
		{
			new players[32], totalplayers, T
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				if ( get_user_team(players[ i ]) == 1 )
				{
					T = players[ i ]
						   
					eXP[ T ] += XPtoGive
				}
			}
			
			CheckLevel( T )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to all ^1 Terrorists^3!", szPrefix, AdminName, XPtoGive )
		}
		else if( equali(arg[1],"CT") || equali(arg[1],"ct") )
		{
			new players[32], totalplayers, CT
			get_players( players, totalplayers )
		    
			for( new i = 0; i < totalplayers; i++ )
			{
				if( get_user_team(players[ i ] ) == 2 )
				{
					CT = players[ i ]
						   
					eXP[ CT ] += XPtoGive
				}
			}
			
			CheckLevel( CT )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to all ^1 Counter-Terrorists^3!", szPrefix, AdminName, XPtoGive )
		}
	}
	else
	{
		new iTarget = cmd_target( iPlayer, arg, 3 )
		get_user_name ( iTarget, TargetName, charsmax ( TargetName ) )
		
		if( iTarget )
		{
			eXP[ iTarget ] += XPtoGive
			
			CheckLevel( iTarget )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to^1 %s^3", szPrefix, AdminName, XPtoGive, TargetName )
		}
	}
	return PLUGIN_HANDLED
}
 
public CmdRemoveXP ( iPlayer, level, cid )
{
	if( !cmd_access(iPlayer, level, cid, 3) ) return PLUGIN_HANDLED;
	   
	new arg [ 32 ]
	read_argv ( 1, arg, 31 ) 
 
	new RemoveXP [ 32 ]
	read_argv ( 2, RemoveXP, charsmax ( RemoveXP ) )
 
	new XPtoRemove = str_to_num ( RemoveXP )
	   
	new AdminName [ 32 ]
	new TargetName [ 32 ]
	get_user_name ( iPlayer, AdminName, charsmax ( AdminName ) )
	   
	if( arg[0]=='@' )
	{ 
		if( equali(arg[1],"All") || equali(arg[1],"ALL") )
		{
			new players[32], totalplayers, All
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				All = players[ i ]
					   
				eXP[ All ] -= XPtoRemove
			}
			
			CheckLevel( All )
			ColorChat ( 0, GREY, "%s ^1%s^3 toke^1 %i^3 XP of all ^1 players^3!", szPrefix, AdminName, XPtoRemove )
		}
		else if( equali(arg[1],"T") || equali(arg[1],"t") )
		{
			new players[32], totalplayers, T
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				if ( get_user_team(players[ i ]) == 1 )
				{
					T = players[ i ]
						   
					eXP[ T ] -= XPtoRemove
				}
			}
			
			CheckLevel( T )
			ColorChat ( 0, GREY, "%s ^1%s^3 toke^1 %i^3 XP of all ^1 Terrorists^3!", szPrefix, AdminName, XPtoRemove )
		}
		else if( equali(arg[1],"CT") || equali(arg[1],"ct") )
		{
			new players[32], totalplayers, CT
			get_players( players, totalplayers )
		    
			for( new i = 0; i < totalplayers; i++ )
			{
				if( get_user_team(players[ i ] ) == 2 )
				{
					CT = players[ i ]
						   
					eXP[ CT ] -= XPtoRemove
				}
			}
			
			CheckLevel( CT )
			ColorChat ( 0, GREY, "%s ^1%s^3 toke^1 %i^3 XP of all ^1 Counter-Terrorists^3!", szPrefix, AdminName, XPtoRemove )
		}
	}
	else
	{
		new iTarget = cmd_target( iPlayer, arg, 3 )
		get_user_name ( iTarget, TargetName, charsmax ( TargetName ) )
		
		if( !iTarget )
			return PLUGIN_HANDLED
			
		eXP[ iTarget ] -= XPtoRemove
			
		CheckLevel( iTarget )
		ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to^1 %s^3", szPrefix, AdminName, XPtoRemove, TargetName )
	}
	
	return PLUGIN_HANDLED
}
/*      Level Behind Nick & AdminChatColors
              CREDITS TO ConnorMcLeod            */
public Message_SayText(msgId,msgDest,msgEnt) 
{ 
	new id = get_msg_arg_int(1); 
	if( is_user_connected(id) ) 
	{ 
		if( get_cvar_num("AdminChatColors_On") == 1 ) 
		{
			new flags = get_user_flags(id)
			for(new i; i<sizeof(AdminsDatas); i++) 
			{ 
				if( flags & AdminsDatas[m_iFlag] ) 
				{ 
					new szChannel[64]
					get_msg_arg_string(2, szChannel, charsmax(szChannel))
		
					if( equal(szChannel, "#Cstrike_Chat_All") ) 
					{ 
					    formatex(szChannel, charsmax(szChannel), "^4[%s - %s] ^3%%s1 ^1:  %%s2", Prefix[Level[id]], AdminsDatas[m_szName])
					    set_msg_arg_string(2, szChannel)
					} 
					else if( !equal(szChannel, "#Cstrike_Name_Change") ) 
					{ 
					    format(szChannel, charsmax(szChannel), "^4[%s - %s] %s", Prefix[Level[id]], AdminsDatas[m_szName], szChannel)
					    set_msg_arg_string(2, szChannel)
					} 
					return
				} 
				else
				{
					new szChannel[64]
					get_msg_arg_string(2, szChannel, charsmax(szChannel))
		
					if( equal(szChannel, "#Cstrike_Chat_All") ) 
					{ 
					    formatex(szChannel, charsmax(szChannel), "^4[%s] ^3%%s1 ^1:  %%s2", Prefix[Level[id]])
					    set_msg_arg_string(2, szChannel)
					} 
					else if( !equal(szChannel, "#Cstrike_Name_Change") ) 
					{ 
					    format(szChannel, charsmax(szChannel), "^4[%s] %s", Prefix[Level[id]], szChannel)
					    set_msg_arg_string(2, szChannel)
					} 
					return 
				}
			} 
		}
		else
		{
			new szChannel[64]
			get_msg_arg_string(2, szChannel, charsmax(szChannel));
		
			if( equal(szChannel, "#Cstrike_Chat_All") ) 
			{ 
				formatex(szChannel, charsmax(szChannel), "^4[%s] ^3%%s1 ^1:  %%s2", Prefix[Level[id]])
				set_msg_arg_string(2, szChannel)
			} 
			else if( !equal(szChannel, "#Cstrike_Name_Change") ) 
			{ 
				format(szChannel, charsmax(szChannel), "^4[%s] %s", Prefix[Level[id]], szChannel) 
				set_msg_arg_string(2, szChannel)
			} 
			return 
		}
	} 
}


Multumesc
<a href="https://www.gametracker.com/server_info ... 3.4:27015/" target="_blank"><img src="http://cache.gametracker.com/server_inf ... 2E3226.png" border="0" width="350" height="20" alt=""/></a>
Zonek
kid #
Membru, skill +1
Membru, skill +1
Posts: 112
Joined: 27 Feb 2014, 14:27
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Has thanked: 49 times
Been thanked: 15 times
Contact:

27 Feb 2014, 15:32

| Afiseaza codul
/////////////////////////////////////////////////////////////////////////////
//==============================	
//=  Dr.XqS.Ro XP & Level Mod   =
//==============================	
//
////////////////////////////////////////////////////////////////////

#include <amxmodx>
#include <amxmisc>
#include <nvault>  
#include <colorchat>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>

new Level[33], eXP[33]
new KillXp, HsXp, HeXp/*, KnifeXp*/
new gVault

new const szPrefix[] = "[^4Dr.XqS.Ro XP^3] -"

#define MaxLevels 12
#define IsPlayer(%1) ( 1 <= %1 <=  g_iMaxPlayers )
#define TASK_SHOW_HUD 10113

new g_msgHudSync
new bool:is_user_ignored[ 33 ]

new const Levels[MaxLevels] = 
{
	100, // Incepator #1
	150, // Elev #2
	200, // Jucator Bun #3
	250, // Talentat #4
	300, // Foarte Bun #5
	350, // Smecher #6
	400, // Cunoscut de toti #7
	450, // Veteran #8
	550, // Zmeu #9
	600, // Primul Loc #10
	650, // Deathruner #11
	700 // Jucator Respectat #12
}
new const Prefix[MaxLevels +1][] =
{
	"Incepator", // 0
	"Elev", // 1
	"Jucator Bun",  // 2
	"Talentat", // 3
	"Foarte Bun", // 4
	"Smecher",  // 5
	"Cunoscut de toti", // 6
	"Veteran", // 7
	"Zmeu", // 8
	"Primul Loc", // 9
	"Deathruner", // 10
	"Cel mai bun", // 11
	"Jucator Respectat" // 12
}

// Bonus Stuff
new healthperlevel,
	armorperlevel,
	speedperlevel,
	damageperlevel,
	gravityperlvl
	
new g_iMaxPlayers

// ADMIN CHAT COLORS by ConnorMcLeod
enum _:ADMIN_DATAS 
{ 
    m_szName[32], 
    m_iFlag 
} 

new const AdminsDatas[][ADMIN_DATAS] =  
{ 
    {"Owner", ADMIN_IMMUNITY}, 
    {"Manager", ADMIN_BAN}, 
    // {"SuperAdmin", ADMIN_CFG}, 
    {"Admin", ADMIN_KICK}, 
    {"VIP", ADMIN_RESERVATION} 
};

public plugin_init() 
{
	register_plugin("Deathrun XP & Level Mod", "0.0.9", "aNg*@dy")
	
	register_message(get_user_msgid("SayText"),"Message_SayText"); // CREDITS TO ConnorMcLeod
	
	RegisterHam ( Ham_Spawn, "player", "Ham_CheckOthers_Bonus", 1);
	RegisterHam ( Ham_TakeDamage, "player", "Ham_CheckDamage_Bonus", .Post = false );
	RegisterHam ( Ham_Item_PreFrame, "player", "Ham_CheckSpeed_Bonus", 1);
	
	g_iMaxPlayers = get_maxplayers( );
	
	register_cvar( "AdminChatColors_On", "1" ); // Admin Tag - Example: [Admin] Freestyle
	register_cvar( "XP_Reward_MSG", "1" ); // Message of the XP Gain
	
	// CHAT COMMANDS //
	register_clcmd ( "say /xp", "ShowPlayerXP")
	register_clcmd ( "say_team /xp", "ShowPlayerXP")
	register_clcmd ( "say /level", "ShowPlayerLevel")
	register_clcmd ( "say_team /level", "ShowPlayerLevel")
	
	// XP SYSTEM //
	KillXp	= register_cvar("drxp_per_kill", "5")
	HsXp	= register_cvar("drxp_per_hs", "10")
	HeXp	= register_cvar("drxp_per_nade_kill", "10")
	//KnifeXp	= register_cvar("drxp_per_knife_kill", "10")
	
	// Give & Remove XP //
	register_concmd ( "give_xp", "CmdAddXP", ADMIN_RCON, "<nick, #userid, authid | @all> <xp>" )
	register_concmd ( "remove_xp", "CmdRemoveXP", ADMIN_RCON, "<nick, #userid, authid | @all> <xp>" )
	
	/* Bonus Stuff */
	
	// Health Per Level //
	healthperlevel	= register_cvar("health_per_lvl", "10")
	
	// Armor Per Level //
	armorperlevel	= register_cvar("armor_per_lvl", "10") 
	
	// Speed Per Level //
	speedperlevel	= register_cvar("speed_per_lvl", "10")
	
	// Gravity Per Level //
	gravityperlvl	= register_cvar("gravity_per_lvl", "10") // NERVER MORE THAN 66 PER LVL
	
	// Damage Per Level //
	damageperlevel	= register_cvar("damage_per_lvl", "10")
	
	g_msgHudSync = CreateHudSyncObj()
}

public plugin_cfg( )
{	
	gVault = nvault_open( "DEATHRUN_XP" )
	
	if ( gVault == INVALID_HANDLE )
		set_fail_state( "Error opening nVault" );
}

/*      INFO ABOUT PERSONAL XP/LEVEL      */
public ShowPlayerXP(id)
{
	ColorChat(id, GREY, "%s Ai ^4%i^3 XP si esti levelul ^4%s^3!", szPrefix, eXP[id], Prefix[Level[id]])
}

public ShowPlayerLevel(id)
{
	new name[32]
	get_user_name(id, name, sizeof(name) -1)
		
	ColorChat(id, GREY, "%s Esti levelul ^4%s^3 cu ^4%i^3 XP!", szPrefix, Prefix[Level[id]], eXP[id])
}

public Ham_CheckDamage_Bonus( pevVictim, pevInflictor, pevAttacker, Float:flDamage, iDmgBits ) 
{ 
    if( !( 1 <= pevAttacker <= g_iMaxPlayers) ) 
    { 
        return HAM_HANDLED; 
    } 
     
    if( !is_user_alive( pevAttacker )  ) 
    { 
        return HAM_HANDLED; 
    } 

    SetHamParamFloat( 4 , flDamage + ( get_pcvar_num( damageperlevel ) * Level[ pevAttacker ] ) ) 

    return HAM_IGNORED; 
} 

/*      Speed Check      */
public Ham_CheckSpeed_Bonus( id )
{
	if( !is_user_alive( id ) )
	{
		return HAM_IGNORED;
	}
	
	set_user_maxspeed( id, 250.0 + ( get_pcvar_num(speedperlevel) * Level[ id ] ) );
			
	return HAM_IGNORED;
}

/*      HP & AP & Gravity Check      */
public Ham_CheckOthers_Bonus(id)
{
	if( !is_user_alive( id ))
		return HAM_IGNORED;
		
	// HP Check
	new HPCheck = ( get_user_health(id) + get_pcvar_num(healthperlevel) * Level[ id ] );
	set_user_health( id, HPCheck );
	
	// AP Check
	new APCheck = ( get_user_armor(id) + get_pcvar_num(armorperlevel) * Level[ id ] );
	set_user_armor( id, APCheck );
	
	// Gravity
	new GRAVITYCheck = 800 - ( get_pcvar_num( gravityperlvl ) * Level[ id ] );
	
	if(get_pcvar_num(gravityperlvl) > 66)
	{
		set_user_gravity( id, float( 8 ) / 800.0 );
	}
	else
	{
		set_user_gravity( id, float( GRAVITYCheck ) / 800.0 );
	}
	
	remove_task( TASK_SHOW_HUD + id );		

	set_task(0.1, "ShowHud", TASK_SHOW_HUD + id)
			
	return HAM_IGNORED;
}

/*      Respected Player Join / Leave Stuff      */

public LvL_12_PlayerJoin(id)
{
	new name[32]
	get_user_name(id, name, sizeof(name) -1)
		
	ColorChat(0, GREY, "%s ^4Jucator Respectat : ^1%s^4 s-a conectat pe Dr.XqS.Ro cu ^1%i^4 XP!", szPrefix, name, eXP[id])
}

public LvL_12_PlayerRemove(id)
{
	new name[32]
	get_user_name(id, name, sizeof(name) -1)
		
	ColorChat(0, GREY, "%s ^4Jucator Respectat : %s s-a deconectat de pe Dr.XqS.Ro cu %i XP!", szPrefix, name, eXP[id])
}

public plugin_end( )
	nvault_close( gVault )
	
public client_putinserver(id)
{
	LoadData(id)
	set_task( 3.0, "ShowHud", id, .flags = "b" );
	
	if(Level[id] == 12)
	{
		set_task(5.0, "LvL_12_PlayerJoin", id)
	}
}

public client_disconnect(id)
{
	SaveData(id)
	
	if(Level[id] == 12)
	{
		set_task(1.0, "LvL_12_PlayerRemove", id)
	}
}

/*      XP REWARDS      */
public client_death( iKiller, iVictim, wpnindex, hitplace )
{
	new vname[32]
	new kname[32]
	
	get_user_name( iKiller, kname, charsmax( kname ) )
	get_user_name( iVictim, vname, charsmax( vname ) )

	if( is_user_ignored[ iKiller ] )
		return PLUGIN_HANDLED_MAIN
	
	get_user_name( iKiller, kname, charsmax( kname ) )
	get_user_name( iVictim, vname, charsmax( vname ) )
	
	if( iKiller != iVictim && ( 1 <= iKiller <= g_iMaxPlayers ) && ( 1 <= iVictim <= g_iMaxPlayers ) && !( hitplace == HIT_HEAD ) && !( wpnindex == CSW_HEGRENADE ) )
	{
		eXP[iKiller] += get_pcvar_num(KillXp)
		
		if( get_cvar_num("XP_Reward_MSG") == 1 ) 
		{
			ColorChat ( iKiller, GREY, "%s Ai primit^4 %i^3 XP pentru kill^4 %s^3", szPrefix, get_pcvar_num(KillXp), vname )
		}
	}
	
	if( hitplace == HIT_HEAD )
	{
		eXP[iKiller] += get_pcvar_num(HsXp)
		
		if( get_cvar_num("XP_Reward_MSG") == 1 ) 
		{
			ColorChat ( iKiller, GREY, "%s Ai primit ^4%i^3 XP pentru ca l-ai omorat pe ^4%s^3 cu ^4HeadShot", szPrefix, get_pcvar_num (HsXp), vname )
		}
	}
	
	if( wpnindex == CSW_HEGRENADE && iKiller != iVictim )
	{
		eXP[iKiller] += get_pcvar_num(HeXp)
		
		if( get_cvar_num("XP_Reward_MSG") == 1 ) 
		{
			ColorChat( iKiller, GREEN, "%s^1 Ai primit^4 %i^3 XP pentru ca l-ai omorat pe^4 %s^3 cu o ^4Grenada", szPrefix, get_pcvar_num (HeXp), vname )
		}
	}
	CheckLevel(iKiller)
	SaveData(iKiller)
	
	return PLUGIN_CONTINUE
}

public CheckLevel(id)
{
	if(Level[id] < MaxLevels-1)
	{
		while(eXP[id] >= Levels[Level[id]])
		{
			Level[id] += 1 
			ColorChat(id, GREY, "%s Felicitari ai trecut levelul , acum esti levelul : ^4%i^3", szPrefix, Level[id])
		}
	} 
}

/*      HUD PERMANENT INFO      */
public ShowHud(task)
{
	new id = task - TASK_SHOW_HUD
	
	if(!is_user_alive(id))
		return;
	
	set_hudmessage(0, 255, 0, 0.02, 0.33, 0, 0.0, 0.3, 0.0, 0.0)
	ShowSyncHudMsg(id, g_msgHudSync,"[Status : %s]^n[XP : %i]", Prefix[Level[id]], eXP[id])
	
	set_task(0.1, "ShowHud", TASK_SHOW_HUD + id)	
}

/*      nVault Stuff      */
public SaveData(id) 
{ 
	new AuthID[35]
	get_user_authid(id,AuthID,34) 
	new vaultkey[64],vaultdata[256] 
	
	format(vaultkey,63,"%s-Mod",AuthID) 
	format(vaultdata,255,"%i#%i#",eXP[id],Level[id]) 
	
	nvault_set(gVault,vaultkey,vaultdata) 
	
	return PLUGIN_CONTINUE 
} 
public LoadData(id) 
{ 
	new AuthID[35]
	get_user_authid(id,AuthID,34) 
	new vaultkey[64],vaultdata[256] 
	
	format(vaultkey,63,"%s-Mod",AuthID) 
	format(vaultdata,255,"%i#%i#",eXP[id],Level[id]) 
	
	nvault_get(gVault,vaultkey,vaultdata,255) 
	
	replace_all(vaultdata, 255, "#", " ") 
	
	new playerxp[32], playerlevel[32] 
	
	parse(vaultdata, playerxp, 31, playerlevel, 31) 
	
	eXP[id] = str_to_num(playerxp) 
	
	Level[id] = str_to_num(playerlevel) 
	
	return PLUGIN_CONTINUE 
} 

/*      Remove And Add XP      */
public CmdAddXP ( iPlayer, level, cid )
{
	if( !cmd_access( iPlayer, level, cid, 3 ) ) return PLUGIN_HANDLED;
	   
	new arg [ 32 ]
	read_argv ( 1, arg, 31 ) 
 
	new AddXP [ 32 ]
	read_argv ( 2, AddXP, charsmax ( AddXP ) )
 
	new XPtoGive = str_to_num ( AddXP )
	   
	new AdminName [ 32 ]
	new TargetName [ 32 ]
	get_user_name ( iPlayer, AdminName, charsmax ( AdminName ) )
	   
	if( arg[0]=='@' )
	{ 
		if( equali(arg[1],"All") || equali(arg[1],"ALL") )
		{
			new players[32], totalplayers, All
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				All = players[ i ]
					   
				eXP[ All ] += XPtoGive
			}
			
			CheckLevel( All )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to all ^1 players^3!", szPrefix, AdminName, XPtoGive )
		}
		else if( equali(arg[1],"T") || equali(arg[1],"t") )
		{
			new players[32], totalplayers, T
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				if ( get_user_team(players[ i ]) == 1 )
				{
					T = players[ i ]
						   
					eXP[ T ] += XPtoGive
				}
			}
			
			CheckLevel( T )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to all ^1 Terrorists^3!", szPrefix, AdminName, XPtoGive )
		}
		else if( equali(arg[1],"CT") || equali(arg[1],"ct") )
		{
			new players[32], totalplayers, CT
			get_players( players, totalplayers )
		    
			for( new i = 0; i < totalplayers; i++ )
			{
				if( get_user_team(players[ i ] ) == 2 )
				{
					CT = players[ i ]
						   
					eXP[ CT ] += XPtoGive
				}
			}
			
			CheckLevel( CT )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to all ^1 Counter-Terrorists^3!", szPrefix, AdminName, XPtoGive )
		}
	}
	else
	{
		new iTarget = cmd_target( iPlayer, arg, 3 )
		get_user_name ( iTarget, TargetName, charsmax ( TargetName ) )
		
		if( iTarget )
		{
			eXP[ iTarget ] += XPtoGive
			
			CheckLevel( iTarget )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to^1 %s^3", szPrefix, AdminName, XPtoGive, TargetName )
		}
	}
	return PLUGIN_HANDLED
}
 
public CmdRemoveXP ( iPlayer, level, cid )
{
	if( !cmd_access(iPlayer, level, cid, 3) ) return PLUGIN_HANDLED;
	   
	new arg [ 32 ]
	read_argv ( 1, arg, 31 ) 
 
	new RemoveXP [ 32 ]
	read_argv ( 2, RemoveXP, charsmax ( RemoveXP ) )
 
	new XPtoRemove = str_to_num ( RemoveXP )
	   
	new AdminName [ 32 ]
	new TargetName [ 32 ]
	get_user_name ( iPlayer, AdminName, charsmax ( AdminName ) )
	   
	if( arg[0]=='@' )
	{ 
		if( equali(arg[1],"All") || equali(arg[1],"ALL") )
		{
			new players[32], totalplayers, All
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				All = players[ i ]
					   
				eXP[ All ] -= XPtoRemove
			}
			
			CheckLevel( All )
			ColorChat ( 0, GREY, "%s ^1%s^3 toke^1 %i^3 XP of all ^1 players^3!", szPrefix, AdminName, XPtoRemove )
		}
		else if( equali(arg[1],"T") || equali(arg[1],"t") )
		{
			new players[32], totalplayers, T
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				if ( get_user_team(players[ i ]) == 1 )
				{
					T = players[ i ]
						   
					eXP[ T ] -= XPtoRemove
				}
			}
			
			CheckLevel( T )
			ColorChat ( 0, GREY, "%s ^1%s^3 toke^1 %i^3 XP of all ^1 Terrorists^3!", szPrefix, AdminName, XPtoRemove )
		}
		else if( equali(arg[1],"CT") || equali(arg[1],"ct") )
		{
			new players[32], totalplayers, CT
			get_players( players, totalplayers )
		    
			for( new i = 0; i < totalplayers; i++ )
			{
				if( get_user_team(players[ i ] ) == 2 )
				{
					CT = players[ i ]
						   
					eXP[ CT ] -= XPtoRemove
				}
			}
			
			CheckLevel( CT )
			ColorChat ( 0, GREY, "%s ^1%s^3 toke^1 %i^3 XP of all ^1 Counter-Terrorists^3!", szPrefix, AdminName, XPtoRemove )
		}
	}
	else
	{
		new iTarget = cmd_target( iPlayer, arg, 3 )
		get_user_name ( iTarget, TargetName, charsmax ( TargetName ) )
		
		if( !iTarget )
			return PLUGIN_HANDLED
			
		eXP[ iTarget ] -= XPtoRemove
			
		CheckLevel( iTarget )
		ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to^1 %s^3", szPrefix, AdminName, XPtoRemove, TargetName )
	}
	
	return PLUGIN_HANDLED
}
/*      Level Behind Nick & AdminChatColors
              CREDITS TO ConnorMcLeod            */
public Message_SayText(msgId,msgDest,msgEnt) 
{ 
	new id = get_msg_arg_int(1); 
	if( is_user_connected(id) ) 
	{ 
		if( get_cvar_num("AdminChatColors_On") == 1 ) 
		{
			new flags = get_user_flags(id)
			for(new i; i<sizeof(AdminsDatas); i++) 
			{ 
				if( flags & AdminsDatas[m_iFlag] ) 
				{ 
					new szChannel[64]
					get_msg_arg_string(2, szChannel, charsmax(szChannel))
		
					if( equal(szChannel, "#Cstrike_Chat_All") ) 
					{ 
					    formatex(szChannel, charsmax(szChannel), "^4[%s - %s] ^3%%s1 ^1:  %%s2", Prefix[Level[id]], AdminsDatas[m_szName])
					    set_msg_arg_string(2, szChannel)
					} 
					else if( !equal(szChannel, "#Cstrike_Name_Change") ) 
					{ 
					    format(szChannel, charsmax(szChannel), "^4[%s - %s] %s", Prefix[Level[id]], AdminsDatas[m_szName], szChannel)
					    set_msg_arg_string(2, szChannel)
					} 
					return
				} 
				else
				{
					new szChannel[64]
					get_msg_arg_string(2, szChannel, charsmax(szChannel))
		
					if( equal(szChannel, "#Cstrike_Chat_All") ) 
					{ 
					    formatex(szChannel, charsmax(szChannel), "^4[%s] ^3%%s1 ^1:  %%s2", Prefix[Level[id]])
					    set_msg_arg_string(2, szChannel)
					} 
					else if( !equal(szChannel, "#Cstrike_Name_Change") ) 
					{ 
					    format(szChannel, charsmax(szChannel), "^4[%s] %s", Prefix[Level[id]], szChannel)
					    set_msg_arg_string(2, szChannel)
					} 
					return 
				}
			} 
		}
		else
		{
			new szChannel[64]
			get_msg_arg_string(2, szChannel, charsmax(szChannel));
		
			if( equal(szChannel, "#Cstrike_Chat_All") ) 
			{ 
				formatex(szChannel, charsmax(szChannel), "^4[%s] ^3%%s1 ^1:  %%s2", Prefix[Level[id]])
				set_msg_arg_string(2, szChannel)
			} 
			else if( !equal(szChannel, "#Cstrike_Name_Change") ) 
			{ 
				format(szChannel, charsmax(szChannel), "^4[%s] %s", Prefix[Level[id]], szChannel) 
				set_msg_arg_string(2, szChannel)
			} 
			return 
		}
	} 
}
User avatar
YONTU
Moderator ajutator
Moderator ajutator
Posts: 2444
Joined: 10 May 2013, 13:25
Detinator Steam: Nu
CS Status: Everyone is looking at ur shoes
Reputatie: Moderator ajutator
Fost scripter eXtreamCS
Location: Gura Humorului
Has thanked: 255 times
Been thanked: 278 times
Contact:

27 Feb 2014, 15:36

Mutat in sectiunea corespunzatoare !
„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ș

discord: IonutC#5114

Vrei sa joci pe un server de biohazard clasic specific timpurilor 2008-2012?
CLICK | Afiseaza codul
89.44.246.14:27015 biohazard clasic
ang
Membru, skill +1
Membru, skill +1
Posts: 169
Joined: 14 Jan 2012, 18:39
Detinator Steam: Da
Detinator server CS: Da
Location: Africa
Has thanked: 37 times

27 Feb 2014, 17:28

kid multumesc fain !
<a href="https://www.gametracker.com/server_info ... 3.4:27015/" target="_blank"><img src="http://cache.gametracker.com/server_inf ... 2E3226.png" border="0" width="350" height="20" alt=""/></a>
ang
Membru, skill +1
Membru, skill +1
Posts: 169
Joined: 14 Jan 2012, 18:39
Detinator Steam: Da
Detinator server CS: Da
Location: Africa
Has thanked: 37 times

27 Feb 2014, 20:53

kid , pluginul ofera urmatoarele beneficii

// Bonus Stuff
new healthperlevel,
armorperlevel,
speedperlevel,
damageperlevel,
gravityperlvl

vreau sa scoateti / opriti viteza , sa nu mai ofere viteza pentru ca eu am deja viteza gratis pe server :) Multumesc
<a href="https://www.gametracker.com/server_info ... 3.4:27015/" target="_blank"><img src="http://cache.gametracker.com/server_inf ... 2E3226.png" border="0" width="350" height="20" alt=""/></a>
kid #
Membru, skill +1
Membru, skill +1
Posts: 112
Joined: 27 Feb 2014, 14:27
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Has thanked: 49 times
Been thanked: 15 times
Contact:

27 Feb 2014, 21:04

| Afiseaza codul
/////////////////////////////////////////////////////////////////////////////
//==============================	
//=  Dr.XqS.Ro XP & Level Mod   =
//==============================	
//
////////////////////////////////////////////////////////////////////

#include <amxmodx>
#include <amxmisc>
#include <nvault>  
#include <colorchat>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>

new Level[33], eXP[33]
new KillXp, HsXp, HeXp/*, KnifeXp*/
new gVault

new const szPrefix[] = "[^4Dr.XqS.Ro XP^3] -"

#define MaxLevels 12
#define IsPlayer(%1) ( 1 <= %1 <=  g_iMaxPlayers )
#define TASK_SHOW_HUD 10113

new g_msgHudSync
new bool:is_user_ignored[ 33 ]

new const Levels[MaxLevels] = 
{
	100, // Incepator #1
	150, // Elev #2
	200, // Jucator Bun #3
	250, // Talentat #4
	300, // Foarte Bun #5
	350, // Smecher #6
	400, // Cunoscut de toti #7
	450, // Veteran #8
	550, // Zmeu #9
	600, // Primul Loc #10
	650, // Deathruner #11
	700 // Jucator Respectat #12
}
new const Prefix[MaxLevels +1][] =
{
	"Incepator", // 0
	"Elev", // 1
	"Jucator Bun",  // 2
	"Talentat", // 3
	"Foarte Bun", // 4
	"Smecher",  // 5
	"Cunoscut de toti", // 6
	"Veteran", // 7
	"Zmeu", // 8
	"Primul Loc", // 9
	"Deathruner", // 10
	"Cel mai bun", // 11
	"Jucator Respectat" // 12
}

// Bonus Stuff
new healthperlevel,
	armorperlevel,
	damageperlevel,
	gravityperlvl
	
new g_iMaxPlayers

// ADMIN CHAT COLORS by ConnorMcLeod
enum _:ADMIN_DATAS 
{ 
    m_szName[32], 
    m_iFlag 
} 

new const AdminsDatas[][ADMIN_DATAS] =  
{ 
    {"Owner", ADMIN_IMMUNITY}, 
    {"Manager", ADMIN_BAN}, 
    // {"SuperAdmin", ADMIN_CFG}, 
    {"Admin", ADMIN_KICK}, 
    {"VIP", ADMIN_RESERVATION} 
};

public plugin_init()
{
	register_plugin("Deathrun XP & Level Mod", "0.0.9", "aNg*@dy")
	
	register_message(get_user_msgid("SayText"),"Message_SayText"); // CREDITS TO ConnorMcLeod
	
	RegisterHam ( Ham_Spawn, "player", "Ham_CheckOthers_Bonus", 1);
	RegisterHam ( Ham_TakeDamage, "player", "Ham_CheckDamage_Bonus", .Post = false );
	
	g_iMaxPlayers = get_maxplayers( );
	
	register_cvar( "AdminChatColors_On", "1" ); // Admin Tag - Example: [Admin] Freestyle
	register_cvar( "XP_Reward_MSG", "1" ); // Message of the XP Gain
	
	// CHAT COMMANDS //
	register_clcmd ( "say /xp", "ShowPlayerXP")
	register_clcmd ( "say_team /xp", "ShowPlayerXP")
	register_clcmd ( "say /level", "ShowPlayerLevel")
	register_clcmd ( "say_team /level", "ShowPlayerLevel")
	
	// XP SYSTEM //
	KillXp	= register_cvar("drxp_per_kill", "5")
	HsXp	= register_cvar("drxp_per_hs", "10")
	HeXp	= register_cvar("drxp_per_nade_kill", "10")
	//KnifeXp	= register_cvar("drxp_per_knife_kill", "10")
	
	// Give & Remove XP //
	register_concmd ( "give_xp", "CmdAddXP", ADMIN_RCON, "<nick, #userid, authid | @all> <xp>" )
	register_concmd ( "remove_xp", "CmdRemoveXP", ADMIN_RCON, "<nick, #userid, authid | @all> <xp>" )
	
	/* Bonus Stuff */
	
	// Health Per Level //
	healthperlevel	= register_cvar("health_per_lvl", "10")
	
	// Armor Per Level //
	armorperlevel	= register_cvar("armor_per_lvl", "10") 
	
	// Speed Per Level //
	speedperlevel	= register_cvar("speed_per_lvl", "10")
	
	// Gravity Per Level //
	gravityperlvl	= register_cvar("gravity_per_lvl", "10") // NERVER MORE THAN 66 PER LVL
	
	// Damage Per Level //
	damageperlevel	= register_cvar("damage_per_lvl", "10")
	
	g_msgHudSync = CreateHudSyncObj()
}

public plugin_cfg( )
{	
	gVault = nvault_open( "DEATHRUN_XP" )
	
	if ( gVault == INVALID_HANDLE )
		set_fail_state( "Error opening nVault" );
}

/*      INFO ABOUT PERSONAL XP/LEVEL      */
public ShowPlayerXP(id)
{
	ColorChat(id, GREY, "%s Ai ^4%i^3 XP si esti levelul ^4%s^3!", szPrefix, eXP[id], Prefix[Level[id]])
}

public ShowPlayerLevel(id)
{
	new name[32]
	get_user_name(id, name, sizeof(name) -1)
		
	ColorChat(id, GREY, "%s Esti levelul ^4%s^3 cu ^4%i^3 XP!", szPrefix, Prefix[Level[id]], eXP[id])
}

public Ham_CheckDamage_Bonus( pevVictim, pevInflictor, pevAttacker, Float:flDamage, iDmgBits ) 
{ 
    if( !( 1 <= pevAttacker <= g_iMaxPlayers) ) 
    { 
        return HAM_HANDLED; 
    } 
     
    if( !is_user_alive( pevAttacker )  ) 
    { 
        return HAM_HANDLED; 
    } 

    SetHamParamFloat( 4 , flDamage + ( get_pcvar_num( damageperlevel ) * Level[ pevAttacker ] ) ) 

    return HAM_IGNORED; 
}

/*      HP & AP & Gravity Check      */
public Ham_CheckOthers_Bonus(id)
{
	if( !is_user_alive( id ) || cs_get_user_team( id ) != CS_TEAM_T )
		return HAM_IGNORED;
		
	// HP Check
	new HPCheck = ( get_user_health(id) + get_pcvar_num(healthperlevel) * Level[ id ] );
	set_user_health( id, HPCheck );
	
	// AP Check
	new APCheck = ( get_user_armor(id) + get_pcvar_num(armorperlevel) * Level[ id ] );
	set_user_armor( id, APCheck );
	
	// Gravity
	new GRAVITYCheck = 800 - ( get_pcvar_num( gravityperlvl ) * Level[ id ] );
	
	if(get_pcvar_num(gravityperlvl) > 66)
	{
		set_user_gravity( id, float( 8 ) / 800.0 );
	}
	else
	{
		set_user_gravity( id, float( GRAVITYCheck ) / 800.0 );
	}
	
	remove_task( TASK_SHOW_HUD + id );		

	set_task(0.1, "ShowHud", TASK_SHOW_HUD + id)
			
	return HAM_IGNORED;
}

/*      Respected Player Join / Leave Stuff      */

public LvL_12_PlayerJoin(id)
{
	new name[32]
	get_user_name(id, name, sizeof(name) -1)
		
	ColorChat(0, GREY, "%s ^4Jucator Respectat : ^1%s^4 s-a conectat pe Dr.XqS.Ro cu ^1%i^4 XP!", szPrefix, name, eXP[id])
}

public LvL_12_PlayerRemove(id)
{
	new name[32]
	get_user_name(id, name, sizeof(name) -1)
		
	ColorChat(0, GREY, "%s ^4Jucator Respectat : %s s-a deconectat de pe Dr.XqS.Ro cu %i XP!", szPrefix, name, eXP[id])
}

public plugin_end( )
	nvault_close( gVault )
	
public client_putinserver(id)
{
	LoadData(id)
	set_task( 3.0, "ShowHud", id, .flags = "b" );
	
	if(Level[id] == 12)
	{
		set_task(5.0, "LvL_12_PlayerJoin", id)
	}
}

public client_disconnect(id)
{
	SaveData(id)
	
	if(Level[id] == 12)
	{
		set_task(1.0, "LvL_12_PlayerRemove", id)
	}
}

/*      XP REWARDS      */
public client_death( iKiller, iVictim, wpnindex, hitplace )
{
	new vname[32]
	new kname[32]
	
	get_user_name( iKiller, kname, charsmax( kname ) )
	get_user_name( iVictim, vname, charsmax( vname ) )

	if( is_user_ignored[ iKiller ] )
		return PLUGIN_HANDLED_MAIN
	
	get_user_name( iKiller, kname, charsmax( kname ) )
	get_user_name( iVictim, vname, charsmax( vname ) )
	
	if( iKiller != iVictim && ( 1 <= iKiller <= g_iMaxPlayers ) && ( 1 <= iVictim <= g_iMaxPlayers ) && !( hitplace == HIT_HEAD ) && !( wpnindex == CSW_HEGRENADE ) )
	{
		eXP[iKiller] += get_pcvar_num(KillXp)
		
		if( get_cvar_num("XP_Reward_MSG") == 1 ) 
		{
			ColorChat ( iKiller, GREY, "%s Ai primit^4 %i^3 XP pentru kill^4 %s^3", szPrefix, get_pcvar_num(KillXp), vname )
		}
	}
	
	if( hitplace == HIT_HEAD )
	{
		eXP[iKiller] += get_pcvar_num(HsXp)
		
		if( get_cvar_num("XP_Reward_MSG") == 1 ) 
		{
			ColorChat ( iKiller, GREY, "%s Ai primit ^4%i^3 XP pentru ca l-ai omorat pe ^4%s^3 cu ^4HeadShot", szPrefix, get_pcvar_num (HsXp), vname )
		}
	}
	
	if( wpnindex == CSW_HEGRENADE && iKiller != iVictim )
	{
		eXP[iKiller] += get_pcvar_num(HeXp)
		
		if( get_cvar_num("XP_Reward_MSG") == 1 ) 
		{
			ColorChat( iKiller, GREEN, "%s^1 Ai primit^4 %i^3 XP pentru ca l-ai omorat pe^4 %s^3 cu o ^4Grenada", szPrefix, get_pcvar_num (HeXp), vname )
		}
	}
	CheckLevel(iKiller)
	SaveData(iKiller)
	
	return PLUGIN_CONTINUE
}

public CheckLevel(id)
{
	if(Level[id] < MaxLevels-1)
	{
		while(eXP[id] >= Levels[Level[id]])
		{
			Level[id] += 1 
			ColorChat(id, GREY, "%s Felicitari ai trecut levelul , acum esti levelul : ^4%i^3", szPrefix, Level[id])
		}
	} 
}

/*      HUD PERMANENT INFO      */
public ShowHud(task)
{
	new id = task - TASK_SHOW_HUD
	
	if(!is_user_alive(id))
		return;
	
	set_hudmessage(0, 255, 0, 0.02, 0.33, 0, 0.0, 0.3, 0.0, 0.0)
	ShowSyncHudMsg(id, g_msgHudSync,"[Status : %s]^n[XP : %i]", Prefix[Level[id]], eXP[id])
	
	set_task(0.1, "ShowHud", TASK_SHOW_HUD + id)	
}

/*      nVault Stuff      */
public SaveData(id) 
{ 
	new AuthID[35]
	get_user_authid(id,AuthID,34) 
	new vaultkey[64],vaultdata[256] 
	
	format(vaultkey,63,"%s-Mod",AuthID) 
	format(vaultdata,255,"%i#%i#",eXP[id],Level[id]) 
	
	nvault_set(gVault,vaultkey,vaultdata) 
	
	return PLUGIN_CONTINUE 
} 
public LoadData(id) 
{ 
	new AuthID[35]
	get_user_authid(id,AuthID,34) 
	new vaultkey[64],vaultdata[256] 
	
	format(vaultkey,63,"%s-Mod",AuthID) 
	format(vaultdata,255,"%i#%i#",eXP[id],Level[id]) 
	
	nvault_get(gVault,vaultkey,vaultdata,255) 
	
	replace_all(vaultdata, 255, "#", " ") 
	
	new playerxp[32], playerlevel[32] 
	
	parse(vaultdata, playerxp, 31, playerlevel, 31) 
	
	eXP[id] = str_to_num(playerxp) 
	
	Level[id] = str_to_num(playerlevel) 
	
	return PLUGIN_CONTINUE 
} 

/*      Remove And Add XP      */
public CmdAddXP ( iPlayer, level, cid )
{
	if( !cmd_access( iPlayer, level, cid, 3 ) ) return PLUGIN_HANDLED;
	   
	new arg [ 32 ]
	read_argv ( 1, arg, 31 ) 
 
	new AddXP [ 32 ]
	read_argv ( 2, AddXP, charsmax ( AddXP ) )
 
	new XPtoGive = str_to_num ( AddXP )
	   
	new AdminName [ 32 ]
	new TargetName [ 32 ]
	get_user_name ( iPlayer, AdminName, charsmax ( AdminName ) )
	   
	if( arg[0]=='@' )
	{ 
		if( equali(arg[1],"All") || equali(arg[1],"ALL") )
		{
			new players[32], totalplayers, All
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				All = players[ i ]
					   
				eXP[ All ] += XPtoGive
			}
			
			CheckLevel( All )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to all ^1 players^3!", szPrefix, AdminName, XPtoGive )
		}
		else if( equali(arg[1],"T") || equali(arg[1],"t") )
		{
			new players[32], totalplayers, T
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				if ( get_user_team(players[ i ]) == 1 )
				{
					T = players[ i ]
						   
					eXP[ T ] += XPtoGive
				}
			}
			
			CheckLevel( T )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to all ^1 Terrorists^3!", szPrefix, AdminName, XPtoGive )
		}
		else if( equali(arg[1],"CT") || equali(arg[1],"ct") )
		{
			new players[32], totalplayers, CT
			get_players( players, totalplayers )
		    
			for( new i = 0; i < totalplayers; i++ )
			{
				if( get_user_team(players[ i ] ) == 2 )
				{
					CT = players[ i ]
						   
					eXP[ CT ] += XPtoGive
				}
			}
			
			CheckLevel( CT )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to all ^1 Counter-Terrorists^3!", szPrefix, AdminName, XPtoGive )
		}
	}
	else
	{
		new iTarget = cmd_target( iPlayer, arg, 3 )
		get_user_name ( iTarget, TargetName, charsmax ( TargetName ) )
		
		if( iTarget )
		{
			eXP[ iTarget ] += XPtoGive
			
			CheckLevel( iTarget )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to^1 %s^3", szPrefix, AdminName, XPtoGive, TargetName )
		}
	}
	return PLUGIN_HANDLED
}
 
public CmdRemoveXP ( iPlayer, level, cid )
{
	if( !cmd_access(iPlayer, level, cid, 3) ) return PLUGIN_HANDLED;
	   
	new arg [ 32 ]
	read_argv ( 1, arg, 31 ) 
 
	new RemoveXP [ 32 ]
	read_argv ( 2, RemoveXP, charsmax ( RemoveXP ) )
 
	new XPtoRemove = str_to_num ( RemoveXP )
	   
	new AdminName [ 32 ]
	new TargetName [ 32 ]
	get_user_name ( iPlayer, AdminName, charsmax ( AdminName ) )
	   
	if( arg[0]=='@' )
	{ 
		if( equali(arg[1],"All") || equali(arg[1],"ALL") )
		{
			new players[32], totalplayers, All
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				All = players[ i ]
					   
				eXP[ All ] -= XPtoRemove
			}
			
			CheckLevel( All )
			ColorChat ( 0, GREY, "%s ^1%s^3 toke^1 %i^3 XP of all ^1 players^3!", szPrefix, AdminName, XPtoRemove )
		}
		else if( equali(arg[1],"T") || equali(arg[1],"t") )
		{
			new players[32], totalplayers, T
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				if ( get_user_team(players[ i ]) == 1 )
				{
					T = players[ i ]
						   
					eXP[ T ] -= XPtoRemove
				}
			}
			
			CheckLevel( T )
			ColorChat ( 0, GREY, "%s ^1%s^3 toke^1 %i^3 XP of all ^1 Terrorists^3!", szPrefix, AdminName, XPtoRemove )
		}
		else if( equali(arg[1],"CT") || equali(arg[1],"ct") )
		{
			new players[32], totalplayers, CT
			get_players( players, totalplayers )
		    
			for( new i = 0; i < totalplayers; i++ )
			{
				if( get_user_team(players[ i ] ) == 2 )
				{
					CT = players[ i ]
						   
					eXP[ CT ] -= XPtoRemove
				}
			}
			
			CheckLevel( CT )
			ColorChat ( 0, GREY, "%s ^1%s^3 toke^1 %i^3 XP of all ^1 Counter-Terrorists^3!", szPrefix, AdminName, XPtoRemove )
		}
	}
	else
	{
		new iTarget = cmd_target( iPlayer, arg, 3 )
		get_user_name ( iTarget, TargetName, charsmax ( TargetName ) )
		
		if( !iTarget )
			return PLUGIN_HANDLED
			
		eXP[ iTarget ] -= XPtoRemove
			
		CheckLevel( iTarget )
		ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to^1 %s^3", szPrefix, AdminName, XPtoRemove, TargetName )
	}
	
	return PLUGIN_HANDLED
}
/*      Level Behind Nick & AdminChatColors
              CREDITS TO ConnorMcLeod            */
public Message_SayText(msgId,msgDest,msgEnt) 
{ 
	new id = get_msg_arg_int(1); 
	if( is_user_connected(id) ) 
	{ 
		if( get_cvar_num("AdminChatColors_On") == 1 ) 
		{
			new flags = get_user_flags(id)
			for(new i; i<sizeof(AdminsDatas); i++) 
			{ 
				if( flags & AdminsDatas[m_iFlag] ) 
				{ 
					new szChannel[64]
					get_msg_arg_string(2, szChannel, charsmax(szChannel))
		
					if( equal(szChannel, "#Cstrike_Chat_All") ) 
					{ 
					    formatex(szChannel, charsmax(szChannel), "^4[%s - %s] ^3%%s1 ^1:  %%s2", Prefix[Level[id]], AdminsDatas[m_szName])
					    set_msg_arg_string(2, szChannel)
					} 
					else if( !equal(szChannel, "#Cstrike_Name_Change") ) 
					{ 
					    format(szChannel, charsmax(szChannel), "^4[%s - %s] %s", Prefix[Level[id]], AdminsDatas[m_szName], szChannel)
					    set_msg_arg_string(2, szChannel)
					} 
					return
				} 
				else
				{
					new szChannel[64]
					get_msg_arg_string(2, szChannel, charsmax(szChannel))
		
					if( equal(szChannel, "#Cstrike_Chat_All") ) 
					{ 
					    formatex(szChannel, charsmax(szChannel), "^4[%s] ^3%%s1 ^1:  %%s2", Prefix[Level[id]])
					    set_msg_arg_string(2, szChannel)
					} 
					else if( !equal(szChannel, "#Cstrike_Name_Change") ) 
					{ 
					    format(szChannel, charsmax(szChannel), "^4[%s] %s", Prefix[Level[id]], szChannel)
					    set_msg_arg_string(2, szChannel)
					} 
					return 
				}
			} 
		}
		else
		{
			new szChannel[64]
			get_msg_arg_string(2, szChannel, charsmax(szChannel));
		
			if( equal(szChannel, "#Cstrike_Chat_All") ) 
			{ 
				formatex(szChannel, charsmax(szChannel), "^4[%s] ^3%%s1 ^1:  %%s2", Prefix[Level[id]])
				set_msg_arg_string(2, szChannel)
			} 
			else if( !equal(szChannel, "#Cstrike_Name_Change") ) 
			{ 
				format(szChannel, charsmax(szChannel), "^4[%s] %s", Prefix[Level[id]], szChannel) 
				set_msg_arg_string(2, szChannel)
			} 
			return 
		}
	} 
}
User avatar
PapiLover
Utilizator neserios (tepar)
Utilizator neserios (tepar)
Posts: 1698
Joined: 22 Aug 2013, 13:26
Detinator Steam: Nu
CS Status: n/a
Detinator server CS: n/a
SteamID: n/a
Reputatie: Restrictie moderator
Utilizator neserios (tepar)
Fost Membru Club eXtreamCS (doua luni)
Has thanked: 33 times
Been thanked: 28 times
Contact:

27 Feb 2014, 22:09

@kid #: ce i-ai dat tu nu se compileaza.

Incearca asta, imi spui rezultatul.
| Afiseaza codul
/////////////////////////////////////////////////////////////////////////////
//==============================	
//=  Dr.XqS.Ro XP & Level Mod   =
//==============================	
//
////////////////////////////////////////////////////////////////////

#include <amxmodx>
#include <amxmisc>
#include <nvault>  
#include <colorchat>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>

new Level[33], eXP[33]
new KillXp, HsXp, HeXp/*, KnifeXp*/
new gVault

new const szPrefix[] = "[^4Dr.XqS.Ro XP^3] -"

#define MaxLevels 12
#define IsPlayer(%1) ( 1 <= %1 <=  g_iMaxPlayers )
#define TASK_SHOW_HUD 10113

new g_msgHudSync
new bool:is_user_ignored[ 33 ]

new const Levels[MaxLevels] = 
{
	100, // Incepator #1
	150, // Elev #2
	200, // Jucator Bun #3
	250, // Talentat #4
	300, // Foarte Bun #5
	350, // Smecher #6
	400, // Cunoscut de toti #7
	450, // Veteran #8
	550, // Zmeu #9
	600, // Primul Loc #10
	650, // Deathruner #11
	700 // Jucator Respectat #12
}
new const Prefix[MaxLevels +1][] =
{
	"Incepator", // 0
	"Elev", // 1
	"Jucator Bun",  // 2
	"Talentat", // 3
	"Foarte Bun", // 4
	"Smecher",  // 5
	"Cunoscut de toti", // 6
	"Veteran", // 7
	"Zmeu", // 8
	"Primul Loc", // 9
	"Deathruner", // 10
	"Cel mai bun", // 11
	"Jucator Respectat" // 12
}

// Bonus Stuff
new healthperlevel,
	armorperlevel,
	//speedperlevel,
	damageperlevel,
	gravityperlvl
	
new g_iMaxPlayers

// ADMIN CHAT COLORS by ConnorMcLeod
enum _:ADMIN_DATAS 
{ 
    m_szName[32], 
    m_iFlag 
} 

new const AdminsDatas[][ADMIN_DATAS] =  
{ 
    {"Owner", ADMIN_IMMUNITY}, 
    {"Manager", ADMIN_BAN}, 
    // {"SuperAdmin", ADMIN_CFG}, 
    {"Admin", ADMIN_KICK}, 
    {"VIP", ADMIN_RESERVATION} 
};

public plugin_init() 
{
	register_plugin("Deathrun XP & Level Mod", "0.0.9", "aNg*@dy")
	
	register_message(get_user_msgid("SayText"),"Message_SayText"); // CREDITS TO ConnorMcLeod
	
	RegisterHam ( Ham_Spawn, "player", "Ham_CheckOthers_Bonus", 1);
	RegisterHam ( Ham_TakeDamage, "player", "Ham_CheckDamage_Bonus", .Post = false );
	RegisterHam ( Ham_Item_PreFrame, "player", "Ham_CheckSpeed_Bonus", 1);
	
	g_iMaxPlayers = get_maxplayers( );
	
	register_cvar( "AdminChatColors_On", "1" ); // Admin Tag - Example: [Admin] Freestyle
	register_cvar( "XP_Reward_MSG", "1" ); // Message of the XP Gain
	
	// CHAT COMMANDS //
	register_clcmd ( "say /xp", "ShowPlayerXP")
	register_clcmd ( "say_team /xp", "ShowPlayerXP")
	register_clcmd ( "say /level", "ShowPlayerLevel")
	register_clcmd ( "say_team /level", "ShowPlayerLevel")
	
	// XP SYSTEM //
	KillXp	= register_cvar("drxp_per_kill", "5")
	HsXp	= register_cvar("drxp_per_hs", "10")
	HeXp	= register_cvar("drxp_per_nade_kill", "10")
	//KnifeXp	= register_cvar("drxp_per_knife_kill", "10")
	
	// Give & Remove XP //
	register_concmd ( "give_xp", "CmdAddXP", ADMIN_RCON, "<nick, #userid, authid | @all> <xp>" )
	register_concmd ( "remove_xp", "CmdRemoveXP", ADMIN_RCON, "<nick, #userid, authid | @all> <xp>" )
	
	/* Bonus Stuff */
	
	// Health Per Level //
	healthperlevel	= register_cvar("health_per_lvl", "10")
	
	// Armor Per Level //
	armorperlevel	= register_cvar("armor_per_lvl", "10") 
	
	// Speed Per Level //
	//speedperlevel	= register_cvar("speed_per_lvl", "10")
	
	// Gravity Per Level //
	gravityperlvl	= register_cvar("gravity_per_lvl", "10") // NERVER MORE THAN 66 PER LVL
	
	// Damage Per Level //
	damageperlevel	= register_cvar("damage_per_lvl", "10")
	
	g_msgHudSync = CreateHudSyncObj()
}

public plugin_cfg( )
{	
	gVault = nvault_open( "DEATHRUN_XP" )
	
	if ( gVault == INVALID_HANDLE )
		set_fail_state( "Error opening nVault" );
}

/*      INFO ABOUT PERSONAL XP/LEVEL      */
public ShowPlayerXP(id)
{
	ColorChat(id, GREY, "%s Ai ^4%i^3 XP si esti levelul ^4%s^3!", szPrefix, eXP[id], Prefix[Level[id]])
}

public ShowPlayerLevel(id)
{
	new name[32]
	get_user_name(id, name, sizeof(name) -1)
		
	ColorChat(id, GREY, "%s Esti levelul ^4%s^3 cu ^4%i^3 XP!", szPrefix, Prefix[Level[id]], eXP[id])
}

public Ham_CheckDamage_Bonus( pevVictim, pevInflictor, pevAttacker, Float:flDamage, iDmgBits ) 
{ 
    if( !( 1 <= pevAttacker <= g_iMaxPlayers) ) 
    { 
        return HAM_HANDLED; 
    } 
     
    if( !is_user_alive( pevAttacker )  ) 
    { 
        return HAM_HANDLED; 
    } 

    SetHamParamFloat( 4 , flDamage + ( get_pcvar_num( damageperlevel ) * Level[ pevAttacker ] ) ) 

    return HAM_IGNORED; 
} 

/*      Speed Check      */
public Ham_CheckSpeed_Bonus( id )
{
	if( !is_user_alive( id ) )
	{
		return HAM_IGNORED;
	}
	
	//set_user_maxspeed( id, 250.0 + ( get_pcvar_num(speedperlevel) * Level[ id ] ) );
			
	return HAM_IGNORED;
}

/*      HP & AP & Gravity Check      */
public Ham_CheckOthers_Bonus(id)
{
	if( !is_user_alive( id ))
		return HAM_IGNORED;
		
	// HP Check
	new HPCheck = ( get_user_health(id) + get_pcvar_num(healthperlevel) * Level[ id ] );
	set_user_health( id, HPCheck );
	
	// AP Check
	new APCheck = ( get_user_armor(id) + get_pcvar_num(armorperlevel) * Level[ id ] );
	set_user_armor( id, APCheck );
	
	// Gravity
	new GRAVITYCheck = 800 - ( get_pcvar_num( gravityperlvl ) * Level[ id ] );
	
	if(get_pcvar_num(gravityperlvl) > 66)
	{
		set_user_gravity( id, float( 8 ) / 800.0 );
	}
	else
	{
		set_user_gravity( id, float( GRAVITYCheck ) / 800.0 );
	}
	
	remove_task( TASK_SHOW_HUD + id );		

	set_task(0.1, "ShowHud", TASK_SHOW_HUD + id)
			
	return HAM_IGNORED;
}

/*      Respected Player Join / Leave Stuff      */

public LvL_12_PlayerJoin(id)
{
	new name[32]
	get_user_name(id, name, sizeof(name) -1)
		
	ColorChat(0, GREY, "%s ^4Jucator Respectat : ^1%s^4 s-a conectat pe Dr.XqS.Ro cu ^1%i^4 XP!", szPrefix, name, eXP[id])
}

public LvL_12_PlayerRemove(id)
{
	new name[32]
	get_user_name(id, name, sizeof(name) -1)
		
	ColorChat(0, GREY, "%s ^4Jucator Respectat : %s s-a deconectat de pe Dr.XqS.Ro cu %i XP!", szPrefix, name, eXP[id])
}

public plugin_end( )
	nvault_close( gVault )
	
public client_putinserver(id)
{
	LoadData(id)
	set_task( 3.0, "ShowHud", id, .flags = "b" );
	
	if(Level[id] == 12)
	{
		set_task(5.0, "LvL_12_PlayerJoin", id)
	}
}

public client_disconnect(id)
{
	SaveData(id)
	
	if(Level[id] == 12)
	{
		set_task(1.0, "LvL_12_PlayerRemove", id)
	}
}

/*      XP REWARDS      */
public client_death( iKiller, iVictim, wpnindex, hitplace )
{
	new vname[32]
	new kname[32]
	
	get_user_name( iKiller, kname, charsmax( kname ) )
	get_user_name( iVictim, vname, charsmax( vname ) )

	if( is_user_ignored[ iKiller ] )
		return PLUGIN_HANDLED_MAIN
	
	get_user_name( iKiller, kname, charsmax( kname ) )
	get_user_name( iVictim, vname, charsmax( vname ) )
	
	if( iKiller != iVictim && ( 1 <= iKiller <= g_iMaxPlayers ) && ( 1 <= iVictim <= g_iMaxPlayers ) && !( hitplace == HIT_HEAD ) && !( wpnindex == CSW_HEGRENADE ) )
	{
		eXP[iKiller] += get_pcvar_num(KillXp)
		
		if( get_cvar_num("XP_Reward_MSG") == 1 ) 
		{
			ColorChat ( iKiller, GREY, "%s Ai primit^4 %i^3 XP pentru kill^4 %s^3", szPrefix, get_pcvar_num(KillXp), vname )
		}
	}
	
	if( hitplace == HIT_HEAD )
	{
		eXP[iKiller] += get_pcvar_num(HsXp)
		
		if( get_cvar_num("XP_Reward_MSG") == 1 ) 
		{
			ColorChat ( iKiller, GREY, "%s Ai primit ^4%i^3 XP pentru ca l-ai omorat pe ^4%s^3 cu ^4HeadShot", szPrefix, get_pcvar_num (HsXp), vname )
		}
	}
	
	if( wpnindex == CSW_HEGRENADE && iKiller != iVictim )
	{
		eXP[iKiller] += get_pcvar_num(HeXp)
		
		if( get_cvar_num("XP_Reward_MSG") == 1 ) 
		{
			ColorChat( iKiller, GREEN, "%s^1 Ai primit^4 %i^3 XP pentru ca l-ai omorat pe^4 %s^3 cu o ^4Grenada", szPrefix, get_pcvar_num (HeXp), vname )
		}
	}
	CheckLevel(iKiller)
	SaveData(iKiller)
	
	return PLUGIN_CONTINUE
}

public CheckLevel(id)
{
	if(Level[id] < MaxLevels-1)
	{
		while(eXP[id] >= Levels[Level[id]])
		{
			Level[id] += 1 
			ColorChat(id, GREY, "%s Felicitari ai trecut levelul , acum esti levelul : ^4%i^3", szPrefix, Level[id])
		}
	} 
}

/*      HUD PERMANENT INFO      */
public ShowHud(task)
{
	new id = task - TASK_SHOW_HUD
	
	if(!is_user_alive(id))
		return;
	
	set_hudmessage(0, 255, 0, 0.02, 0.33, 0, 0.0, 0.3, 0.0, 0.0)
	ShowSyncHudMsg(id, g_msgHudSync,"[Status : %s]^n[XP : %i]", Prefix[Level[id]], eXP[id])
	
	set_task(0.1, "ShowHud", TASK_SHOW_HUD + id)	
}

/*      nVault Stuff      */
public SaveData(id) 
{ 
	new AuthID[35]
	get_user_authid(id,AuthID,34) 
	new vaultkey[64],vaultdata[256] 
	
	format(vaultkey,63,"%s-Mod",AuthID) 
	format(vaultdata,255,"%i#%i#",eXP[id],Level[id]) 
	
	nvault_set(gVault,vaultkey,vaultdata) 
	
	return PLUGIN_CONTINUE 
} 
public LoadData(id) 
{ 
	new AuthID[35]
	get_user_authid(id,AuthID,34) 
	new vaultkey[64],vaultdata[256] 
	
	format(vaultkey,63,"%s-Mod",AuthID) 
	format(vaultdata,255,"%i#%i#",eXP[id],Level[id]) 
	
	nvault_get(gVault,vaultkey,vaultdata,255) 
	
	replace_all(vaultdata, 255, "#", " ") 
	
	new playerxp[32], playerlevel[32] 
	
	parse(vaultdata, playerxp, 31, playerlevel, 31) 
	
	eXP[id] = str_to_num(playerxp) 
	
	Level[id] = str_to_num(playerlevel) 
	
	return PLUGIN_CONTINUE 
} 

/*      Remove And Add XP      */
public CmdAddXP ( iPlayer, level, cid )
{
	if( !cmd_access( iPlayer, level, cid, 3 ) ) return PLUGIN_HANDLED;
	   
	new arg [ 32 ]
	read_argv ( 1, arg, 31 ) 
 
	new AddXP [ 32 ]
	read_argv ( 2, AddXP, charsmax ( AddXP ) )
 
	new XPtoGive = str_to_num ( AddXP )
	   
	new AdminName [ 32 ]
	new TargetName [ 32 ]
	get_user_name ( iPlayer, AdminName, charsmax ( AdminName ) )
	   
	if( arg[0]=='@' )
	{ 
		if( equali(arg[1],"All") || equali(arg[1],"ALL") )
		{
			new players[32], totalplayers, All
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				All = players[ i ]
					   
				eXP[ All ] += XPtoGive
			}
			
			CheckLevel( All )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to all ^1 players^3!", szPrefix, AdminName, XPtoGive )
		}
		else if( equali(arg[1],"T") || equali(arg[1],"t") )
		{
			new players[32], totalplayers, T
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				if ( get_user_team(players[ i ]) == 1 )
				{
					T = players[ i ]
						   
					eXP[ T ] += XPtoGive
				}
			}
			
			CheckLevel( T )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to all ^1 Terrorists^3!", szPrefix, AdminName, XPtoGive )
		}
		else if( equali(arg[1],"CT") || equali(arg[1],"ct") )
		{
			new players[32], totalplayers, CT
			get_players( players, totalplayers )
		    
			for( new i = 0; i < totalplayers; i++ )
			{
				if( get_user_team(players[ i ] ) == 2 )
				{
					CT = players[ i ]
						   
					eXP[ CT ] += XPtoGive
				}
			}
			
			CheckLevel( CT )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to all ^1 Counter-Terrorists^3!", szPrefix, AdminName, XPtoGive )
		}
	}
	else
	{
		new iTarget = cmd_target( iPlayer, arg, 3 )
		get_user_name ( iTarget, TargetName, charsmax ( TargetName ) )
		
		if( iTarget )
		{
			eXP[ iTarget ] += XPtoGive
			
			CheckLevel( iTarget )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to^1 %s^3", szPrefix, AdminName, XPtoGive, TargetName )
		}
	}
	return PLUGIN_HANDLED
}
 
public CmdRemoveXP ( iPlayer, level, cid )
{
	if( !cmd_access(iPlayer, level, cid, 3) ) return PLUGIN_HANDLED;
	   
	new arg [ 32 ]
	read_argv ( 1, arg, 31 ) 
 
	new RemoveXP [ 32 ]
	read_argv ( 2, RemoveXP, charsmax ( RemoveXP ) )
 
	new XPtoRemove = str_to_num ( RemoveXP )
	   
	new AdminName [ 32 ]
	new TargetName [ 32 ]
	get_user_name ( iPlayer, AdminName, charsmax ( AdminName ) )
	   
	if( arg[0]=='@' )
	{ 
		if( equali(arg[1],"All") || equali(arg[1],"ALL") )
		{
			new players[32], totalplayers, All
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				All = players[ i ]
					   
				eXP[ All ] -= XPtoRemove
			}
			
			CheckLevel( All )
			ColorChat ( 0, GREY, "%s ^1%s^3 toke^1 %i^3 XP of all ^1 players^3!", szPrefix, AdminName, XPtoRemove )
		}
		else if( equali(arg[1],"T") || equali(arg[1],"t") )
		{
			new players[32], totalplayers, T
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				if ( get_user_team(players[ i ]) == 1 )
				{
					T = players[ i ]
						   
					eXP[ T ] -= XPtoRemove
				}
			}
			
			CheckLevel( T )
			ColorChat ( 0, GREY, "%s ^1%s^3 toke^1 %i^3 XP of all ^1 Terrorists^3!", szPrefix, AdminName, XPtoRemove )
		}
		else if( equali(arg[1],"CT") || equali(arg[1],"ct") )
		{
			new players[32], totalplayers, CT
			get_players( players, totalplayers )
		    
			for( new i = 0; i < totalplayers; i++ )
			{
				if( get_user_team(players[ i ] ) == 2 )
				{
					CT = players[ i ]
						   
					eXP[ CT ] -= XPtoRemove
				}
			}
			
			CheckLevel( CT )
			ColorChat ( 0, GREY, "%s ^1%s^3 toke^1 %i^3 XP of all ^1 Counter-Terrorists^3!", szPrefix, AdminName, XPtoRemove )
		}
	}
	else
	{
		new iTarget = cmd_target( iPlayer, arg, 3 )
		get_user_name ( iTarget, TargetName, charsmax ( TargetName ) )
		
		if( !iTarget )
			return PLUGIN_HANDLED
			
		eXP[ iTarget ] -= XPtoRemove
			
		CheckLevel( iTarget )
		ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to^1 %s^3", szPrefix, AdminName, XPtoRemove, TargetName )
	}
	
	return PLUGIN_HANDLED
}
/*      Level Behind Nick & AdminChatColors
              CREDITS TO ConnorMcLeod            */
public Message_SayText(msgId,msgDest,msgEnt) 
{ 
	new id = get_msg_arg_int(1); 
	if( is_user_connected(id) ) 
	{ 
		if( get_cvar_num("AdminChatColors_On") == 1 ) 
		{
			new flags = get_user_flags(id)
			for(new i; i<sizeof(AdminsDatas); i++) 
			{ 
				if( flags & AdminsDatas[m_iFlag] ) 
				{ 
					new szChannel[64]
					get_msg_arg_string(2, szChannel, charsmax(szChannel))
		
					if( equal(szChannel, "#Cstrike_Chat_All") ) 
					{ 
					    formatex(szChannel, charsmax(szChannel), "^4[%s - %s] ^3%%s1 ^1:  %%s2", Prefix[Level[id]], AdminsDatas[m_szName])
					    set_msg_arg_string(2, szChannel)
					} 
					else if( !equal(szChannel, "#Cstrike_Name_Change") ) 
					{ 
					    format(szChannel, charsmax(szChannel), "^4[%s - %s] %s", Prefix[Level[id]], AdminsDatas[m_szName], szChannel)
					    set_msg_arg_string(2, szChannel)
					} 
					return
				} 
				else
				{
					new szChannel[64]
					get_msg_arg_string(2, szChannel, charsmax(szChannel))
		
					if( equal(szChannel, "#Cstrike_Chat_All") ) 
					{ 
					    formatex(szChannel, charsmax(szChannel), "^4[%s] ^3%%s1 ^1:  %%s2", Prefix[Level[id]])
					    set_msg_arg_string(2, szChannel)
					} 
					else if( !equal(szChannel, "#Cstrike_Name_Change") ) 
					{ 
					    format(szChannel, charsmax(szChannel), "^4[%s] %s", Prefix[Level[id]], szChannel)
					    set_msg_arg_string(2, szChannel)
					} 
					return 
				}
			} 
		}
		else
		{
			new szChannel[64]
			get_msg_arg_string(2, szChannel, charsmax(szChannel));
		
			if( equal(szChannel, "#Cstrike_Chat_All") ) 
			{ 
				formatex(szChannel, charsmax(szChannel), "^4[%s] ^3%%s1 ^1:  %%s2", Prefix[Level[id]])
				set_msg_arg_string(2, szChannel)
			} 
			else if( !equal(szChannel, "#Cstrike_Name_Change") ) 
			{ 
				format(szChannel, charsmax(szChannel), "^4[%s] %s", Prefix[Level[id]], szChannel) 
				set_msg_arg_string(2, szChannel)
			} 
			return 
		}
	} 
}
kid #
Membru, skill +1
Membru, skill +1
Posts: 112
Joined: 27 Feb 2014, 14:27
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Has thanked: 49 times
Been thanked: 15 times
Contact:

27 Feb 2014, 22:22

| Afiseaza codul
/////////////////////////////////////////////////////////////////////////////
//==============================	
//=  Dr.XqS.Ro XP & Level Mod   =
//==============================	
//
////////////////////////////////////////////////////////////////////

#include <amxmodx>
#include <amxmisc>
#include <nvault>  
#include <colorchat>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>

new Level[33], eXP[33]
new KillXp, HsXp, HeXp/*, KnifeXp*/
new gVault

new const szPrefix[] = "[^4Dr.XqS.Ro XP^3] -"

#define MaxLevels 12
#define IsPlayer(%1) ( 1 <= %1 <=  g_iMaxPlayers )
#define TASK_SHOW_HUD 10113

new g_msgHudSync
new bool:is_user_ignored[ 33 ]

new const Levels[MaxLevels] = 
{
	100, // Incepator #1
	150, // Elev #2
	200, // Jucator Bun #3
	250, // Talentat #4
	300, // Foarte Bun #5
	350, // Smecher #6
	400, // Cunoscut de toti #7
	450, // Veteran #8
	550, // Zmeu #9
	600, // Primul Loc #10
	650, // Deathruner #11
	700 // Jucator Respectat #12
}
new const Prefix[MaxLevels +1][] =
{
	"Incepator", // 0
	"Elev", // 1
	"Jucator Bun",  // 2
	"Talentat", // 3
	"Foarte Bun", // 4
	"Smecher",  // 5
	"Cunoscut de toti", // 6
	"Veteran", // 7
	"Zmeu", // 8
	"Primul Loc", // 9
	"Deathruner", // 10
	"Cel mai bun", // 11
	"Jucator Respectat" // 12
}

// Bonus Stuff
new healthperlevel,
	armorperlevel,
	damageperlevel,
	gravityperlvl
	
new g_iMaxPlayers

// ADMIN CHAT COLORS by ConnorMcLeod
enum _:ADMIN_DATAS 
{ 
    m_szName[32], 
    m_iFlag 
} 

new const AdminsDatas[][ADMIN_DATAS] =  
{ 
    {"Owner", ADMIN_IMMUNITY}, 
    {"Manager", ADMIN_BAN}, 
    // {"SuperAdmin", ADMIN_CFG}, 
    {"Admin", ADMIN_KICK}, 
    {"VIP", ADMIN_RESERVATION} 
};

public plugin_init()
{
	register_plugin("Deathrun XP & Level Mod", "0.0.9", "aNg*@dy")
	
	register_message(get_user_msgid("SayText"),"Message_SayText"); // CREDITS TO ConnorMcLeod
	
	RegisterHam ( Ham_Spawn, "player", "Ham_CheckOthers_Bonus", 1);
	RegisterHam ( Ham_TakeDamage, "player", "Ham_CheckDamage_Bonus", .Post = false );
	
	g_iMaxPlayers = get_maxplayers( );
	
	register_cvar( "AdminChatColors_On", "1" ); // Admin Tag - Example: [Admin] Freestyle
	register_cvar( "XP_Reward_MSG", "1" ); // Message of the XP Gain
	
	// CHAT COMMANDS //
	register_clcmd ( "say /xp", "ShowPlayerXP")
	register_clcmd ( "say_team /xp", "ShowPlayerXP")
	register_clcmd ( "say /level", "ShowPlayerLevel")
	register_clcmd ( "say_team /level", "ShowPlayerLevel")
	
	// XP SYSTEM //
	KillXp	= register_cvar("drxp_per_kill", "5")
	HsXp	= register_cvar("drxp_per_hs", "10")
	HeXp	= register_cvar("drxp_per_nade_kill", "10")
	//KnifeXp	= register_cvar("drxp_per_knife_kill", "10")
	
	// Give & Remove XP //
	register_concmd ( "give_xp", "CmdAddXP", ADMIN_RCON, "<nick, #userid, authid | @all> <xp>" )
	register_concmd ( "remove_xp", "CmdRemoveXP", ADMIN_RCON, "<nick, #userid, authid | @all> <xp>" )
	
	/* Bonus Stuff */
	
	// Health Per Level //
	healthperlevel	= register_cvar("health_per_lvl", "10")
	
	// Armor Per Level //
	armorperlevel	= register_cvar("armor_per_lvl", "10") 
	
	
	// Gravity Per Level //
	gravityperlvl	= register_cvar("gravity_per_lvl", "10") // NERVER MORE THAN 66 PER LVL
	
	// Damage Per Level //
	damageperlevel	= register_cvar("damage_per_lvl", "10")
	
	g_msgHudSync = CreateHudSyncObj()
}

public plugin_cfg( )
{	
	gVault = nvault_open( "DEATHRUN_XP" )
	
	if ( gVault == INVALID_HANDLE )
		set_fail_state( "Error opening nVault" );
}

/*      INFO ABOUT PERSONAL XP/LEVEL      */
public ShowPlayerXP(id)
{
	ColorChat(id, GREY, "%s Ai ^4%i^3 XP si esti levelul ^4%s^3!", szPrefix, eXP[id], Prefix[Level[id]])
}

public ShowPlayerLevel(id)
{
	new name[32]
	get_user_name(id, name, sizeof(name) -1)
		
	ColorChat(id, GREY, "%s Esti levelul ^4%s^3 cu ^4%i^3 XP!", szPrefix, Prefix[Level[id]], eXP[id])
}

public Ham_CheckDamage_Bonus( pevVictim, pevInflictor, pevAttacker, Float:flDamage, iDmgBits ) 
{ 
    if( !( 1 <= pevAttacker <= g_iMaxPlayers) ) 
    { 
        return HAM_HANDLED; 
    } 
     
    if( !is_user_alive( pevAttacker )  ) 
    { 
        return HAM_HANDLED; 
    } 

    SetHamParamFloat( 4 , flDamage + ( get_pcvar_num( damageperlevel ) * Level[ pevAttacker ] ) ) 

    return HAM_IGNORED; 
}

/*      HP & AP & Gravity Check      */
public Ham_CheckOthers_Bonus(id)
{
	if( !is_user_alive( id ) || cs_get_user_team( id ) != CS_TEAM_T )
		return HAM_IGNORED;
		
	// HP Check
	new HPCheck = ( get_user_health(id) + get_pcvar_num(healthperlevel) * Level[ id ] );
	set_user_health( id, HPCheck );
	
	// AP Check
	new APCheck = ( get_user_armor(id) + get_pcvar_num(armorperlevel) * Level[ id ] );
	set_user_armor( id, APCheck );
	
	// Gravity
	new GRAVITYCheck = 800 - ( get_pcvar_num( gravityperlvl ) * Level[ id ] );
	
	if(get_pcvar_num(gravityperlvl) > 66)
	{
		set_user_gravity( id, float( 8 ) / 800.0 );
	}
	else
	{
		set_user_gravity( id, float( GRAVITYCheck ) / 800.0 );
	}
	
	remove_task( TASK_SHOW_HUD + id );		

	set_task(0.1, "ShowHud", TASK_SHOW_HUD + id)
			
	return HAM_IGNORED;
}

/*      Respected Player Join / Leave Stuff      */

public LvL_12_PlayerJoin(id)
{
	new name[32]
	get_user_name(id, name, sizeof(name) -1)
		
	ColorChat(0, GREY, "%s ^4Jucator Respectat : ^1%s^4 s-a conectat pe Dr.XqS.Ro cu ^1%i^4 XP!", szPrefix, name, eXP[id])
}

public LvL_12_PlayerRemove(id)
{
	new name[32]
	get_user_name(id, name, sizeof(name) -1)
		
	ColorChat(0, GREY, "%s ^4Jucator Respectat : %s s-a deconectat de pe Dr.XqS.Ro cu %i XP!", szPrefix, name, eXP[id])
}

public plugin_end( )
	nvault_close( gVault )
	
public client_putinserver(id)
{
	LoadData(id)
	set_task( 3.0, "ShowHud", id, .flags = "b" );
	
	if(Level[id] == 12)
	{
		set_task(5.0, "LvL_12_PlayerJoin", id)
	}
}

public client_disconnect(id)
{
	SaveData(id)
	
	if(Level[id] == 12)
	{
		set_task(1.0, "LvL_12_PlayerRemove", id)
	}
}

/*      XP REWARDS      */
public client_death( iKiller, iVictim, wpnindex, hitplace )
{
	new vname[32]
	new kname[32]
	
	get_user_name( iKiller, kname, charsmax( kname ) )
	get_user_name( iVictim, vname, charsmax( vname ) )

	if( is_user_ignored[ iKiller ] )
		return PLUGIN_HANDLED_MAIN
	
	get_user_name( iKiller, kname, charsmax( kname ) )
	get_user_name( iVictim, vname, charsmax( vname ) )
	
	if( iKiller != iVictim && ( 1 <= iKiller <= g_iMaxPlayers ) && ( 1 <= iVictim <= g_iMaxPlayers ) && !( hitplace == HIT_HEAD ) && !( wpnindex == CSW_HEGRENADE ) )
	{
		eXP[iKiller] += get_pcvar_num(KillXp)
		
		if( get_cvar_num("XP_Reward_MSG") == 1 ) 
		{
			ColorChat ( iKiller, GREY, "%s Ai primit^4 %i^3 XP pentru kill^4 %s^3", szPrefix, get_pcvar_num(KillXp), vname )
		}
	}
	
	if( hitplace == HIT_HEAD )
	{
		eXP[iKiller] += get_pcvar_num(HsXp)
		
		if( get_cvar_num("XP_Reward_MSG") == 1 ) 
		{
			ColorChat ( iKiller, GREY, "%s Ai primit ^4%i^3 XP pentru ca l-ai omorat pe ^4%s^3 cu ^4HeadShot", szPrefix, get_pcvar_num (HsXp), vname )
		}
	}
	
	if( wpnindex == CSW_HEGRENADE && iKiller != iVictim )
	{
		eXP[iKiller] += get_pcvar_num(HeXp)
		
		if( get_cvar_num("XP_Reward_MSG") == 1 ) 
		{
			ColorChat( iKiller, GREEN, "%s^1 Ai primit^4 %i^3 XP pentru ca l-ai omorat pe^4 %s^3 cu o ^4Grenada", szPrefix, get_pcvar_num (HeXp), vname )
		}
	}
	CheckLevel(iKiller)
	SaveData(iKiller)
	
	return PLUGIN_CONTINUE
}

public CheckLevel(id)
{
	if(Level[id] < MaxLevels-1)
	{
		while(eXP[id] >= Levels[Level[id]])
		{
			Level[id] += 1 
			ColorChat(id, GREY, "%s Felicitari ai trecut levelul , acum esti levelul : ^4%i^3", szPrefix, Level[id])
		}
	} 
}

/*      HUD PERMANENT INFO      */
public ShowHud(task)
{
	new id = task - TASK_SHOW_HUD
	
	if(!is_user_alive(id))
		return;
	
	set_hudmessage(0, 255, 0, 0.02, 0.33, 0, 0.0, 0.3, 0.0, 0.0)
	ShowSyncHudMsg(id, g_msgHudSync,"[Status : %s]^n[XP : %i]", Prefix[Level[id]], eXP[id])
	
	set_task(0.1, "ShowHud", TASK_SHOW_HUD + id)	
}

/*      nVault Stuff      */
public SaveData(id) 
{ 
	new AuthID[35]
	get_user_authid(id,AuthID,34) 
	new vaultkey[64],vaultdata[256] 
	
	format(vaultkey,63,"%s-Mod",AuthID) 
	format(vaultdata,255,"%i#%i#",eXP[id],Level[id]) 
	
	nvault_set(gVault,vaultkey,vaultdata) 
	
	return PLUGIN_CONTINUE 
} 
public LoadData(id) 
{ 
	new AuthID[35]
	get_user_authid(id,AuthID,34) 
	new vaultkey[64],vaultdata[256] 
	
	format(vaultkey,63,"%s-Mod",AuthID) 
	format(vaultdata,255,"%i#%i#",eXP[id],Level[id]) 
	
	nvault_get(gVault,vaultkey,vaultdata,255) 
	
	replace_all(vaultdata, 255, "#", " ") 
	
	new playerxp[32], playerlevel[32] 
	
	parse(vaultdata, playerxp, 31, playerlevel, 31) 
	
	eXP[id] = str_to_num(playerxp) 
	
	Level[id] = str_to_num(playerlevel) 
	
	return PLUGIN_CONTINUE 
} 

/*      Remove And Add XP      */
public CmdAddXP ( iPlayer, level, cid )
{
	if( !cmd_access( iPlayer, level, cid, 3 ) ) return PLUGIN_HANDLED;
	   
	new arg [ 32 ]
	read_argv ( 1, arg, 31 ) 
 
	new AddXP [ 32 ]
	read_argv ( 2, AddXP, charsmax ( AddXP ) )
 
	new XPtoGive = str_to_num ( AddXP )
	   
	new AdminName [ 32 ]
	new TargetName [ 32 ]
	get_user_name ( iPlayer, AdminName, charsmax ( AdminName ) )
	   
	if( arg[0]=='@' )
	{ 
		if( equali(arg[1],"All") || equali(arg[1],"ALL") )
		{
			new players[32], totalplayers, All
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				All = players[ i ]
					   
				eXP[ All ] += XPtoGive
			}
			
			CheckLevel( All )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to all ^1 players^3!", szPrefix, AdminName, XPtoGive )
		}
		else if( equali(arg[1],"T") || equali(arg[1],"t") )
		{
			new players[32], totalplayers, T
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				if ( get_user_team(players[ i ]) == 1 )
				{
					T = players[ i ]
						   
					eXP[ T ] += XPtoGive
				}
			}
			
			CheckLevel( T )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to all ^1 Terrorists^3!", szPrefix, AdminName, XPtoGive )
		}
		else if( equali(arg[1],"CT") || equali(arg[1],"ct") )
		{
			new players[32], totalplayers, CT
			get_players( players, totalplayers )
		    
			for( new i = 0; i < totalplayers; i++ )
			{
				if( get_user_team(players[ i ] ) == 2 )
				{
					CT = players[ i ]
						   
					eXP[ CT ] += XPtoGive
				}
			}
			
			CheckLevel( CT )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to all ^1 Counter-Terrorists^3!", szPrefix, AdminName, XPtoGive )
		}
	}
	else
	{
		new iTarget = cmd_target( iPlayer, arg, 3 )
		get_user_name ( iTarget, TargetName, charsmax ( TargetName ) )
		
		if( iTarget )
		{
			eXP[ iTarget ] += XPtoGive
			
			CheckLevel( iTarget )
			ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to^1 %s^3", szPrefix, AdminName, XPtoGive, TargetName )
		}
	}
	return PLUGIN_HANDLED
}
 
public CmdRemoveXP ( iPlayer, level, cid )
{
	if( !cmd_access(iPlayer, level, cid, 3) ) return PLUGIN_HANDLED;
	   
	new arg [ 32 ]
	read_argv ( 1, arg, 31 ) 
 
	new RemoveXP [ 32 ]
	read_argv ( 2, RemoveXP, charsmax ( RemoveXP ) )
 
	new XPtoRemove = str_to_num ( RemoveXP )
	   
	new AdminName [ 32 ]
	new TargetName [ 32 ]
	get_user_name ( iPlayer, AdminName, charsmax ( AdminName ) )
	   
	if( arg[0]=='@' )
	{ 
		if( equali(arg[1],"All") || equali(arg[1],"ALL") )
		{
			new players[32], totalplayers, All
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				All = players[ i ]
					   
				eXP[ All ] -= XPtoRemove
			}
			
			CheckLevel( All )
			ColorChat ( 0, GREY, "%s ^1%s^3 toke^1 %i^3 XP of all ^1 players^3!", szPrefix, AdminName, XPtoRemove )
		}
		else if( equali(arg[1],"T") || equali(arg[1],"t") )
		{
			new players[32], totalplayers, T
			get_players( players, totalplayers )
		    
			for ( new i = 0; i < totalplayers; i++ )
			{
				if ( get_user_team(players[ i ]) == 1 )
				{
					T = players[ i ]
						   
					eXP[ T ] -= XPtoRemove
				}
			}
			
			CheckLevel( T )
			ColorChat ( 0, GREY, "%s ^1%s^3 toke^1 %i^3 XP of all ^1 Terrorists^3!", szPrefix, AdminName, XPtoRemove )
		}
		else if( equali(arg[1],"CT") || equali(arg[1],"ct") )
		{
			new players[32], totalplayers, CT
			get_players( players, totalplayers )
		    
			for( new i = 0; i < totalplayers; i++ )
			{
				if( get_user_team(players[ i ] ) == 2 )
				{
					CT = players[ i ]
						   
					eXP[ CT ] -= XPtoRemove
				}
			}
			
			CheckLevel( CT )
			ColorChat ( 0, GREY, "%s ^1%s^3 toke^1 %i^3 XP of all ^1 Counter-Terrorists^3!", szPrefix, AdminName, XPtoRemove )
		}
	}
	else
	{
		new iTarget = cmd_target( iPlayer, arg, 3 )
		get_user_name ( iTarget, TargetName, charsmax ( TargetName ) )
		
		if( !iTarget )
			return PLUGIN_HANDLED
			
		eXP[ iTarget ] -= XPtoRemove
			
		CheckLevel( iTarget )
		ColorChat ( 0, GREY, "%s ^1%s^3 give^1 %i^3 XP to^1 %s^3", szPrefix, AdminName, XPtoRemove, TargetName )
	}
	
	return PLUGIN_HANDLED
}
/*      Level Behind Nick & AdminChatColors
              CREDITS TO ConnorMcLeod            */
public Message_SayText(msgId,msgDest,msgEnt) 
{ 
	new id = get_msg_arg_int(1); 
	if( is_user_connected(id) ) 
	{ 
		if( get_cvar_num("AdminChatColors_On") == 1 ) 
		{
			new flags = get_user_flags(id)
			for(new i; i<sizeof(AdminsDatas); i++) 
			{ 
				if( flags & AdminsDatas[m_iFlag] ) 
				{ 
					new szChannel[64]
					get_msg_arg_string(2, szChannel, charsmax(szChannel))
		
					if( equal(szChannel, "#Cstrike_Chat_All") ) 
					{ 
					    formatex(szChannel, charsmax(szChannel), "^4[%s - %s] ^3%%s1 ^1:  %%s2", Prefix[Level[id]], AdminsDatas[m_szName])
					    set_msg_arg_string(2, szChannel)
					} 
					else if( !equal(szChannel, "#Cstrike_Name_Change") ) 
					{ 
					    format(szChannel, charsmax(szChannel), "^4[%s - %s] %s", Prefix[Level[id]], AdminsDatas[m_szName], szChannel)
					    set_msg_arg_string(2, szChannel)
					} 
					return
				} 
				else
				{
					new szChannel[64]
					get_msg_arg_string(2, szChannel, charsmax(szChannel))
		
					if( equal(szChannel, "#Cstrike_Chat_All") ) 
					{ 
					    formatex(szChannel, charsmax(szChannel), "^4[%s] ^3%%s1 ^1:  %%s2", Prefix[Level[id]])
					    set_msg_arg_string(2, szChannel)
					} 
					else if( !equal(szChannel, "#Cstrike_Name_Change") ) 
					{ 
					    format(szChannel, charsmax(szChannel), "^4[%s] %s", Prefix[Level[id]], szChannel)
					    set_msg_arg_string(2, szChannel)
					} 
					return 
				}
			} 
		}
		else
		{
			new szChannel[64]
			get_msg_arg_string(2, szChannel, charsmax(szChannel));
		
			if( equal(szChannel, "#Cstrike_Chat_All") ) 
			{ 
				formatex(szChannel, charsmax(szChannel), "^4[%s] ^3%%s1 ^1:  %%s2", Prefix[Level[id]])
				set_msg_arg_string(2, szChannel)
			} 
			else if( !equal(szChannel, "#Cstrike_Name_Change") ) 
			{ 
				format(szChannel, charsmax(szChannel), "^4[%s] %s", Prefix[Level[id]], szChannel) 
				set_msg_arg_string(2, szChannel)
			} 
			return 
		}
	} 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1033{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/
acum se compileaza + functioneaza.
ang
Membru, skill +1
Membru, skill +1
Posts: 169
Joined: 14 Jan 2012, 18:39
Detinator Steam: Da
Detinator server CS: Da
Location: Africa
Has thanked: 37 times

28 Feb 2014, 23:31

aveti multumesc ambii .
<a href="https://www.gametracker.com/server_info ... 3.4:27015/" target="_blank"><img src="http://cache.gametracker.com/server_inf ... 2E3226.png" border="0" width="350" height="20" alt=""/></a>
Post Reply

Return to “Modificari pluginuri”

  • Information