Vip Classic

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

User avatar
CyBer[N]eTicK
Membru, skill +1
Membru, skill +1
Posts: 190
Joined: 29 May 2020, 05:35
Detinator Steam: Da
CS Status: Strong & Original
Detinator server CS: BB.BLACKGAMES.RO
SteamID: /id/cybernetick_cbk/
Fond eXtream: 0
Location: Albania, tirana
Discord: cybernetick_cbk
Has thanked: 21 times
Been thanked: 18 times
Contact:

17 Jul 2020, 00:37

Ia vezi daca merge e tot cel de sus l-am compilat si n-are erori
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <ColorChat>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
#include <engine>

#pragma tabsize 0


#if AMXX_VERSION_NUM < 181
#define MAX_PLAYERS 32
#endif

#if AMXX_VERSION_NUM < 182
#define MAX_PLAYERS 32
#endif

#if AMXX_VERSION_NUM < 183
#define MAX_PLAYERS 32
#endif

#define TASK_MENU 1221

#define MAX_HP 100
#define MAX_AP 100

#define KILL_HP 15
#define HEAD_HP 30

#define KILL_AP 15
#define HEAD_AP 30

#define KILL_MONEY 200
#define HEAD_MONEY 300

new Trie:g_Trie

new g_szWantVIP[48]

new bool:g_MenuOnThisMap

//new g_HudSync1
//new g_HudSync2

new g_iMaxPlayers

new pos[MAX_PLAYERS+1]

new const Float:rY[] =
{
0.4,
0.45,
0.5,
0.55,
0.6
}

new const Float:dY[] =
{
0.4,
0.45,
0.5,
0.55,
0.6
}

#define ADD_JUMP 1

const OFFSET_CSMENUCODE = 205

new g_iJumps[MAX_PLAYERS+1]
new bool:g_bJump[MAX_PLAYERS+1]

new bool:g_bVIPfree

new c_VIPfreeStart
new c_VIPfreeStop

new g_iRound

new g_Menu

const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)
//const PEV_ADDITIONAL_AMMO = pev_iuser1

public plugin_init()
{
new path[64];
get_localinfo("amxx_configsdir", path, charsmax(path));
formatex(path, charsmax(path), "%s/vip_maps.ini", path);

new file = fopen(path, "r+");

if(!file_exists(path))
{
write_file(path, "; VIP-UL ESTE DEZACTIVAT PE URMATOARELE HARTI: ");
write_file(path, "; Exemplu de adaugare HARTA:^n; ^"harta^"^n^nfy_snow^nawp_bycastor");
}

new mapname[32];
get_mapname(mapname, charsmax(mapname));

new text[121], maptext[32];
while(!feof(file))
{
fgets(file, text, charsmax(text));
trim(text);

if(text[0] == ';' || !strlen(text)) 
{
	continue; 
}

parse(text, maptext, charsmax(maptext));

if(equal(maptext, mapname))
{
	log_amx("Am dezactivat pluginul 'VIP' pe harta %s.", maptext);
	g_MenuOnThisMap = false;
	break;
}
else
{
	g_MenuOnThisMap = true;
}
}
fclose(file);

register_plugin( "Classic VIP", "1.1", "" )
register_event( "HLTV", "event_NewRound", "a", "1=0", "2=0" )
RegisterHam( Ham_Spawn, "player", "Ham_Player_Spawn_Post", true )
RegisterHam( Ham_Killed, "player", "Ham_Player_Killed_Post", true )
//register_logevent( "logevent_Restart", 2, "1&Restart_Round", "1&Game_Commencing" )
register_event( "TextMsg", "event_Restart", "a", "2&#Game_C", "2&#Game_w" )
register_logevent( "logevent_Round_End", 2, "1=Round_End" )

g_Trie = TrieCreate()

c_VIPfreeStart = register_cvar( "vip_free_start", "22" )
c_VIPfreeStop = register_cvar( "vip_free_stop", "22" )

register_message( get_user_msgid("ScoreAttrib"), "msg_ScoreAttrib" )
register_event( "DeathMsg", "event_DeathMsg", "a", "1>0" )
register_event( "Damage", "event_Damage", "b", "2!0", "3=0", "4!0" )
register_clcmd( "say /wantvip", "clcmd_say_wantvip" )
register_clcmd( "say /vips", "clcmd_say_vips" )

//g_HudSync1 = CreateHudSyncObj();
//g_HudSync2 = CreateHudSyncObj();

g_iMaxPlayers = get_maxplayers();
}

