Modificare V.I.P

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
User avatar
Doctor whO? <3
Membru, skill +2
Membru, skill +2
Posts: 785
Joined: 21 Jun 2013, 11:40
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Reputatie: Fost Membru Club eXtreamCS (doua luni)
Has thanked: 90 times
Been thanked: 12 times
Contact:

07 Nov 2019, 15:23

Salut,
Am un plugin de V.I.P care iti ofera la start de runda HP & Armura, insa eu vreau daca se poate sa se creeze cvar pentru ele. Vreau cvar deoarece am un plugin de noapte si de vip free si seara as vrea sa le setez automat HP-ul printr-un cvar.
vip | Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta_util>
#include <fun>
#include <hamsandwich>
#include <engine>

// DhudMessages

stock __dhud_color;
stock __dhud_x;
stock __dhud_y;
stock __dhud_effect;
stock __dhud_fxtime;
stock __dhud_holdtime;
stock __dhud_fadeintime;
stock __dhud_fadeouttime;
stock __dhud_reliable;

/// End

#define PLUGIN "Simple VIP"
#define VERSION "4.3"
#define AUTHOR "ArtHa"

#define VIP ADMIN_LEVEL_F
#define REMOVE_MENU 20.05
#define TID_REMOVE 2551

new jumpnum[ 33 ], bool: dojump[ 33 ], cvar_addjump_vip, cvar_addjump_player;

new CurrentRound
new bool:HasC4[33]
new bool:gShopVipmenu = true
new bool:gAwpBlock;
new bool:gVipmenuActive[33];
new grenades, pistols, armor, vipmenu_weapon4
new vipinfo, vip_motd
new show_received, bulletdmg_vip, received_vip, g_visible, bulletdmg_type
new Float: Yv[ 33 ]
new Float: Ya[ 33 ]
new g_pHp[ 3 ], chat_message
new awp_vip, cvar_player, awp_block, awp_limit
new vip_check, fall_damage

// VIP MENU WEAPONS
new weapon[8]
#define CSW_WEAPON1	CSW_M4A1
#define CSW_WEAPON2	CSW_AK47
#define CSW_WEAPON3	CSW_FAMAS
#define CSW_WEAPON4	CSW_AWP

#define CSW_GUN	CSW_DEAGLE
#define CSW_GUN1 CSW_GLOCK18
#define CSW_GUN2 CSW_USP
#define CSW_GUN3 CSW_DEAGLE

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_dictionary("simple_vip.txt")
	
	register_logevent("logevent_round_end", 2, "1=Round_End")  
	register_event( "TextMsg","round_restart","a","2&#Game_C", "2&#Game_W" );
	register_concmd( "amx_roundrestart", "restartnumber", ADMIN_KICK );
	RegisterHam( Ham_Spawn, "player", "FnHamSpawn", 1 )
	
	new configsdir[64], file[132]
	get_configsdir(configsdir, 63)
	
	format(file, 131, "%s/blockedmaps.ini", configsdir)	
	load_maps(file)
	
	register_cvar("vipmenu_round","2")
	
	pistols = register_cvar("vipmenu_pistols","1")
	grenades = register_cvar("vipmenu_grenades","1")
	armor = register_cvar("vipmenu_armor","1")
	vipmenu_weapon4 = register_cvar("vipmenu_weapon4","1")
	
	register_clcmd("say /noriuvip", "motd")
	vipinfo = register_cvar("vipinfo_website", "http://amxmodx.lt/viewtopic.php?f=12&t=5707")
	vip_motd = register_cvar("vipmenu_motd","1")
	
	register_event("Damage", "on_damage", "b", "2!0", "3=0", "4!0")
	show_received = register_cvar("show_received","1")
	bulletdmg_vip = register_cvar("bulletdmg_vip","1")
	received_vip = register_cvar("receivedmg_vip","1")
	g_visible = register_cvar("visible_player","1")
	bulletdmg_type = register_cvar("bullet_damage_type","2")
	
	register_event( "DeathMsg", "Event_DeathMsg", "a" )
	g_pHp[ 0 ] = register_cvar( "amx_vip_hpadd", "10" )
	g_pHp[ 1 ] = register_cvar( "amx_vip_hsadd", "20" )
	g_pHp[ 2 ] = register_cvar( "amx_vip_hpmax", "100" )
	
	chat_message = register_cvar( "amx_hpbonus_msg", "2" )
	
	register_event("CurWeapon", "event_CurWeapon", "be")
	awp_vip = register_cvar( "amx_vip_awp", "1" )
	awp_limit = register_cvar( "amx_awp_limit", "1" )
	awp_block = register_cvar( "amx_awp_block", "1" )
	cvar_player = register_cvar("na_players_count", "10")
	
	cvar_addjump_vip = register_cvar( "cvar_addjump_vip", "2" ) // Are 2 salturi in plus
	cvar_addjump_player = register_cvar( "cvar_addjump_player", "1" ) // Are 1 salt in plus
	
	vip_check = register_cvar( "amx_vip_check", "1" )
	register_clcmd("say", "handle_say")
	
	RegisterHam(Ham_TakeDamage, "player", "OnCBasePlayer_TakeDamage")
	RegisterHam( Ham_Spawn, "player", "ham_SpawnPlayerPost", true );
	fall_damage = register_cvar( "amx_no_falldmg", "1" )
	
	weapon[0] = register_cvar( "amx_weapon1_ammo", "90" )
	weapon[1] = register_cvar( "amx_weapon2_ammo", "90" )
	weapon[2] = register_cvar( "amx_weapon3_ammo", "90" )
	weapon[3] = register_cvar( "amx_weapon4_ammo", "30" )
	weapon[4] = register_cvar( "amx_gun_ammo", "35" )
	weapon[5] = register_cvar( "amx_gun1_ammo", "120" )
	weapon[6] = register_cvar( "amx_gun2_ammo", "100" )
	weapon[7] = register_cvar( "amx_gun3_ammo", "35" )
}

