HNSXP not printing msg info

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
mharisrazaa
Извън линия
Потребител
Потребител
Мнения: 31
Регистриран на: 15 Дек 2021, 17:15
Местоположение: Pakistan
Се отблагодари: 2 пъти
Обратна връзка:

HNSXP not printing msg info

Мнение от mharisrazaa » 05 Яну 2022, 17:13

Hello everyone,

as lethality modified my HNSXP, it's not printing MSG INFO LIKE:

You gained 5 xp for killing Player.

and also Suicide is not working, means if player died, XP remains same.

HEre is the plugin:

Код за потвърждение: Избери целия код

// =================================================
// BEGIN EDITING HERE
// =================================================

// Should the plugin save player data in SQL database?
// To save player data in a vault, change "#define USING_SQL" to "//#define USING_SQL"
// To save player data in SQL, change "//#define USING_SQL" to "#define USING_SQL"

//#define USING_SQL

new const prefix[] = "sG-Blockmaker"
// The prefix in all of the plugin's messages

// If the player hasn't ever been to your server, they will get this much xp to start with

#define ENTRY_XP			250000

// These determine if these abilities should be enabled or disabled
// 1 = enabled
// 0 = disabled

#define ENABLE_GRENADE			1
#define ENABLE_FLASHBANG_1		1
#define ENABLE_FLASHBANG_2		1
#define ENABLE_SMOKEGRENADE		1
#define ENABLE_TERR_HEALTH		1
#define ENABLE_CT_HEALTH		1
#define ENABLE_TERR_ARMOR		1
#define ENABLE_CT_ARMOR			1
#define ENABLE_TERR_RESPAWN		1
#define ENABLE_CT_RESPAWN		1
#define ENABLE_TERR_NOFALL		1
#define ENABLE_CT_NOFALL		1

#define ENABLE_TERR_INCREASEDMG		0
#define ENABLE_CT_INCREASEDMG		0

// The maximum level for each ability

#define MAXLEVEL_GRENADE		8
#define MAXLEVEL_FLASHBANG_1		8
#define MAXLEVEL_FLASHBANG_2		8
#define MAXLEVEL_SMOKEGRENADE		8
#define MAXLEVEL_TERR_HEALTH		10
#define MAXLEVEL_CT_HEALTH		10
#define MAXLEVEL_TERR_ARMOR		6
#define MAXLEVEL_CT_ARMOR		6
#define MAXLEVEL_TERR_RESPAWN		4
#define MAXLEVEL_CT_RESPAWN		4
#define MAXLEVEL_TERR_NOFALL		8
#define MAXLEVEL_CT_NOFALL		8

#define MAXLEVEL_TERR_INCREASEDMG	5
#define MAXLEVEL_CT_INCREASEDMG		5

// The xp amount required to buy the first level

#define FIRST_XP_GRENADE		200
#define FIRST_XP_FLASHBANG_1		100
#define FIRST_XP_FLASHBANG_2		100
#define FIRST_XP_SMOKEGRENADE		200
#define FIRST_XP_TERR_HEALTH		200
#define FIRST_XP_CT_HEALTH		200
#define FIRST_XP_TERR_ARMOR		400
#define FIRST_XP_CT_ARMOR		400
#define FIRST_XP_TERR_RESPAWN		12800
#define FIRST_XP_CT_RESPAWN		12800
#define FIRST_XP_TERR_NOFALL		400
#define FIRST_XP_CT_NOFALL		400

#define FIRST_XP_TERR_INCREASEDMG	25600
#define FIRST_XP_CT_INCREASEDMG		25600

// The maximum chance possible for this ability (happens when player has maximum level)

#define CHANCE_MAX_GRENADE		100
#define CHANCE_MAX_FLASHBANG_1		100
#define CHANCE_MAX_FLASHBANG_2		100
#define CHANCE_MAX_SMOKEGRENADE		100
#define CHANCE_MAX_TERR_RESPAWN		60
#define CHANCE_MAX_CT_RESPAWN		60
#define CHANCE_MAX_TERR_NOFALL		80
#define CHANCE_MAX_CT_NOFALL		80

// =================================================
// STOP EDITING HERE
// =================================================


#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fun>
#include <regex>
#include <hlsdk_const>

#if defined USING_SQL
#include <sqlx>

new Handle:g_sql_tuple;
#else
#include <nvault>

new g_vault;
#endif


new const VERSION[] =	"0.0.1b";


#pragma semicolon 1

enum _: Grenades {
	NADE_HE,
	NADE_FL1,
	NADE_FL2,
	NADE_SM
};

new const g_nade_enabled[Grenades] = {
	ENABLE_GRENADE,
	ENABLE_FLASHBANG_1,
	ENABLE_FLASHBANG_2,
	ENABLE_SMOKEGRENADE
};

new const g_any_nade_enabled = ENABLE_GRENADE + ENABLE_FLASHBANG_1 + ENABLE_FLASHBANG_2 + ENABLE_SMOKEGRENADE;

new const g_nade_names[Grenades][] = {
	"HE Grenade",
	"Flashbang #1",
	"Flashbang #2",
	"Frost Nade"
};

new const g_nade_classnames[Grenades][] = {
	"weapon_hegrenade",
	"weapon_flashbang",
	"weapon_flashbang",
	"weapon_smokegrenade"
};

new const g_nade_maxlevels[Grenades] = {
	MAXLEVEL_GRENADE,
	MAXLEVEL_FLASHBANG_1,
	MAXLEVEL_FLASHBANG_2,
	MAXLEVEL_SMOKEGRENADE
};

new const g_nade_first_xp[Grenades] = {
	FIRST_XP_GRENADE,
	FIRST_XP_FLASHBANG_1,
	FIRST_XP_FLASHBANG_2,
	FIRST_XP_SMOKEGRENADE
};

new const g_nade_max_chance[Grenades] = {
	CHANCE_MAX_GRENADE,
	CHANCE_MAX_FLASHBANG_1,
	CHANCE_MAX_FLASHBANG_2,
	CHANCE_MAX_SMOKEGRENADE
};

new const g_team_names[CsTeams][] = {
	"Spectator",
	"Terrorist",
	"Counter-Terrorist",
	"Spectator"
};

new const g_health_enabled[CsTeams] = {
	0,
	ENABLE_TERR_HEALTH,
	ENABLE_CT_HEALTH,
	0
};

// Damage
new const g_damage_enabled[CsTeams] = {
	0,
	ENABLE_TERR_INCREASEDMG,
	ENABLE_CT_INCREASEDMG,
	0
};

new const g_damage_maxamount[CsTeams] = {
	0,
	75,
	75,
	0
};

new const g_damage_maxlevels[CsTeams] = {
	0,
	MAXLEVEL_TERR_INCREASEDMG,
	MAXLEVEL_CT_INCREASEDMG,
	0
};
new const g_damage_first_xp[CsTeams] = {
	0,
	FIRST_XP_TERR_INCREASEDMG,
	FIRST_XP_CT_INCREASEDMG,
	0
};
new const g_damage_names[CsTeams][] = {
	"",
	"T Increase Damage",
	"CT Increase Damage",
	""
};
new const g_any_damage_enabled = ENABLE_TERR_INCREASEDMG + ENABLE_CT_INCREASEDMG;
// Damage

new const g_any_health_enabled = ENABLE_TERR_HEALTH + ENABLE_CT_HEALTH;

new const g_health_names[CsTeams][] = {
	"",
	"T Extra Health",
	"CT Extra Health",
	""
};

new const g_health_maxamount[CsTeams] = {
	0,
	150,
	150,
	0
};

new const g_health_maxlevels[CsTeams] = {
	0,
	MAXLEVEL_TERR_HEALTH,
	MAXLEVEL_CT_HEALTH,
	0
};