public plugin_cfg()
{
new szCfg[32]
get_configsdir( szCfg, charsmax(szCfg) )

new File[48]
formatex( File, charsmax(File), "%s/%s", szCfg, "vip_list.ini" )

formatex( g_szWantVIP, charsmax(g_szWantVIP), "%s/%s", szCfg, "vip_info.html" )

if( !file_exists(File) )
{
write_file( File, "; Un nume pe linie" )
write_file( File, "; Semnul ^";^" in fata dezactiveaza VIP-ul" )
}

new fp = fopen( File, "rt" )

if(fp)
{
new buff[36]

while( !feof(fp) )
{
	fgets( fp, buff, charsmax(buff) )
	
	if( !buff[0] || buff[0] == ';' )
		continue;
		
		trim(buff)
		
		TrieSetCell( g_Trie, buff, true )
	}
	
	fclose(fp)
}
else
	set_fail_state( "Eroare la citirea fisierului: vip_list.ini" )
	
	_MakeMenu()
}

public plugin_end()
{
	TrieDestroy(g_Trie)
}

_MakeMenu()
{
g_Menu = menu_create( "VIP MENU CLASIC", "menu_handler" )

menu_additem( g_Menu, "--|M4A1 + Deagle|--" )
menu_additem( g_Menu, "---|AK47 + Deagle|--" )
menu_additem( g_Menu, "---|AWP + Deagle|--" )
}

public event_NewRound()
{
g_iRound++

new h
time( h, _, _ )

new start = get_pcvar_num( c_VIPfreeStart )
new stop = get_pcvar_num( c_VIPfreeStop )

if( start > stop )
{
	if( stop <= h < start )
		g_bVIPfree = false
		else
			g_bVIPfree = true
	}
	else if( start < stop )
	{
		if( start <= h < stop )
			g_bVIPfree = true
		else
			g_bVIPfree = false
	}
}

public event_Restart()
{
	g_iRound = 0
	_CloseMenu()
}

public logevent_Round_End()
{
	_CloseMenu()
}

_CloseMenu()
{
new Pl[32], n, p, i;
get_players( Pl, n, "ch" );
if( n > 0 )
{
	for( i = 0; i < n; i++ )
	{
		p = Pl;
		
		menu_cancel(p);
		show_menu( p, 0, "^n", 1 );
	}
}
}

public Ham_Player_Spawn_Post(id)
{
if( !is_user_alive(id) )
	return;
	
	if( !is_user_vip(id) )
		return;
	
	cs_set_user_armor( id, MAX_AP, CS_ARMOR_VESTHELM )
	
	if( !user_has_weapon( id, CSW_HEGRENADE ) )
		give_item( id, "weapon_hegrenade" )
	
	if( !user_has_weapon( id, CSW_FLASHBANG ) )
	{
		give_item( id, "weapon_flashbang" )
		cs_set_user_bpammo( id, CSW_FLASHBANG, 2 )
	}
	else
		cs_set_user_bpammo( id, CSW_FLASHBANG, 2 )
	
	if( g_iRound >= 2 && g_MenuOnThisMap)	// din runda 3: scor 1 - 0
	{
		set_task( 1.0, "task_VipMenu", id + TASK_MENU )
	}
	
	if( cs_get_user_team(id) != CS_TEAM_CT )
		return;
	
	if( !cs_get_user_defuse(id) )
		cs_set_user_defuse(id, true)
}

public Ham_Player_Killed_Post(id, killer, gib)
{
	if( is_user_connected(id) )
	{
		menu_cancel(id)
		show_menu( id, 0, "^n", 1 )
	}
}