public logevent_round_end()
{
	CurrentRound++;
}

public plugin_cfg()
{
	new cfgdir[32];
	get_configsdir(cfgdir, charsmax(cfgdir));
	
	server_cmd("exec %s/simple_vip.cfg", cfgdir);
}

public ham_SpawnPlayerPost( id )
{
	if( is_user_alive( id ) ){
		if( get_user_flags( id ) & VIP ){
			set_user_health( id, 120 );
			set_user_armor( id, 120)
		}
	}
}

public load_maps(path[])
{
	new szMapname[64], szMap[64]
	new file = fopen(path, "rt")
	
	if(!file)
	{
		server_print("Failed to found blockedmaps.ini file!")
		return PLUGIN_HANDLED
	}
	
	new iSize = file_size(path, 1);
	
	for(new i = 0, iLen; i < iSize; i++)
	{
		read_file(path, i, szMapname, charsmax(szMapname), iLen);
		
		if(equal(szMapname[0], "") || equal(szMapname[0], ";"))
		{
			continue;
		}
		
		get_mapname(szMap, 63)
		if(equali(szMap, szMapname))
		{
			gShopVipmenu = false;
			break;
		}
	}
	fclose(file);
	return PLUGIN_CONTINUE
}

public round_restart()
{
	CurrentRound = 1;
	return PLUGIN_HANDLED;
}

public restartnumber( id, level, cid )
{
	if( !cmd_access( id, level, cid, 1 ) )
		return PLUGIN_HANDLED;
	
	CurrentRound = 1;
	return PLUGIN_HANDLED;
}

public FnHamSpawn(id)
{
	if(is_user_alive(id))
	{
		if(gShopVipmenu)
		{
			gVipmenuActive[id] = false
			
			if(CurrentRound >= get_cvar_num( "vipmenu_round" ) )
			{
				if(get_user_flags(id) & VIP )
				{
					if(task_exists(TID_REMOVE+id))
						remove_task(TID_REMOVE+id)
					
					gVipmenuActive[id] = true
					set_task(REMOVE_MENU, "close_menu", TID_REMOVE+id )
					vipmenu(id);
				}
			}
			
			if(get_pcvar_num(pistols) == 1 && CurrentRound <= get_cvar_num( "vipmenu_round" ))
			{
				if(get_user_flags(id) & VIP )
				{
					if(task_exists(TID_REMOVE+id))
						remove_task(TID_REMOVE+id)
					
					gVipmenuActive[id] = true
					set_task(REMOVE_MENU, "close_menu", TID_REMOVE+id )
					vipmenu2(id)
				}
			}
		}
	}
}