new const g_health_first_xp[CsTeams] = {
	0,
	FIRST_XP_TERR_HEALTH,
	FIRST_XP_CT_HEALTH,
	0
};

new const g_armor_enabled[CsTeams] = {
	0,
	ENABLE_TERR_ARMOR,
	ENABLE_CT_ARMOR,
	0
};

new const g_any_armor_enabled = ENABLE_TERR_ARMOR + ENABLE_CT_ARMOR;

new const g_armor_names[CsTeams][] = {
	"",
	"T Armor",
	"CT Armor",
	""
};

new const g_armor_maxamount[CsTeams] = {
	0,
	150,
	150,
	0
};

new const g_armor_maxlevels[CsTeams] = {
	0,
	MAXLEVEL_TERR_ARMOR,
	MAXLEVEL_CT_ARMOR,
	0
};

new const g_armor_first_xp[CsTeams] = {
	0,
	FIRST_XP_TERR_ARMOR,
	FIRST_XP_CT_ARMOR,
	0
};

new const g_respawn_enabled[CsTeams] = {
	0,
	ENABLE_TERR_RESPAWN,
	ENABLE_CT_RESPAWN,
	0
};

new const g_any_respawn_enabled = ENABLE_TERR_RESPAWN + ENABLE_CT_RESPAWN;

new const g_respawn_names[CsTeams][] = {
	"",
	"T Respawn Chance",
	"CT Respawn Chance",
	""
};

new const g_respawn_maxlevels[CsTeams] = {
	0,
	MAXLEVEL_TERR_RESPAWN,
	MAXLEVEL_CT_RESPAWN,
	0
};

new const g_respawn_first_xp[CsTeams] = {
	0,
	FIRST_XP_TERR_RESPAWN,
	FIRST_XP_CT_RESPAWN,
	0
};

new const g_respawn_max_chance[CsTeams] = {
	0,
	CHANCE_MAX_TERR_RESPAWN,
	CHANCE_MAX_CT_RESPAWN,
	0
};

new const g_nofall_enabled[CsTeams] = {
	0,
	ENABLE_TERR_NOFALL,
	ENABLE_CT_NOFALL,
	0
};

new const g_any_nofall_enabled = ENABLE_TERR_NOFALL + ENABLE_CT_NOFALL;

new const g_nofall_names[CsTeams][] = {
	"",
	"T Fall Damage Reducer",
	"CT Fall Damage Reducer",
	""
};

new const g_nofall_maxlevels[CsTeams] = {
	0,
	MAXLEVEL_TERR_NOFALL,
	MAXLEVEL_CT_NOFALL,
	0
};

new const g_nofall_first_xp[CsTeams] = {
	0,
	FIRST_XP_TERR_NOFALL,
	FIRST_XP_CT_NOFALL,
	0
};

new const g_nofall_max_chance[CsTeams] = {
	0,
	CHANCE_MAX_TERR_NOFALL,
	CHANCE_MAX_CT_NOFALL,
	0
};

#define ANY_ABILITY_ENABLED (g_any_nade_enabled || g_any_health_enabled || g_any_armor_enabled || g_any_respawn_enabled || g_any_nofall_enabled || g_any_damage_enabled)

new g_authid[33][35];
new g_xp[33];

new g_first_time[33];
#if defined USING_SQL
new g_loaded_data[33];
#endif

new g_used_revive[33];

new g_nade_level[33][Grenades];
new g_armor_level[33][CsTeams];
new g_respawn_level[33][CsTeams];
new g_health_level[33][CsTeams];
new g_nofall_level[33][CsTeams];
new g_damage_level[33][CsTeams];

new cvar_xp_kill;
new cvar_xp_headshot;
new cvar_xp_headshot_vip;
new cvar_xp_kill_vip;
new cvar_xp_survive;
new cvar_xp_win;
new cvar_xp_suicide;
new GainXpInfo;

new g_first_client;
new g_max_clients;

#if defined USING_SQL
public plugin_precache() {
	g_sql_tuple = SQL_MakeStdTuple();
	
	SQL_ThreadQuery(g_sql_tuple, "QueryCreateTable", "CREATE TABLE IF NOT EXISTS `hns_xp` ( `name` VARCHAR(32) NOT NULL, `authid` VARCHAR(35) NOT NULL, `data` VARCHAR(256) NOT NULL );" );
}

public QueryCreateTable(failstate, Handle:query, error[], errnum, data[], size, Float:queuetime) {
	if( failstate == TQUERY_CONNECT_FAILED
	|| failstate == TQUERY_QUERY_FAILED ) {
		set_fail_state(error);
	}
}
#endif

public plugin_init() {
    register_plugin("HideNSeek XP Mod", VERSION, "Exolent");
    register_cvar("hnsxp_author", "Exolent", FCVAR_SPONLY);
    register_cvar("hnsxp_version", VERSION, FCVAR_SPONLY);

    register_clcmd("say /xp", "CmdMainMenu");
    register_clcmd("say /xp", "CmdMainMenu");
    register_clcmd("say_team /xp", "CmdMainMenu");
    register_clcmd("say_team /xp", "CmdMainMenu");

    register_concmd("hns_givexp", "CmdGiveXP", ADMIN_RCON, "<nick, #userid, authid> <xp>");
    register_concmd("hns_removexp", "CmdRemoveXP", ADMIN_RCON, "<nick, #userid, authid> <xp>");
    register_clcmd ("hns_givexpall", "give", ADMIN_RCON, "<xp>");

    register_event("DeathMsg", "EventDeathMsg", "a");
    register_logevent("EventRoundEnd", 2, "1=Round_End");

    RegisterHam(Ham_Spawn, "player", "FwdPlayerSpawn", 1);
    RegisterHam(Ham_Killed, "player", "FwdPlayerDeath", 1);
    RegisterHam(Ham_TakeDamage, "player", "FwdPlayerDamage");
    RegisterHam(Ham_TakeDamage, "player", "FwdTakeDamage2", 0);

    cvar_xp_kill = register_cvar("hnsxp_xp_kill", "50");
    cvar_xp_headshot = register_cvar("hnsxp_xp_headshot", "65");
    cvar_xp_kill_vip = register_cvar("hnsxp_xp_kill_vip", "65");
    cvar_xp_headshot_vip = register_cvar("hnsxp_xp_headshot_vip", "75");
    cvar_xp_survive = register_cvar("hnsxp_xp_survive", "30");
    cvar_xp_win = register_cvar("hnsxp_xp_win", "30");
    cvar_xp_suicide = register_cvar("hnsxp_xp_suicide", "15");
    GainXpInfo = register_cvar("hnsxp_xp_info_msg", "1");

    #if !defined USING_SQL
    g_vault = nvault_open("/// Блокиран текст/линк [НЕЖЕЛАН САЙТ] ///_hnsxp");
    #endif

    g_first_client = 1;
    g_max_clients = get_maxplayers();
	
}

#if !defined USING_SQL
public plugin_end() {
	nvault_close(g_vault);
}
#endif

public plugin_natives() {
	register_library("hns_xp");
	register_native("hnsxp_get_user_xp", "_get_xp");
	register_native("hnsxp_set_user_xp", "_set_xp");
}

public _get_xp(plugin, params) {
	return g_xp[get_param(1)];
}

public _set_xp(plugin, params) {
	new client = get_param(1);
	g_xp[client] = max(0, get_param(2));
	Save(client);
	return g_xp[client];
}

public client_authorized(client) {
	if( !is_user_bot(client) && !is_user_hltv(client) ) {
		get_user_name(client, g_authid[client], sizeof(g_authid[]) - 1);
		
		Load(client);
	}
}