public task_VipMenu(task)
{
	new id = task - TASK_MENU
	
	if( !is_user_alive(id) )
		return 1;
	if( !g_MenuOnThisMap)
		return 1;
	
	set_pdata_int( id, OFFSET_CSMENUCODE, 0 )
	menu_display( id, g_Menu, 0 )
	
	return 1;
}

public menu_handler(id, menu, item)
{
	if( item == MENU_EXIT )
		return 1;
	
	if( !is_user_alive(id) )
		return 1;
	
	switch(item)
	{
		case 0:
		{
			UTIL_DropWeapons(id, 1)
			_give( id, "weapon_m4a1", CSW_M4A1, 90 )
			
			UTIL_DropWeapons(id, 2)
			_give( id, "weapon_deagle", CSW_DEAGLE, 35 )
		}
		case 1:
		{
			UTIL_DropWeapons(id, 1)
			_give( id, "weapon_ak47", CSW_AK47, 90 )
			
			UTIL_DropWeapons(id, 2)
			_give( id, "weapon_deagle", CSW_DEAGLE, 35 )
		}
		case 2:
		{
			UTIL_DropWeapons(id, 1)
			_give( id, "weapon_awp", CSW_AWP, 90 )
			
			UTIL_DropWeapons(id, 2)
			_give( id, "weapon_deagle", CSW_DEAGLE, 35 )
		}
	}
	
	return 1;
}

public clcmd_say_wantvip(id)
{
	show_motd( id, g_szWantVIP, "VIP Info" )
	
	return 1;
}

public clcmd_say_vips(id)
{
	new szMessage[ 256 ], iCount = 0
	new Name[32]
	new iLen = formatex( szMessage, charsmax( szMessage ), "[VIP Online]: " )
	
	for( new Player = 1; Player <= g_iMaxPlayers; ++Player )
	{
		
		if( is_user_connected( Player ) && is_user_vip(Player) )
		{
			if( iLen > 96 )
			{
				ColorChat( id, GREEN, "%s,", szMessage )
				iLen = formatex( szMessage, charsmax( szMessage ), "" )
			}
			
			if( iCount && iLen )
				iLen += formatex( szMessage[ iLen ], 255 - iLen, ", " )
			
			get_user_name( Player, Name, charsmax(Name) )
			iLen += formatex( szMessage[ iLen ], 255 - iLen, "%s", Name )
			++iCount
		}
	}
	
	if( iLen )
	{
		if( !iCount )
			iLen += formatex( szMessage[ iLen ], 255 - iLen, "No VIP's Online" )
		
		ColorChat( id, GREEN, "%s", szMessage )
	}
	
	return 1;
}

public event_DeathMsg()
{
	new Killer = read_data(1)
	
	if( !is_user_alive(Killer) )
		return;
	
	if( !is_user_vip(Killer) )
		return;
	
	new Victim = read_data(2)
	
	if( Killer == Victim )
		return;
	
	new Head = read_data(3)
	
	new hp = get_user_health(Killer)
	
	new money = cs_get_user_money(Killer)
	
	new CsArmorType:ArmorType
	new armor = cs_get_user_armor( Killer, ArmorType )
	
	if( Head )
	{
		hp += HEAD_HP
		money += HEAD_MONEY
		armor += HEAD_AP
	}
	else
	{
		hp += KILL_HP
		money += KILL_MONEY
		armor += KILL_AP
	}
	
	set_user_health( Killer, min( hp, MAX_HP ) )
	
	cs_set_user_armor( Killer, min( armor, MAX_AP ), ArmorType )
	
	cs_set_user_money( Killer, min( money, 16000 ), true )
	
	ColorChat( Killer, GREEN, "* Kill Reward: ^3%d HP ^1, ^3%d AP ^1and ^3%d $", Head ? HEAD_HP : KILL_HP,
	Head ? HEAD_AP : KILL_AP, Head ? HEAD_MONEY : KILL_MONEY )
}

public msg_ScoreAttrib( msg_id, msg_dest, receiver )
{
	/* original code by xpaw & Radius */
	#define ARG_PlayerID    1
	#define ARG_Flags       2
	#define SCOREBOARD_VIP  (1 << 2)
	
	if( is_user_vip( get_msg_arg_int(ARG_PlayerID) ) )
		set_msg_arg_int( ARG_Flags, ARG_BYTE, get_msg_arg_int(ARG_Flags) | SCOREBOARD_VIP )
}

public client_putinserver(id)
{
	g_iJumps[id] = 0
	g_bJump[id] = false
}

public event_Damage(id)
{
	static att
	att = get_user_attacker(id)
	
	static damage
	damage = read_data(2)
	
	if( is_user_vip(id) )
	{
		set_hudmessage( 255, 0, 0, 0.6, rY[pos[id]], 0, 0.0, 3.0, 0.1, 0.1, -1 )
		//ShowSyncHudMsg( id, g_HudSync2, "%d", damage )
		show_hudmessage( id, "%d", damage )
		
		pos[id]++
		if( pos[id] > 4 ) pos[id] = 0
	}
	
	if( is_user_alive(att) && is_user_vip(att) )
	{
		set_hudmessage( 0, 255, 0, 0.4, dY[pos[att]], 0, 0.0, 3.0, 0.1, 0.1, -1 )
		//ShowSyncHudMsg( att, g_HudSync1, "%d", damage )
		show_hudmessage( att, "%d", damage )
		
		pos[att]++
		if( pos[att] > 4 ) pos[att] = 0
	}
}

public client_PreThink(id)
{
	if( !is_user_alive(id) || !is_user_vip(id) )
		return;
	
	static nbut; nbut = get_user_button(id)
	static obut; obut = get_user_oldbutton(id)
	
	if( (nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP) )
	{
		if( g_iJumps[id] < ADD_JUMP )
		{
			g_bJump[id] = true
			g_iJumps[id]++
		}
		
		//return;
	}
	
	if( (nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND) )
	{
		g_iJumps[id] = 0
	}
}

public client_PostThink(id)
{
	if( !is_user_alive(id) || !is_user_vip(id) )
		return;
	
	if( g_bJump[id] )
	{
		static Float:velocity[3]
		entity_get_vector( id, EV_VEC_velocity, velocity )
		velocity[2] = 275.0 //random_float( 265.0,285.0 )
		entity_set_vector( id, EV_VEC_velocity, velocity )
		
		g_bJump[id] = false
	}
}

bool:is_user_vip(id)
{
if( g_bVIPfree )
	return true;
	
	static Name[32]
	get_user_name( id, Name, charsmax(Name) )
	
	if( TrieKeyExists( g_Trie, Name ) )
		return true;
	
	return false;
}

stock _give( id, const weapon[], CSW, BPammo )
{
	give_item( id, weapon )
	cs_set_user_bpammo( id, CSW, BPammo )
}

stock UTIL_DropWeapons(id, dropwhat)
{
	static weapons[32], num, i, weaponid
	num = 0
	get_user_weapons( id, weapons, num )
	
	for( i = 0; i < num; i++ )
	{
		weaponid = weapons
		
		if( ( dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM) ) || ( dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM) ) )
		{
			static wname[32] //, weapon_ent
			get_weaponname( weaponid, wname, charsmax(wname) )
			//weapon_ent = fm_find_ent_by_owner( -1, wname, id )
			
			//set_pev( weapon_ent, PEV_ADDITIONAL_AMMO, cs_get_user_bpammo(id, weaponid) )
			
			engclient_cmd( id, "drop", wname )
			//cs_set_user_bpammo( id, weaponid, 0 )
		}
	}
}
/*
stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0)
{
	new strtype[11] = "classname"
	new ent = index
	
	switch( jghgtype )
	{
		case 1: strtype = "target";
			case 2: strtype = "targetname";
		}
	
	while( (ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner ) {}
	
	return ent;
}
*/
stock ChatColor(const id, const input[], any:...) {
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "!g", "^4"); // Green Color
	replace_all(msg, 190, "!n", "^1"); // Default Color
	replace_all(msg, 190, "!t", "^3"); // Team Color
	replace_all(msg, 190, "!t2", "^0"); // Team2 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();
			}
		}
	}
}
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 10 guests