public close_menu(tid)
{
	static id
	id = tid-TID_REMOVE
	
	if(gVipmenuActive[id])
	{
		client_cmd(id, "slot10" )
		gVipmenuActive[id] = false
		ChatColor(id, "%L", id, "CLOSED" )
	}
}

public vipmenu(id) 
{
	new buffer[1024];
	formatex(buffer, charsmax(buffer), "%L", LANG_PLAYER, "VIPMENU");				
	new menu = menu_create(buffer, "menu_handler");
	
	formatex(buffer, charsmax(buffer), "%L", id, "WEAPONS1");
	menu_additem(menu, buffer, "1", 0);
	
	formatex(buffer, charsmax(buffer), "%L", id, "WEAPONS2");
	menu_additem(menu, buffer, "2", 0);
	
	formatex(buffer, charsmax(buffer), "%L", id, "WEAPONS3");
	menu_additem(menu, buffer, "3", 0);
	
	if(get_pcvar_num(vipmenu_weapon4) == 1)
	{
		formatex(buffer, charsmax(buffer), "%L", id, "WEAPONS4");
		menu_additem(menu, buffer, "4", 0);
	}
	
	menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
	menu_display(id, menu, 0); 
}

public vipmenu2(id) 
{
	new buffer[1024];
	formatex(buffer, charsmax(buffer), "%L", LANG_PLAYER, "VIPMENU");				
	new menu = menu_create(buffer, "menu_handler");
	
	formatex(buffer, charsmax(buffer), "%L", id, "GUN1");
	menu_additem(menu, buffer, "5", 0);
	
	formatex(buffer, charsmax(buffer), "%L", id, "GUN2");
	menu_additem(menu, buffer, "6", 0);
	
	formatex(buffer, charsmax(buffer), "%L", id, "GUN3");
	menu_additem(menu, buffer, "7", 0);
	
	menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
	menu_display(id, menu, 0); 
}