public client_disconnected(client) {
	Save(client);
	
	g_authid[client][0] = 0;
	g_first_time[client] = 0;
	#if defined USING_SQL
	g_loaded_data[client] = 0;
	#endif
	g_used_revive[client] = 0;
}

public CmdMainMenu(client) {
	ShowMainMenu(client);
}
public give(id, level, cid) {
	if(!cmd_access(id, level, cid, 2))
		return PLUGIN_HANDLED;
		
	new amount[32];
		
	read_argv(1, amount, charsmax(amount));
		
	new admin_name[32];
	get_user_name(id, admin_name, charsmax(admin_name));
		
	new xp = str_to_num(amount);
		
	new players[32], num;
	get_players(players, num, "ch");
		
	for(new i; i < num; i++)
		g_xp[players[i]] += xp;
		
	ColorMessage(0, "^3[^4%s^3] ^3%s ^1gave^4 %d ^1XP to all players!",prefix, admin_name,xp);
	Save(id);
	return PLUGIN_HANDLED;
}

public CmdGiveXP(client, level, cid) {
	if( !cmd_access(client, level, cid, 3) ) return PLUGIN_HANDLED;
	
	static arg[35];
	read_argv(1, arg, sizeof(arg) - 1);
	
	new target = cmd_target(client, arg, CMDTARGET_NO_BOTS);
	if( !target ) return PLUGIN_HANDLED;
	
	if( !IsUserAuthorized(target) ) {
		console_print(client, "Target has not authorized with the server.");
		return PLUGIN_HANDLED;
	}
	
	read_argv(2, arg, sizeof(arg) - 1);
	new xp = str_to_num(arg);
	
	if( xp <= 0 ) {
		console_print(client, "XP must be a value greater than 0!");
		if( xp < 0 ) {
			console_print(client, "Use hns_removexp instead.");
		}
		return PLUGIN_HANDLED;
	}
	
	g_xp[target] += xp;
	
	Save(target);
	
	static name[2][32];
	get_user_name(client, name[0], sizeof(name[]) - 1);
	get_user_name(target, name[1], sizeof(name[]) - 1);
	
	ColorMessage(0, "^3[^4%s^3] ^4%s ^1gave^4 %i ^1XP to^3 %s^1.", prefix, name[0], xp, name[1]);
	
	static steamid[2][35];
	get_user_authid(client, steamid[0], sizeof(steamid[]) - 1);
	get_user_authid(target, steamid[1], sizeof(steamid[]) - 1);
	
	log_amx("%s (%s) gave %i XP to %s (%s)", name[0], steamid[0], xp, name[1], steamid[1]);
	
	return PLUGIN_HANDLED;
}

public CmdRemoveXP(client, level, cid) {
	if( !cmd_access(client, level, cid, 3) ) return PLUGIN_HANDLED;
	
	static arg[35];
	read_argv(1, arg, sizeof(arg) - 1);
	
	new target = cmd_target(client, arg, CMDTARGET_NO_BOTS);
	if( !target ) return PLUGIN_HANDLED;
	
	if( !IsUserAuthorized(target) ) {
		console_print(client, "Target has not authorized with the server.");
		return PLUGIN_HANDLED;
	}
	
	read_argv(2, arg, sizeof(arg) - 1);
	new xp = str_to_num(arg);
	
	if( xp <= 0 ) {
		console_print(client, "XP must be a value greater than 0!");
		if( xp < 0 ) {
			console_print(client, "Use hnsxp_give_xp instead.");
		}
		return PLUGIN_HANDLED;
	}
	
	g_xp[target] -= xp;
	
	Save(target);
	
	static name[2][32];
	get_user_name(client, name[0], sizeof(name[]) - 1);
	get_user_name(target, name[1], sizeof(name[]) - 1);
	
	ColorMessage(0, "^3[^4%s^3] ^4%s ^1removed^4 %i ^1XP from^3 %s^1.", prefix, name[0], xp, name[1]);
	
	static steamid[2][35];
	get_user_authid(client, steamid[0], sizeof(steamid[]) - 1);
	get_user_authid(target, steamid[1], sizeof(steamid[]) - 1);
	
	log_amx("%s (%s) removed %i XP from %s (%s)", name[0], steamid[0], xp, name[1], steamid[1]);
	
	return PLUGIN_HANDLED;
}

public EventDeathMsg() {
    new killer = read_data(1);
    new victim = read_data(2);
    new headshot = read_data(3);

    if( (g_first_client <= killer <= g_max_clients) && victim != killer ) {
        new xp, name[ 33 ];
        get_user_name( victim, name, charsmax( name ) );
                
        if(headshot) {
            // headshot kill
            if(get_user_flags(killer) & read_flags("r")) {
                xp = get_pcvar_num(cvar_xp_headshot_vip);
            }
            else {
                xp = get_pcvar_num(cvar_xp_headshot);
            }
        }
        else {
            // regular kill
            if(get_user_flags(killer) & read_flags("r")) {
                xp = get_pcvar_num(cvar_xp_kill_vip);
            }
            else {
                xp = get_pcvar_num(cvar_xp_kill);
            }
        }	
        g_xp[killer] += xp;
        if(get_pcvar_num(GainXpInfo) == 1)
            ColorMessage(killer, "^3[^4%s^3] ^1You gained^4 %i ^1XP for killing^3 %s^1!", prefix, xp, name);
    }
    else if( victim == killer ) {
        new xp = get_pcvar_num(cvar_xp_suicide);

        g_xp[victim] -= xp;

        ColorMessage(victim, "^3[^4%s^3] ^1You Lost^4 %iXP^1!", prefix, xp);

        Save(victim);
    }

    Save(killer);
}

public EventRoundEnd() {
	new hider, seeker, hider_alive;
	
	for( new i = g_first_client; i <= g_max_clients; i++ ) {
		if( is_user_connected(i) ) {
			switch( cs_get_user_team(i) ) {
				case CS_TEAM_CT: {
					if( !seeker ) {
						seeker = i;
					}
				}
				case CS_TEAM_T: {
					if( !hider ) {
						hider = i;
						
						if( !hider_alive && is_user_alive(i) ) {
							hider_alive = i;
						}
					}
				}
			}
			
			if( seeker && hider && hider_alive ) {
				break;
			}
		}
	}
	
	if( !hider || !seeker ) {
		return;
	}
	
	new CsTeams:winner = CS_TEAM_CT;
	
	if( hider_alive ) {
		winner = CS_TEAM_T;
		
		new survive = get_pcvar_num(cvar_xp_survive);
		for( new client = g_first_client; client <= g_max_clients; client++ ) {
			if( IsUserAuthorized(client) && is_user_alive(client) && cs_get_user_team(client) == CS_TEAM_T ) {
				g_xp[client] += survive;
				Save(client);
				if(get_pcvar_num(GainXpInfo) == 1)
					ColorMessage(client, "^3[^4%s^3] ^1You gained^4 %i ^1XP for surviving!", prefix, survive);
			}
		}
	}
	
	new win = get_pcvar_num(cvar_xp_win);
	for( new client = g_first_client; client <= g_max_clients; client++ ) {
		if( IsUserAuthorized(client) && is_user_alive(client) && cs_get_user_team(client) == winner ) {
			g_xp[client] += win;
			Save(client);
			if(get_pcvar_num(GainXpInfo) == 1)
				ColorMessage(client, "^3[^4%s^3] ^1You gained^4 %i ^1XP for winning the round!", prefix, win);
		}
	}
}

public FwdPlayerSpawn(client) {
	if( is_user_alive(client) ) {
		set_task( 2.0, "task_GiveNades", client );
		
		new CsTeams:team = cs_get_user_team(client);
		if( team == CS_TEAM_T || team == CS_TEAM_CT ) {
			if( g_first_time[client] ) {
				ColorMessage(client, "^3[^4%s^3] ^1It is your first time playing this ^3sG-Blockmaker Easyblocks, so you are rewarded with ^4%i ^1XP!", prefix, ENTRY_XP);
				ColorMessage(client, "^3[^4%s^3] ^1You earn^4 XP ^1based upon your gameplay, and you can buy more levels in the menu.", prefix);
				ColorMessage(client, "^3[^4%s^3] ^1Type ^4/xp ^1to view what you can get!", prefix);
				
				g_first_time[client] = 0;
			}
			else {
				if( g_health_enabled[team] ) {
					new health = g_health_maxamount[team] * g_health_level[client][team] / g_health_maxlevels[team];
					if( health > 0 ) {
						set_user_health(client, get_user_health(client) + health);
					}
				}
				
				if( g_armor_enabled[team] ) {
					new armorvalue = g_armor_maxamount[team] * g_armor_level[client][team] / g_armor_maxlevels[team];
					if( armorvalue == 0 ) {
						cs_set_user_armor(client, armorvalue, CS_ARMOR_NONE);
					}
					else if( armorvalue < 100 ) {
						cs_set_user_armor(client, armorvalue, CS_ARMOR_KEVLAR);
					}
					else {
						cs_set_user_armor(client, armorvalue, CS_ARMOR_VESTHELM);
					}
				}
			}
		}
	}
}

public FwdPlayerDeath(client, killer, shouldgib) {
	if( !g_used_revive[client] ) {
		new CsTeams:team = cs_get_user_team(client);
		if( team == CS_TEAM_T || team == CS_TEAM_CT ) {
			if( g_respawn_enabled[team] ) {
				new percent = g_respawn_max_chance[team] * g_respawn_level[client][team] / g_respawn_maxlevels[team];
				if( random_num(1, 100) <= percent ) {
					if( HasTeammateAlive(client, team) ) {
						set_task(0.5, "TaskRespawn", client);
						g_used_revive[client] = 1;
						
						ColorMessage(client, "^3[^4%s^3] ^1You have been respawned! ^1(^4 %i%% chance ^1)", prefix, percent);			
					}
				}
			}
		}
	}
}

public FwdPlayerDamage(client, inflictor, attacker, Float:damage, damagebits) {
	if( is_user_alive(client) && (damagebits & DMG_FALL) ) {
		new CsTeams:team = cs_get_user_team(client);
		if( team == CS_TEAM_T || team == CS_TEAM_CT ) {
			if( g_nofall_enabled[team] ) {
				new percent = g_nofall_max_chance[team] * g_nofall_level[client][team] / g_nofall_maxlevels[team];
				new Float:reduction = float(floatround((damage * float(percent) / 100.0), floatround_floor));
				
				if(percent > 0) SetHamParamFloat(4, damage - reduction);
				
				/*if( percent > 0 ) {
					set_hudmessage(.red = 0, .green = 127, .blue = 255, .x = -1.0, .y = 0.35, .holdtime = 3.0, .channel = -1);
					show_hudmessage(client, "[%s]^nFall Damage Reducer^nLevel %i^n^nInitial Damage: %.1f^nDamage Taken: %.1f", prefix, g_nofall_level[client][team], damage, (damage - reduction));
				}*/
			}
		}
	}
}

public FwdTakeDamage2(client, inflictor, attacker, Float:damage, damagebits) {
	if(is_user_alive(attacker)) {
		new CsTeams:team = cs_get_user_team(attacker);
		if(team == CS_TEAM_T || team == CS_TEAM_CT) {
			if(g_damage_enabled[team]) {
				new GetDamage = g_damage_maxamount[team] * g_damage_level[attacker][team] / g_damage_maxlevels[team];
				
				SetHamParamFloat(4, damage + GetDamage);
			}
		}
	}
}
public TaskRespawn(client) ExecuteHamB(Ham_CS_RoundRespawn, client);

HasTeammateAlive(client, CsTeams:team) {
	for( new i = g_first_client; i <= g_max_clients; i++ ) {
		if( i == client ) continue;
		
		if( is_user_alive(i) && cs_get_user_team(i) == team ) {
			return 1;
		}
	}
	return 0;
}

public task_GiveNades( client ) {
	new CsTeams:team = cs_get_user_team(client);
	if( team == CS_TEAM_T ) {
		static percent;
		for( new i = 0; i < Grenades; i++ ) {
			if( g_nade_enabled[i] ) {
				percent = g_nade_max_chance[ i ] * g_nade_level[ client ][ i ] / g_nade_maxlevels[ i ];
				
				if( percent > 0 && ( percent == 100 || random_num( 1, 100 ) <= percent ) && is_user_alive( client ) ) {
					give_item( client, g_nade_classnames[ i ] );
					
					if( percent < 100 ) ColorMessage( client, "^4[%s] ^1You received your^3 %s^1 (^4 %i%% chance ^1)", prefix, g_nade_names[ i ], percent );
				}
			}
		}
	}
}

ShowMainMenu(client) {
	static title[128];
	formatex(title, sizeof(title) - 1, "\y[\rsG-Blockmaker\y]^n\wMain Menu^n^n\rYour XP: \w%i", g_xp[client]);
	new menu = menu_create(title, "MenuMain");
	
	menu_additem(menu, "\yHelp^n", "*");
	if( g_any_nade_enabled ) {
		menu_additem(menu, "Grenades Menu", "1");
	}
	if( g_any_health_enabled ) {
		menu_additem(menu, "Health Menu", "2");
	}
	if( g_any_armor_enabled ) {
		menu_additem(menu, "Armor Menu", "3");
	}
	if( g_any_respawn_enabled ) {
		menu_additem(menu, "Respawn Menu", "4");
	}
	if( g_any_nofall_enabled ) {
		menu_additem(menu, "Fall Damage Menu", "5");
	}
	if( g_any_damage_enabled ) {
		menu_additem(menu, "Increase Damage Menu", "6");
	}
	
	menu_display(client, menu);
}

public MenuMain(client, menu, item) {
	if( item == MENU_EXIT ) {
		menu_destroy(menu);
		return;
	}
	
	static _access, info[4], callback;
	menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
	menu_destroy(menu);
	
	switch( info[0] ) {
		case '*': {
			static motd[2500];
			new len = formatex(motd, sizeof(motd) - 1,	"<body style=^"background-color:#030303; color:#FF8F00^">");
			len += format(motd[len], sizeof(motd) - len - 1,	"<p align=^"center^">");
			len += format(motd[len], sizeof(motd) - len - 1,	"HideNSeek XP Mod is an experienced based addon for HideNSeek.<br>");
			len += format(motd[len], sizeof(motd) - len - 1,	"Players earn experience points by how well they play the game.<br>");
			len += format(motd[len], sizeof(motd) - len - 1,	"<br>");
			len += format(motd[len], sizeof(motd) - len - 1,	"<table border=0>");
			len += format(motd[len], sizeof(motd) - len - 1,	"<tr><th>Action</th><th>XP</th></tr>");
			len += format(motd[len], sizeof(motd) - len - 1,	"<tr><td>Kill</td><td>+%i</td></tr>", get_pcvar_num(cvar_xp_kill));
			len += format(motd[len], sizeof(motd) - len - 1,	"<tr><td>Headshot</td><td>+%i</td></tr>", get_pcvar_num(cvar_xp_headshot));
			len += format(motd[len], sizeof(motd) - len - 1,	"</table>");
			len += format(motd[len], sizeof(motd) - len - 1,	"With these XP points, you can buy upgrades.<br>");
			len += format(motd[len], sizeof(motd) - len - 1,	"For a list of these upgrades, type /upgrade again and view the other menus inside.");
			len += format(motd[len], sizeof(motd) - len - 1,	"</p>");
			len += format(motd[len], sizeof(motd) - len - 1,	"</body>");
			
			show_motd(client, motd, "HideNSeek XP Mod Info");
		}
		case '1': {
			ShowGrenadesMenu(client);
		}
		case '2': {
			ShowHealthMenu(client);
		}
		case '3': {
			ShowArmorMenu(client);
		}
		case '4': {
			ShowRespawnMenu(client);
		}
		case '5': {
			ShowNoFallMenu(client);
		}
		case '6': {
			ShowIncreaseDmgMenu(client);
		}
	}
}

ShowGrenadesMenu(client) {
	static title[128];
	formatex(title, sizeof(title) - 1, "\wGrenades Menu^n^nNote: \yGrenade abilities are for \rT's\y Only!");
	new menu = menu_create(title, "MenuGrenades");
	new callback = menu_makecallback("CallbackGrenades");
	
	menu_additem(menu, "\yHelp^n", "*", _, callback);
	
	static level, xp, percent, item[128], info[4];
	for( new i = 0; i < Grenades; i++ ) {
		if( g_nade_enabled[i] ) {
			level = g_nade_level[client][i] + 1;
			percent = g_nade_max_chance[i] * level / g_nade_maxlevels[i];
			
			if( g_nade_level[client][i] < g_nade_maxlevels[i] ) {
				xp = g_nade_first_xp[i] * (1 << (level - 1));
				formatex(item, sizeof(item) - 1, "%s: \yLevel %i (%i%%) \r[\w%i XP\r]", g_nade_names[i], level, percent, xp);
			}
			else {
				formatex(item, sizeof(item) - 1, "\w%s: \yMax Level (%i%%)", g_nade_names[i], g_nade_max_chance[i]);
			}
			
			num_to_str(i, info, sizeof(info) - 1);
			
			menu_additem(menu, item, info, _, callback);
		}
	}
	menu_display(client, menu);
}

public MenuGrenades(client, menu, item) {
	if( item == MENU_EXIT ) {
		menu_destroy(menu);
		ShowMainMenu(client);
		return;
	}
	
	static _access, info[4], callback;
	menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
	menu_destroy(menu);
	
	if( info[0] == '*' ) {
		static motd[2500];
		new len = formatex(motd, sizeof(motd) - 1,	"<body style=^"background-color:#030303; color:#FF8F00^">");
		len += format(motd[len], sizeof(motd) - len - 1,	"<p align=^"center^">");
		len += format(motd[len], sizeof(motd) - len - 1,	"The Grenades ability for the XP Mod is for Terrorists only.<br>");
		len += format(motd[len], sizeof(motd) - len - 1,	"The Grenades ability contains the HE Grenade, 2 Flashbangs, and Frost Nade.<br>");
		len += format(motd[len], sizeof(motd) - len - 1,	"These are the grenades you are given when you receive the your items after the hide timer ends.<br>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<br>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<table>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th></th>");
		for( new i = 0; i < Grenades; i++ ) {
			if( g_nade_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<th>%s</th>", g_nade_names[i]);
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th>Chance Intervals</th>");
		for( new i = 0; i < Grenades; i++ ) {
			if( g_nade_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<td>%i%%</td>", (g_nade_max_chance[i] / g_nade_maxlevels[i]));
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th>Max Level</th>");
		for( new i = 0; i < Grenades; i++ ) {
			if( g_nade_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<td>%i</td>", g_nade_maxlevels[i]);
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th>Max Chance</th>");
		for( new i = 0; i < Grenades; i++ ) {
			if( g_nade_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<td>%i%%</td>", g_nade_max_chance[i]);
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"</table>");
		len += format(motd[len], sizeof(motd) - len - 1,	"</p>");
		len += format(motd[len], sizeof(motd) - len - 1,	"</body>");
		
		show_motd(client, motd, "XP Grenades Info");
	}
	else {
		new upgrade = str_to_num(info);
		
		new level = g_nade_level[client][upgrade] + 1;
		new xp = g_nade_first_xp[upgrade] * (1 << (level - 1));
		new percent = g_nade_max_chance[upgrade] * level / g_nade_maxlevels[upgrade];
		
		g_xp[client] -= xp;
		g_nade_level[client][upgrade] = level;
		
		Save(client);
		ColorMessage(client, "^3[^4%s^3] ^1You bought ^3%s ^1Level ^4%i ^4(%i%%) ^1for ^3%i ^1XP!", prefix, level, percent, g_nade_names[upgrade], xp);
	}
	
	ShowGrenadesMenu(client);
}

public CallbackGrenades(client, menu, item) {
	static _access, info[4], callback;
	menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
	
	if( info[0] == '*' ) return ITEM_ENABLED;
	
	new upgrade = str_to_num(info);
	if( g_nade_level[client][upgrade] == g_nade_maxlevels[upgrade] ) {
		return ITEM_DISABLED;
	}
	
	new xp = g_nade_first_xp[upgrade] * (1 << g_nade_level[client][upgrade]);
	if( g_xp[client] < xp ) {
		return ITEM_DISABLED;
	}
	
	return ITEM_ENABLED;
}

ShowHealthMenu(client) {
	static title[128];
	formatex(title, sizeof(title) - 1, "\wHealth Menu");
	new menu = menu_create(title, "MenuHealth");
	new callback = menu_makecallback("CallbackHealth");
	
	menu_additem(menu, "\yHelp^n", "*", _, callback);
	
	static level, xp, amount, item[128], info[4];
	for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
		if( g_health_enabled[i] ) {
			level = g_health_level[client][i] + 1;
			amount = g_health_maxamount[i] * level / g_health_maxlevels[i];
			
			if( g_health_level[client][i] < g_health_maxlevels[i] ) {
				xp = g_health_first_xp[i] * (1 << (level - 1));
				formatex(item, sizeof(item) - 1, "%s: \yLevel %i (%i HP) \r[\w%i XP\r]", g_health_names[i], level, amount, xp);
			}
			else {
				formatex(item, sizeof(item) - 1, "\w%s: \yMax Level (%i HP)", g_health_names[i], g_health_maxamount[i]);
			}
			
			num_to_str(_:i, info, sizeof(info) - 1);
			
			menu_additem(menu, item, info, _, callback);
		}
	}
	
	menu_display(client, menu);
}

public MenuHealth(client, menu, item) {
	if( item == MENU_EXIT ) {
		menu_destroy(menu);
		ShowMainMenu(client);
		return;
	}
	
	static _access, info[4], callback;
	menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
	menu_destroy(menu);
	
	if( info[0] == '*' ) {
		static motd[2500];
		new len = formatex(motd, sizeof(motd) - 1,	"<body style=^"background-color:#030303; color:#FF8F00^">");
		len += format(motd[len], sizeof(motd) - len - 1,	"<p align=^"center^">");
		len += format(motd[len], sizeof(motd) - len - 1,	"The Health ability is the amount of HP that is added to your spawn health.<br>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<br>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<table>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th></th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_health_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<th>%s</th>",g_team_names[i]);
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th>Health Intervals</th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_health_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<td>%i</td>", (g_health_maxamount[i] / g_health_maxlevels[i]));
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th>Max Level</th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_health_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<td>%i</td>", g_health_maxlevels[i]);
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th>Max Health</th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_health_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<td>%i</td>", g_health_maxamount[i]);
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"</table>");
		len += format(motd[len], sizeof(motd) - len - 1,	"</p>");
		len += format(motd[len], sizeof(motd) - len - 1,	"</body>");
		
		show_motd(client, motd, "XP Health Info");
	}
	else {
		new CsTeams:upgrade = CsTeams:str_to_num(info);
		
		new level = g_health_level[client][upgrade] + 1;
		new xp = g_health_first_xp[upgrade] * (1 << (level - 1));
		new amount = g_health_maxamount[upgrade] * level / g_health_maxlevels[upgrade];
		
		g_xp[client] -= xp;
		g_health_level[client][upgrade] = level;
		
		Save(client);
		
		ColorMessage(client, "^3[^4%s^3]^1 You Bought^4 %i^1 level (^4 +%i HP ^1) ^4 %s^1 for^4 %i^1 XP!", prefix, level, amount, g_health_names[upgrade], xp);
	}
	
	ShowHealthMenu(client);
}

public CallbackHealth(client, menu, item) {
	static _access, info[4], callback;
	menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
	
	if( info[0] == '*' ) return ITEM_ENABLED;
	
	new CsTeams:upgrade = CsTeams:str_to_num(info);
	if( g_health_level[client][upgrade] == g_health_maxlevels[upgrade] ) {
		return ITEM_DISABLED;
	}
	
	new xp = g_health_first_xp[upgrade] * (1 << g_health_level[client][upgrade]);
	if( g_xp[client] < xp ) {
		return ITEM_DISABLED;
	}
	
	return ITEM_ENABLED;
}

ShowArmorMenu(client) {
	static title[128];
	formatex(title, sizeof(title) - 1, "\wArmor Menu");
	new menu = menu_create(title, "MenuArmor");
	new callback = menu_makecallback("CallbackArmor");
	
	menu_additem(menu, "\yHelp^n", "*", _, callback);
	
	static level, xp, amount, item[128], info[4];
	for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
		if( g_armor_enabled[i] ) {
			level = g_armor_level[client][i] + 1;
			amount = g_armor_maxamount[i] * level / g_armor_maxlevels[i];
			
			if( g_armor_level[client][i] < g_armor_maxlevels[i] ) {
				xp = g_armor_first_xp[i] * (1 << (level - 1));
				formatex(item, sizeof(item) - 1, "%s: \yLevel %i (%i AP) \r[\w%i XP\r]", g_armor_names[i], level, amount, xp);
			}
			else {
				formatex(item, sizeof(item) - 1, "\w%s: \yMax Level (%i AP)", g_armor_names[i], g_armor_maxamount[i]);
			}
			
			num_to_str(_:i, info, sizeof(info) - 1);
			
			menu_additem(menu, item, info, _, callback);
		}
	}
	
	menu_display(client, menu);
}

public MenuArmor(client, menu, item) {
	if( item == MENU_EXIT ) {
		menu_destroy(menu);
		ShowMainMenu(client);
		return;
	}
	
	static _access, info[4], callback;
	menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
	menu_destroy(menu);
	
	if( info[0] == '*' ) {
		static motd[2500];
		new len = formatex(motd, sizeof(motd) - 1,	"<body style=^"background-color:#030303; color:#FF8F00^">");
		len += format(motd[len], sizeof(motd) - len - 1,	"<p align=^"center^">");
		len += format(motd[len], sizeof(motd) - len - 1,	"The Armor ability is the amount of AP that given to you at spawn.<br>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<br>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<table>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th></th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_armor_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<th>%s</th>",g_team_names[i]);
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th>Armor Intervals</th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_armor_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<td>%i</td>", (g_armor_maxamount[i] / g_armor_maxlevels[i]));
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th>Max Level</th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_armor_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<td>%i</td>", g_armor_maxlevels[i]);
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th>Max Armor</th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_armor_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<td>%i</td>", g_armor_maxamount[i]);
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"</table>");
		len += format(motd[len], sizeof(motd) - len - 1,	"</p>");
		len += format(motd[len], sizeof(motd) - len - 1,	"</body>");
		
		show_motd(client, motd, "XP Armor Info");
	}
	else {
		new CsTeams:upgrade = CsTeams:str_to_num(info);
		
		new level = g_armor_level[client][upgrade] + 1;
		new xp = g_armor_first_xp[upgrade] * (1 << (level - 1));
		new amount = g_armor_maxamount[upgrade] * level / g_armor_maxlevels[upgrade];
		
		g_xp[client] -= xp;
		g_armor_level[client][upgrade] = level;
		
		Save(client);
		
		ColorMessage(client, "^3[^4%s^3]^1 You bought^4 %i^1 level (^4 +%i AP ^1) ^4 %s^1 for^4 %i^1 XP!", prefix, level, amount, g_armor_names[upgrade], xp);
	}
	
	ShowArmorMenu(client);
}

public CallbackArmor(client, menu, item) {
	static _access, info[4], callback;
	menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
	
	if( info[0] == '*' ) return ITEM_ENABLED;
	
	new CsTeams:upgrade = CsTeams:str_to_num(info);
	if( g_armor_level[client][upgrade] == g_armor_maxlevels[upgrade] ) {
		return ITEM_DISABLED;
	}
	
	new xp = g_armor_first_xp[upgrade] * (1 << g_armor_level[client][upgrade]);
	if( g_xp[client] < xp ) {
		return ITEM_DISABLED;
	}
	
	return ITEM_ENABLED;
}

ShowRespawnMenu(client) {
	static title[128];
	formatex(title, sizeof(title) - 1, "\wRespawn Menu");
	new menu = menu_create(title, "MenuRespawn");
	new callback = menu_makecallback("CallbackRespawn");
	
	menu_additem(menu, "\yHelp^n", "*", _, callback);
	
	static level, xp, percent, item[128], info[4];
	for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
		if( g_respawn_enabled[i] ) {
			level = g_respawn_level[client][i] + 1;
			percent = g_respawn_max_chance[i] * level / g_respawn_maxlevels[i];
			
			if( g_respawn_level[client][i] < g_respawn_maxlevels[i] ) {
				xp = g_respawn_first_xp[i] * (1 << (level - 1));
				formatex(item, sizeof(item) - 1, "%s: \yLevel %i (%i%%) \r[\w%i XP\r]", g_respawn_names[i], level, percent, xp);
			}
			else {
				formatex(item, sizeof(item) - 1, "%s: \yMax Level (%i%%)", g_respawn_names[i], g_respawn_max_chance[i]);
			}
			
			num_to_str(_:i, info, sizeof(info) - 1);
			
			menu_additem(menu, item, info, _, callback);
		}
	}
	
	menu_display(client, menu);
}

public MenuRespawn(client, menu, item) {
	if( item == MENU_EXIT ) {
		menu_destroy(menu);
		ShowMainMenu(client);
		return;
	}
	
	static _access, info[4], callback;
	menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
	menu_destroy(menu);
	
	if( info[0] == '*' ) {
		static motd[2500];
		new len = formatex(motd, sizeof(motd) - 1,	"<body style=^"background-color:#030303; color:#FF8F00^">");
		len += format(motd[len], sizeof(motd) - len - 1,	"<p align=^"center^">");
		len += format(motd[len], sizeof(motd) - len - 1,	"The Respawn ability is chance to be respawned when you die.<br>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<br>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<table>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th></th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_respawn_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<th>%s</th>",g_team_names[i]);
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th>Chance Intervals</th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_respawn_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<td>%i%%</td>", (g_respawn_max_chance[i] / g_respawn_maxlevels[i]));
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th>Max Level</th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_respawn_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<td>%i</td>", g_respawn_maxlevels[i]);
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th>Max Chance</th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_respawn_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<td>%i%%</td>", g_respawn_max_chance[i]);
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"</table>");
		len += format(motd[len], sizeof(motd) - len - 1,	"</p>");
		len += format(motd[len], sizeof(motd) - len - 1,	"</body>");
		
		show_motd(client, motd, "XP Respawn Info");
	}
	else {
		new CsTeams:upgrade = CsTeams:str_to_num(info);
		
		new level = g_respawn_level[client][upgrade] + 1;
		new xp = g_respawn_first_xp[upgrade] * (1 << (level - 1));
		new percent = g_respawn_max_chance[upgrade] * level / g_respawn_maxlevels[upgrade];
		
		g_xp[client] -= xp;
		g_respawn_level[client][upgrade] = level;
		
		Save(client);
		
		ColorMessage(client, "^3[^4%s^3]^1 You bought^4 %i^1 level (^4 %i%% ^1) ^4 %s^1 for^4 %i^1 XP!", prefix, level, percent, g_respawn_names[upgrade], xp);
	}
	
	ShowRespawnMenu(client);
}

public CallbackRespawn(client, menu, item) {
	static _access, info[4], callback;
	menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
	
	if( info[0] == '*' ) return ITEM_ENABLED;
	
	new CsTeams:upgrade = CsTeams:str_to_num(info);
	if( g_respawn_level[client][upgrade] == g_respawn_maxlevels[upgrade] ) {
		return ITEM_DISABLED;
	}
	
	new xp = g_respawn_first_xp[upgrade] * (1 << g_respawn_level[client][upgrade]);
	if( g_xp[client] < xp || g_respawn_level[client][upgrade] == g_respawn_maxlevels[upgrade] ) {
		return ITEM_DISABLED;
	}
	
	return ITEM_ENABLED;
}

ShowNoFallMenu(client) {
	static title[128];
	formatex(title, sizeof(title) - 1, "\wFall Damage Menu");
	new menu = menu_create(title, "MenuNoFall");
	new callback = menu_makecallback("CallbackNoFall");
	
	menu_additem(menu, "\yHelp^n", "*", _, callback);
	
	static level, xp, percent, item[128], info[4];
	for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
		if( g_nofall_enabled[i] ) {
			level = g_nofall_level[client][i] + 1;
			percent = g_nofall_max_chance[i] * level / g_nofall_maxlevels[i];
			
			if( g_nofall_level[client][i] < g_nofall_maxlevels[i] ) {
				xp = g_nofall_first_xp[i] * (1 << (level - 1));
				formatex(item, sizeof(item) - 1, "%s: \yLevel %i (%i%%) \r[\w%i XP\r]", g_nofall_names[i], level, percent, xp);
			}
			else {
				formatex(item, sizeof(item) - 1, "%s: \yMax Level (%i%%)", g_nofall_names[i], g_nofall_max_chance[i]);
			}
			
			num_to_str(_:i, info, sizeof(info) - 1);
			
			menu_additem(menu, item, info, _, callback);
		}
	}
	
	menu_display(client, menu);
}

public MenuNoFall(client, menu, item) {
	if( item == MENU_EXIT ) {
		menu_destroy(menu);
		ShowMainMenu(client);
		return;
	}
	
	static _access, info[4], callback;
	menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
	menu_destroy(menu);
	
	if( info[0] == '*' ) {
		static motd[2500];
		new len = formatex(motd, sizeof(motd) - 1,	"<body style=^"background-color:#030303; color:#FF8F00^">");
		len += format(motd[len], sizeof(motd) - len - 1,	"<p align=^"center^">");
		len += format(motd[len], sizeof(motd) - len - 1,	"The Fall Damage ability reduces the amount of damage inflicted from falling.<br>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<br>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<table>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th></th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_nofall_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<th>%s</th>",g_team_names[i]);
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th>Reduction Intervals</th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_nofall_enabled[i] )
			{
				len += format(motd[len], sizeof(motd) - len - 1,	"<td>%i%%</td>", (g_nofall_max_chance[i] / g_nofall_maxlevels[i]));
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th>Max Level</th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_nofall_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<td>%i</td>", g_nofall_maxlevels[i]);
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th>Max Chance</th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_nofall_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<td>%i%%</td>", g_nofall_max_chance[i]);
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"</table>");
		len += format(motd[len], sizeof(motd) - len - 1,	"</p>");
		len += format(motd[len], sizeof(motd) - len - 1,	"</body>");
		
		show_motd(client, motd, "XP Fall Damage Info");
	}
	else {
		new CsTeams:upgrade = CsTeams:str_to_num(info);
		
		new level = g_nofall_level[client][upgrade] + 1;
		new xp = g_nofall_first_xp[upgrade] * (1 << (level - 1));
		new percent = g_nofall_max_chance[upgrade] * level / g_nofall_maxlevels[upgrade];
		
		g_xp[client] -= xp;
		g_nofall_level[client][upgrade] = level;
		
		Save(client);
		
		ColorMessage(client, "^3[^4%s^3]^1 You bought^4 %i^1 level (^4 %i%% ^1) ^4 %s^1 For^4 %i^1 XP!", prefix, level, percent, g_nofall_names[upgrade], xp);
	}
	
	ShowNoFallMenu(client);
}

public CallbackNoFall(client, menu, item) {
	static _access, info[4], callback;
	menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
	
	if( info[0] == '*' ) return ITEM_ENABLED;
	
	new CsTeams:upgrade = CsTeams:str_to_num(info);
	if( g_nofall_level[client][upgrade] == g_nofall_maxlevels[upgrade] ) {
		return ITEM_DISABLED;
	}
	
	new xp = g_nofall_first_xp[upgrade] * (1 << g_nofall_level[client][upgrade]);
	if( g_xp[client] < xp || g_nofall_level[client][upgrade] == g_nofall_maxlevels[upgrade] ) {
		return ITEM_DISABLED;
	}
	
	return ITEM_ENABLED;
}

ShowIncreaseDmgMenu(client) {
	static title[128];
	formatex(title, sizeof(title) - 1, "\wIncrease Damage Menu");
	new menu = menu_create(title, "MenuDamage");
	new callback = menu_makecallback("CallbackDamage");
	
	menu_additem(menu, "\yHelp^n", "*", _, callback);
	
	static level, xp, amount, item[128], info[4];
	for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
		if( g_damage_enabled[i] ) {
			level = g_damage_level[client][i] + 1;
			amount = g_damage_maxamount[i] * level / g_damage_maxlevels[i];
			
			if( g_damage_level[client][i] < g_damage_maxlevels[i] ) {
				xp = g_damage_first_xp[i] * (1 << (level - 1));
				formatex(item, sizeof(item) - 1, "%s: \yLevel %i (+%i DMG) \r[\w%i XP\r]", g_damage_names[i], level, amount, xp);
			}
			else {
				formatex(item, sizeof(item) - 1, "\w%s: \yMax Level (+%i DMG)", g_damage_names[i], g_damage_maxamount[i]);
			}
			
			num_to_str(_:i, info, sizeof(info) - 1);
			
			menu_additem(menu, item, info, _, callback);
		}
	}
	
	menu_display(client, menu);
}

public MenuDamage(client, menu, item) {
	if( item == MENU_EXIT ) {
		menu_destroy(menu);
		ShowMainMenu(client);
		return;
	}
	
	static _access, info[4], callback;
	menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
	menu_destroy(menu);
	
	if( info[0] == '*' ) {
		static motd[2500];
		new len = formatex(motd, sizeof(motd) - 1,	"<body style=^"background-color:#030303; color:#FF8F00^">");
		len += format(motd[len], sizeof(motd) - len - 1,	"<p align=^"center^">");
		len += format(motd[len], sizeof(motd) - len - 1,	"The Increase Damage ability is the amount of damage that is added to your attack.<br>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<br>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<table>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th></th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_damage_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<th>%s</th>",g_team_names[i]);
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th>Increase Intervals</th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_damage_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<td>%i</td>", (g_damage_maxamount[i] / g_damage_maxlevels[i]));
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th>Max Level</th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_damage_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<td>%i</td>", g_damage_maxlevels[i]);
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"<th>Max Increase Damage</th>");
		for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
			if( g_damage_enabled[i] ) {
				len += format(motd[len], sizeof(motd) - len - 1,	"<td>%i</td>", g_damage_maxamount[i]);
			}
		}
		len += format(motd[len], sizeof(motd) - len - 1,	"</tr>");
		len += format(motd[len], sizeof(motd) - len - 1,	"</table>");
		len += format(motd[len], sizeof(motd) - len - 1,	"</p>");
		len += format(motd[len], sizeof(motd) - len - 1,	"</body>");
		
		show_motd(client, motd, "Increase Damage Info");
	}
	else {
		new CsTeams:upgrade = CsTeams:str_to_num(info);
		
		new level = g_damage_level[client][upgrade] + 1;
		new xp = g_damage_first_xp[upgrade] * (1 << (level - 1));
		new amount = g_damage_maxamount[upgrade] * level / g_damage_maxlevels[upgrade];
		
		g_xp[client] -= xp;
		g_damage_level[client][upgrade] = level;
		
		Save(client);
		
		ColorMessage(client, "^3[^4%s^3]^1 You bought^4 %i^1 level (^4 +%i DMG ^1) ^4 %s^1 For^4 %i^1 XP!", prefix, level, amount, g_damage_names[upgrade], xp);
	}
	
	ShowIncreaseDmgMenu(client);
}
public CallbackDamage(client, menu, item) {
	static _access, info[4], callback;
	menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
	
	if( info[0] == '*' ) return ITEM_ENABLED;
	
	new CsTeams:upgrade = CsTeams:str_to_num(info);
	if( g_damage_level[client][upgrade] == g_damage_maxlevels[upgrade] ) {
		return ITEM_DISABLED;
	}
	
	new xp = g_damage_first_xp[upgrade] * (1 << g_damage_level[client][upgrade]);
	if( g_xp[client] < xp ) {
		return ITEM_DISABLED;
	}
	
	return ITEM_ENABLED;
}

IsUserAuthorized(client) {
	return g_authid[client][0] != 0;
}

Load(client) {
	#if defined USING_SQL
	static query[512];
	formatex(query, sizeof(query) - 1, "SELECT `data` FROM `hns_xp` WHERE `authid` = '%s';", g_authid[client]);
	
	static data[2];
	data[0] = client;
	
	SQL_ThreadQuery(g_sql_tuple, "QueryLoadData", query, data, sizeof(data));
	#else
	static data[256], timestamp;
	if( nvault_lookup(g_vault, g_authid[client], data, sizeof(data) - 1, timestamp) ) {
		ParseLoadData(client, data);
		return;
	}
	else {
		NewUser(client);
	}
	#endif
}

#if defined USING_SQL
public QueryLoadData(failstate, Handle:query, error[], errnum, data[], size, Float:queuetime) {
	if( failstate == TQUERY_CONNECT_FAILED
	|| failstate == TQUERY_QUERY_FAILED ) {
		set_fail_state(error);
	}
	else {
		if( SQL_NumResults(query) ) {
			static sqldata[512];
			SQL_ReadResult(query, 0, sqldata, sizeof(sqldata) - 1);
			ParseLoadData(data[0], sqldata);
		}
		else {
			NewUser(data[0]);
		}
	}
}
#endif

ParseLoadData(client, data[256]) {
	static num[10];
	strbreak(data, num, sizeof(num) - 1, data, sizeof(data) - 1);
	
	g_xp[client] = str_to_num(num);
	
	for( new i = 0; i < Grenades; i++ ) {
		strbreak(data, num, sizeof(num) - 1, data, sizeof(data) - 1);
		g_nade_level[client][i] = clamp(str_to_num(num), 0, g_nade_maxlevels[i]);
	}
	
	for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
		strbreak(data, num, sizeof(num) - 1, data, sizeof(data) - 1);
		g_armor_level[client][i] = clamp(str_to_num(num), 0, g_armor_maxlevels[i]);
	}
	
	for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
		strbreak(data, num, sizeof(num) - 1, data, sizeof(data) - 1);
		g_respawn_level[client][i] = clamp(str_to_num(num), 0, g_respawn_maxlevels[i]);
	}
	
	for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
		strbreak(data, num, sizeof(num) - 1, data, sizeof(data) - 1);
		g_health_level[client][i] = clamp(str_to_num(num), 0, g_health_maxlevels[i]);
	}
	
	for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
		strbreak(data, num, sizeof(num) - 1, data, sizeof(data) - 1);
		g_nofall_level[client][i] = clamp(str_to_num(num), 0, g_nofall_maxlevels[i]);
	}
	
	for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
		strbreak(data, num, sizeof(num) - 1, data, sizeof(data) - 1);
		g_damage_level[client][i] = clamp(str_to_num(num), 0, g_damage_maxlevels[i]);
	}
	
	#if defined USING_SQL
	g_loaded_data[client] = 1;
	#endif
}

NewUser(client) {
	g_first_time[client] = 1;
	
	g_xp[client] = ENTRY_XP;
	arrayset(g_nade_level[client], 0, sizeof(g_nade_level[]));
	for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
		g_armor_level[client][i] = 0;
		g_respawn_level[client][i] = 0;
		g_health_level[client][i] = 0;
		g_nofall_level[client][i] = 0;
		g_damage_level[client][i] = 0;
	}
}

Save(client) {
	if( !IsUserAuthorized(client) ) return;
	
	static data[512];
	new len = formatex(data, sizeof(data) - 1, "%i", g_xp[client]);
	
	for( new i = 0; i < Grenades; i++ ) {
		len += formatex(data[len], sizeof(data) - len - 1, " %i", g_nade_level[client][i]);
	}
	
	for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
		len += formatex(data[len], sizeof(data) - len - 1, " %i", g_armor_level[client][i]);
	}
	
	for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
		len += formatex(data[len], sizeof(data) - len - 1, " %i", g_respawn_level[client][i]);
	}
	
	for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
		len += formatex(data[len], sizeof(data) - len - 1, " %i", g_health_level[client][i]);
	}
	
	for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
		len += formatex(data[len], sizeof(data) - len - 1, " %i", g_nofall_level[client][i]);
	}
	
	for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ ) {
		len += formatex(data[len], sizeof(data) - len - 1, " %i", g_damage_level[client][i]);
	}
	
	#if defined USING_SQL
	static name[32];
	get_user_name(client, name, sizeof(name) - 1);
	
	static query[512];
	if( g_loaded_data[client] ) {
		formatex(query, sizeof(query) - 1, "UPDATE `hns_xp` SET `name` = '%s', `data` = '%s' WHERE `authid` = '%s';", name, data, g_authid[client]);
	}
	else {
		formatex(query, sizeof(query) - 1, "INSERT INTO `hns_xp` ( `name`, `authid`, `data` ) VALUES ( '%s', '%s', '%s' );", name, g_authid[client], data);
	}
	
	SQL_ThreadQuery(g_sql_tuple, "QuerySaveData", query);
	#else
	nvault_set(g_vault, g_authid[client], data);
	#endif
}

#if defined USING_SQL
public QuerySaveData(failstate, Handle:query, error[], errnum, data[], size, Float:queuetime) {
	if( failstate == TQUERY_CONNECT_FAILED
	|| failstate == TQUERY_QUERY_FAILED ) {
		set_fail_state(error);
	}
}
#endif
/*START - ColorChat */
stock ColorMessage(const id, const input[], any:...){
	new count = 1, players[32];
	static msg[ 191 ];
	vformat(msg, 190, input, 3);
	if (id) players[0] = id; else get_players(players , count , "ch");
	for (new i = 0; i < count; i++){
		if (is_user_connected(players[i])){
			message_begin(MSG_ONE_UNRELIABLE , get_user_msgid("SayText"), _, players[i]);
			write_byte(players[i]);
			write_string(msg);
			message_end();
		}
	}
}

  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Заявки за плъгини”

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 30 госта