public menu_handler(id, menu, item)
{
	if( item == MENU_EXIT )
	{
		give_items(id);
		gVipmenuActive[id] = false;
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	new data[6], iName[64];
	new acess, callback;
	
	menu_item_getinfo(menu, item, acess, data,6, iName, 63, callback);
	new key = str_to_num(data);
	
	switch(key)
	{	
		case 1: { give_weapons(id, CSW_WEAPON1, get_pcvar_num( weapon[ 0 ] ), CSW_GUN, get_pcvar_num( weapon[ 4 ] )); }
		case 2: { give_weapons(id, CSW_WEAPON2, get_pcvar_num( weapon[ 1 ] ), CSW_GUN, get_pcvar_num( weapon[ 4 ] )); }
		case 3: { give_weapons(id, CSW_WEAPON3, get_pcvar_num( weapon[ 2 ] ), CSW_GUN, get_pcvar_num( weapon[ 4 ] )); }
		case 4: { give_weapons(id, CSW_WEAPON4, get_pcvar_num( weapon[ 3 ] ), CSW_GUN, get_pcvar_num( weapon[ 4 ] )); }
		case 5: { give_weapon(id, CSW_GUN1, get_pcvar_num( weapon[ 5 ] )); }
		case 6: { give_weapon(id, CSW_GUN2, get_pcvar_num( weapon[ 6 ] )); }		
		case 7: { give_weapon(id, CSW_GUN3, get_pcvar_num( weapon[ 7 ] )); }
	}
	
	gVipmenuActive[id] = false;
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

public give_weapons(id, prim, ammo1, sec, ammo2)
{
	HasC4[id] = (user_has_weapon(id, CSW_C4) && get_user_team(id) == 1)
	
	new weapon[32]
	strip_user_weapons (id)
	get_weaponname(prim, weapon, 31)
	give_item(id,weapon)
	cs_set_user_bpammo(id, prim, ammo1)
	
	get_weaponname(sec, weapon, 31)
	give_item(id,weapon)
	cs_set_user_bpammo(id, sec, ammo2)
	
	give_item(id,"weapon_knife")
	
	if(HasC4[id])
	{
		give_item(id, "weapon_c4")
		cs_set_user_plant( id )
	}
	
	give_items(id)
}

public give_weapon(id, sec, ammo)
{
	HasC4[id] = (user_has_weapon(id, CSW_C4) && get_user_team(id) == 1)
	
	new weapon[32]
	strip_user_weapons (id)
	get_weaponname(sec, weapon, 31)
	give_item(id,weapon)
	cs_set_user_bpammo(id, sec, ammo)
	
	give_item(id,"weapon_knife")
	
	if (HasC4[id])
	{
		give_item(id, "weapon_c4")
		cs_set_user_plant( id )
	}
	
	give_items(id)
}

give_items(id)
{
if(is_user_alive(id))
{
	if(get_pcvar_num(grenades) == 1)
	{
		give_item(id, "weapon_hegrenade");
		give_item(id, "weapon_smokegrenade");
		give_item(id, "weapon_flashbang");
		cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
	}
	
	if(get_pcvar_num(armor) == 1)
	{
		give_item(id, "item_assaultsuit");
		if(get_user_team(id) == 2)
			give_item(id, "item_thighpack");
		}
	}
}

public motd(id)
{
	if(get_pcvar_num(vip_motd) == 1)
		Link( id, "%s" )
}

stock Link( id, url[] )
{
	static html[ 128 ]
	new site[64]
	get_pcvar_string(vipinfo, site, charsmax(site))
	
	format( html, 127, "<html><head><META HTTP-EQUIV=^"Refresh^" CONTENT=^"0; URL=%s^"></head><body bgcolor=^"black^" scroll=^"yes^"><a href=^"%s^">VIP access</a></body></html>", site, url, url, url )
	
	show_motd( id, html, "Buy VIP" )
}

public on_damage(id) 
{ 
	static attacker; attacker = get_user_attacker(id)
	static damage; damage = read_data(2)
	
	if(get_pcvar_num(show_received) == 1)
	{
		if(get_pcvar_num(received_vip) == 1)
		{
			if( get_user_flags(id) & VIP ) 
			{
				if(get_pcvar_num(bulletdmg_type) == 1)
				{
					set_hudmessage(255, 0, 0, 0.45, 0.50, 2, 0.1, 4.0, 0.1, 0.1, -1) 
					ShowSyncHudMsg(id, CreateHudSyncObj(), "%L^n", id, "MINUS_DAMAGE", damage)
				}
				
				else
				{
					set_dhudmessage( 255,0,0, 0.45, Yv[ id ], 1, 0.1, 4.0, 0.1, 0.1)
					show_dhudmessage(id, "%L^n", id, "MINUS_DAMAGE", damage)
					
					Yv[ id ] += 0.05
					set_task( 3.0, "RestartdHudPos1", id )
				}
			}
		}
		
		else
		{
			if(get_pcvar_num(bulletdmg_type) == 1)
			{
				set_hudmessage(255, 0, 0, 0.45, 0.50, 2, 0.1, 4.0, 0.1, 0.1, -1) 
				ShowSyncHudMsg(id, CreateHudSyncObj(), "%L^n", id, "MINUS_DAMAGE", damage)
			}
			
			else
			{
				set_dhudmessage( 255,0,0, 0.45, Yv[ id ], 1, 0.1, 4.0, 0.1, 0.1)
				show_dhudmessage(id, "%L^n", id, "MINUS_DAMAGE", damage)
				
				Yv[ id ] += 0.05
				set_task( 3.0, "RestartdHudPos1", id )
			}
		}
	}
	
	if(is_user_connected(attacker)) 
	{
		if(get_pcvar_num(bulletdmg_vip) == 1)
		{
			if( get_user_flags(attacker) & VIP )
			{
				if(get_pcvar_num(g_visible) == 1)
				{
					if(fm_is_ent_visible(attacker,id))
					{
						if(get_pcvar_num(bulletdmg_type) == 1)
						{
							set_hudmessage(0, 255, 0, 0.55, 0.50, 2, 0.1, 4.0, 0.1, 0.1, -1) 
							ShowSyncHudMsg(attacker, CreateHudSyncObj(), "%L^n", attacker, "PLIUS_DAMAGE", damage)
						}
						
						else if(get_pcvar_num(bulletdmg_type) == 2)
						{
							set_dhudmessage( 0,255,0, 0.55, Ya[ attacker ], 1, 0.1, 4.0, 0.1, 0.1)
							show_dhudmessage(attacker, "%L^n", attacker, "PLIUS_DAMAGE", damage)
							Ya[ attacker ] += 0.05
							set_task( 3.0, "RestartdHudPos2", attacker )
						}
					}
				}
				
				else
				{
					if(get_pcvar_num(bulletdmg_type) == 1)
					{
						set_hudmessage(0, 255, 0, 0.55, 0.50, 2, 0.1, 4.0, 0.1, 0.1, -1) 
						ShowSyncHudMsg(attacker, CreateHudSyncObj(), "%L^n", attacker, "PLIUS_DAMAGE", damage)
					}
					
					else if(get_pcvar_num(bulletdmg_type) == 2)
					{
						set_dhudmessage( 0,255,0, 0.55, Ya[ attacker ], 1, 0.1, 4.0, 0.1, 0.1)
						show_dhudmessage(attacker, "%L^n", attacker, "PLIUS_DAMAGE", damage)
						Ya[ attacker ] += 0.05
						set_task( 3.0, "RestartdHudPos2", attacker )
					}
				}
			}
		}
		
		else if(get_pcvar_num(bulletdmg_vip) == 2)
		{
			if(get_pcvar_num(g_visible) == 1)
			{
				if(fm_is_ent_visible(attacker,id))
				{
					if(get_pcvar_num(bulletdmg_type) == 1)
					{
						set_hudmessage(0, 255, 0, 0.55, 0.50, 2, 0.1, 4.0, 0.1, 0.1, -1) 
						ShowSyncHudMsg(attacker, CreateHudSyncObj(), "%L^n", attacker, "PLIUS_DAMAGE", damage)
					}
					
					else if(get_pcvar_num(bulletdmg_type) == 2)
					{
						set_dhudmessage( 0,255,0, 0.55, Ya[ attacker ], 1, 0.1, 4.0, 0.1, 0.1)
						show_dhudmessage(attacker, "%L^n", attacker, "PLIUS_DAMAGE", damage)
						Ya[ attacker ] += 0.05
						set_task( 3.0, "RestartdHudPos2", attacker )
					}
				}
			}
			
			else
			{
				if(get_pcvar_num(bulletdmg_type) == 1)
				{
					set_hudmessage(0, 255, 0, 0.55, 0.50, 2, 0.1, 4.0, 0.1, 0.1, -1) 
					ShowSyncHudMsg(attacker, CreateHudSyncObj(), "%L^n", attacker, "PLIUS_DAMAGE", damage)
				}
				
				else if(get_pcvar_num(bulletdmg_type) == 2)
				{
					set_dhudmessage( 0,255,0, 0.55, Ya[ attacker ], 1, 0.1, 4.0, 0.1, 0.1)
					show_dhudmessage(attacker, "%L^n", attacker, "PLIUS_DAMAGE", damage)
					Ya[ attacker ] += 0.05
					set_task( 3.0, "RestartdHudPos2", attacker )
				}
			}
		}
	}
}

public RestartdHudPos1( id )
{
	Yv[ id ] = 0.50
}

public RestartdHudPos2( id )
{
	Ya[ id ] = 0.55
}

public client_putinserver( id )
{
	Ya[ id ] = 0.45
	Yv[ id ] = 0.50
	jumpnum[ id ] = 0
	dojump[ id ] = false
}

public client_disconnect( id )
{
	jumpnum[ id ] = 0
	dojump[ id ] = false
}

public Event_DeathMsg( )
{
	new iKiller = read_data( 1 )
	new iVictim = read_data( 2 )
	new HeadShot = read_data( 3 )
	
	if( get_user_team( iKiller ) == get_user_team( iVictim ) )
		return
	
	if( iKiller && iVictim != iKiller && get_user_flags(iKiller) & VIP )
	{
		static maxhp, hp
		maxhp = get_pcvar_num( g_pHp[ 2 ] )
		hp = get_user_health( iKiller )
		
		if( hp != maxhp )
		{
			new BonusHp;
			if( HeadShot ) BonusHp = get_pcvar_num( g_pHp[ 1 ] )
			else BonusHp = get_pcvar_num( g_pHp[ 0 ] )
			
			if( hp + BonusHp > maxhp )
			{
				set_user_health( iKiller, maxhp )
				
				if(get_pcvar_num(chat_message) == 1)
					ChatColor(iKiller, "%L", iKiller, "HP_BONUS", maxhp - hp )
				
				else if(get_pcvar_num(chat_message) == 2)
				{
					set_dhudmessage( 0,255,0, -1.0, 0.15, 1, 1.0, 1.0, 0.1, 0.2)
					show_dhudmessage(iKiller, "%L", iKiller, "HP_BONUS", maxhp - hp )
				}	
			} 
			else
			{
				set_user_health( iKiller, hp + BonusHp )
				
				if(get_pcvar_num(chat_message) == 1)
					ChatColor(iKiller, "%L", iKiller, "HP_BONUS", BonusHp )
				
				else if(get_pcvar_num(chat_message) == 2)
				{
					set_dhudmessage( 0,255,0, -1.0, 0.15, 1, 1.0, 1.0, 0.1, 0.2)
					show_dhudmessage(iKiller, "%L", iKiller, "HP_BONUS", BonusHp )
				}
			}
		}
	}	
}

public event_CurWeapon(id)
{
	new szMapname[64]
	get_mapname(szMapname, 63)
	
	if( containi(szMapname, "cs_max") != -1 || containi(szMapname, "2x2") != -1 || containi(szMapname, "fy_") != -1 || containi(szMapname, "aim_") != -1 || containi(szMapname, "mini") != -1)
		gAwpBlock = true
	
	if(containi(szMapname, "awp"))
	{
		switch(read_data(2))
		{
			case CSW_AWP, CSW_SG550, CSW_G3SG1:
			{
				if(get_pcvar_num(awp_block) == 1 && gAwpBlock)
				{
					client_cmd(id, "drop")
					ChatColor(id, "%L", id, "AWP_BLOCK" )
				}
				
				if(get_pcvar_num(awp_limit) == 1 && get_playersnum() < get_pcvar_num(cvar_player))
				{
					client_cmd(id, "drop")
					ChatColor(id, "%L", id, "AWP_LIMIT", get_pcvar_num(cvar_player) )
				}
				
				if(get_pcvar_num(awp_vip) == 1 && (!(get_user_flags(id) & VIP)))
				{
					client_cmd(id, "drop")
					ChatColor(id, "%L", id, "AWP_DROP" )
				}
			}
		}
	}
}

public handle_say(id)
{
	new said[192]
	read_args(said,192)
	
	if(get_pcvar_num(vip_check) == 1)
	{
		if(containi(said, "/vip") != -1 )
			show_vip(id)
	}
	
	return PLUGIN_CONTINUE
}

public show_vip(user) 
{
	new adminnames[32][33]
	new message[256]
	new id, count, x, len
	
	new players[32], playersnum
	get_players(players, playersnum, "ch")
	for(--playersnum; playersnum >= 0; playersnum--)
	{
		id = players[playersnum]
		if(get_user_flags(id) & VIP)
		{
			get_user_name(id, adminnames[count++], charsmax(adminnames[]))
		}
	}
	
	len = formatex(message, charsmax(message), "^3VIPs Online:^4 ", user)
	if(count > 0) 
	{
		for(x = 0 ; x < count ; x++) 
		{
			len += formatex(message[len], charsmax(message)-len, "^1%s%s", adminnames[x], x < (count-1) ? ", ":".")
			if(len > 96) 
			{
				ChatColor(user, message)
				len = format(message, 255, "^4")
			}
		}
		ChatColor(user, message)
	}
	else
	{
		len += copy(message[len], charsmax(message)-len, "^3No ^4VIPs^3 online.")
		ChatColor(user, message)
	}
}

public OnCBasePlayer_TakeDamage( id, iInflictor, iAttacker, Float:flDamage, bitsDamageType )
{
	if( bitsDamageType & DMG_FALL )
	{
		if(get_pcvar_num(fall_damage) == 1)
		{
			if( get_user_flags(id) & VIP )
			{
				return HAM_SUPERCEDE
			}
		}
		
		else if(get_pcvar_num(fall_damage) == 2)
		{
			return HAM_SUPERCEDE
		}
	}
	return HAM_IGNORED
}

public client_PreThink( id )
{
	if( !is_user_alive( id ) ) return PLUGIN_CONTINUE
	
	new BUTON = get_user_button( id )
	new OLDBUTON = get_user_oldbutton( id )
	new JUMP_VIP = get_pcvar_num( cvar_addjump_vip )
	new JUMP_PLAYER = get_pcvar_num( cvar_addjump_player )
	
	if( ( BUTON & IN_JUMP ) && !( get_entity_flags( id ) & FL_ONGROUND ) && !( OLDBUTON & IN_JUMP ) )
	{
		if( ( ( get_user_flags( id ) & VIP ) && ( jumpnum[ id ] < JUMP_VIP ) )
		|| ( !( get_user_flags( id ) & VIP ) && ( jumpnum[ id ] < JUMP_PLAYER ) ) )
	{
		dojump[ id ] = true
		jumpnum[ id ]++
	}
}

if( ( BUTON & IN_JUMP ) && ( get_entity_flags( id ) & FL_ONGROUND ) )
{
	jumpnum[ id ] = 0
}

return PLUGIN_CONTINUE
}

public client_PostThink( id )
{
if( !is_user_alive( id ) ) return PLUGIN_CONTINUE

if( dojump[ id ] == true )
{
	new Float: velocity[ 3 ]	
	entity_get_vector( id, EV_VEC_velocity, velocity )
	velocity[ 2 ] = random_float( 265.0, 285.0 )
	entity_set_vector( id, EV_VEC_velocity, velocity )
	dojump[ id ] = false
}

return PLUGIN_CONTINUE
}
stock set_dhudmessage( red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65, effects = 2, Float:fxtime = 6.0, Float:holdtime = 3.0, Float:fadeintime = 0.1, Float:fadeouttime = 1.5, bool:reliable = false )
{
#define clamp_byte(%1)       ( clamp( %1, 0, 255 ) )
#define pack_color(%1,%2,%3) ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )

__dhud_color       = pack_color( clamp_byte( red ), clamp_byte( green ), clamp_byte( blue ) );
__dhud_x           = _:x;
__dhud_y           = _:y;
__dhud_effect      = effects;
__dhud_fxtime      = _:fxtime;
__dhud_holdtime    = _:holdtime;
__dhud_fadeintime  = _:fadeintime;
__dhud_fadeouttime = _:fadeouttime;
__dhud_reliable    = _:reliable;

return 1;
}

stock show_dhudmessage( index, const message[], any:... )
{
new buffer[ 128 ];
new numArguments = numargs();

if( numArguments == 2 )
{
	send_dhudMessage( index, message );
}
else if( index || numArguments == 3 )
{
	vformat( buffer, charsmax( buffer ), message, 3 );
	send_dhudMessage( index, buffer );
}
else
{
	new playersList[ 32 ], numPlayers;
	get_players( playersList, numPlayers, "ch" );
	
	if( !numPlayers )
	{
		return 0;
	}
	
	new Array:handleArrayML = ArrayCreate();
	
	for( new i = 2, j; i < numArguments; i++ )
	{
		if( getarg( i ) == LANG_PLAYER )
		{
			while( ( buffer[ j ] = getarg( i + 1, j++ ) ) ) {}
			j = 0;
			
			if( GetLangTransKey( buffer ) != TransKey_Bad )
			{
				ArrayPushCell( handleArrayML, i++ );
			}
		}
	}
	
	new size = ArraySize( handleArrayML );
	
	if( !size )
	{
		vformat( buffer, charsmax( buffer ), message, 3 );
		send_dhudMessage( index, buffer );
	}
	else
	{
		for( new i = 0, j; i < numPlayers; i++ )
		{
			index = playersList[ i ];
			
			for( j = 0; j < size; j++ )
			{
				setarg( ArrayGetCell( handleArrayML, j ), 0, index );
			}
			
			vformat( buffer, charsmax( buffer ), message, 3 );
			send_dhudMessage( index, buffer );
		}
	}
	
	ArrayDestroy( handleArrayML );
}

return 1;
}

stock send_dhudMessage( const index, const message[] )
{
message_begin( __dhud_reliable ? ( index ? MSG_ONE : MSG_ALL ) : ( index ? MSG_ONE_UNRELIABLE : MSG_BROADCAST ), SVC_DIRECTOR, _, index );
{
write_byte( strlen( message ) + 31 );
write_byte( DRC_CMD_MESSAGE );
write_byte( __dhud_effect );
write_long( __dhud_color );
write_long( __dhud_x );
write_long( __dhud_y );
write_long( __dhud_fadeintime );
write_long( __dhud_fadeouttime );
write_long( __dhud_holdtime );
write_long( __dhud_fxtime );
write_string( message );
}
message_end();
}
stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[192]
vformat(msg, 191, input, 3)

replace_all(msg, 191, "!g", "^4") // Green Color
replace_all(msg, 191, "!y", "^1") // Default Color
replace_all(msg, 191, "!t", "^3") // Team Color

if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players))
{
	message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players)
	write_byte(players);
	write_string(msg);
	message_end();
}
}
}
}
/* 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 }
*/
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests