plugin VIP

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Post Reply
JoNNN-;x
Membru, skill 0
Membru, skill 0
Posts: 7
Joined: 18 Jul 2018, 13:54
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

18 Jul 2018, 14:04

Buna ziua!
Cum configurez acest plugin ca vip-ul free sa intre la ora 22:00 ora Romaniei si sa se opreasca la ora 09:00 a doua zii
Mentionez ca serverul ruleaza pe ip extern si este trecut pe Brazilia si e problema la diferenta de fus orar https://www.gametracker.com/server_info ... .72:27015/ (sper sa nu fac reclama sau cv de genul)
Mai jos o sa las pluginul!!!


| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
#include <engine>

#include <CC_ColorChat>

#if !defined CC_ColorChat
	#define CC_ColorChat ColorChat
#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 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()
{
	register_plugin( "Euro Vip", "0.1", "DiaManTe ***" )

	register_event( "HLTV", "ev_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( "logev_Restart", 2, "1&Restart_Round", "1&Game_Commencing" )

	register_event( "TextMsg", "ev_Restart", "a", "2&#Game_C", "2&#Game_w" )

	register_logevent( "logev_Round_End", 2, "1=Round_End" )

	g_Trie = TrieCreate()

	c_VIPfreeStart = register_cvar( "vip_free_start", "06" )
	c_VIPfreeStop = register_cvar( "vip_free_stop", "05" )

	register_message( get_user_msgid("ScoreAttrib"), "msg_ScoreAttrib" )

	register_event( "DeathMsg", "ev_DeathMsg", "a", "1>0" )

	register_event( "Damage", "ev_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( "Meniu VIP - ALFA.REBELII.RO", "menu_handler" )

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

public ev_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 ev_Restart()
{
	g_iRound = 0
	_CloseMenu()
}

public logev_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 )	// din runda 2: 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;

	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 )
			{
				CC_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" )

		CC_ColorChat( id, GREEN, "%s", szMessage )
	}

	return 1;
}

public ev_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 )

	CC_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 ev_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;
}
*/
Last edited by j a h k 0- on 24 Sep 2018, 16:33, edited 1 time in total.
Reason: Edit: Am adaugat [Sursa=]
RoyalServer 2
User avatar
j a h k 0-
Membru, skill +4
Membru, skill +4
Posts: 1536
Joined: 26 Jan 2016, 10:24
Detinator Steam: Da
CS Status: segmentation fault
SteamID: /ID/jkhalibu
Reputatie: Utilizator neserios
Restrictie moderator [permanent]
Membru Club eXtreamCS (3 luni)
Nume anterior: Jah#
Fond eXtream: 0
Location: Chişinău, Republic Of Moldova
Has thanked: 69 times
Been thanked: 13 times
Contact:

24 Sep 2018, 16:33

Mutat in categoria corespunzatoare.
Tranzactii efectuate cu succes.
| Afiseaza codul
anunturi/vand-cont-rockstar-gta-15euro- ... 49363.html
anunturi/vand-cont-rockstar-gta-euro-paypal-t349373.html
anunturi/cumpar-tema-ipb-t349335.html
anunturi/recomandare-utilizatori-pentru-tranzactii-t323814-60.html
anunturi/recomandare-utilizatori-pentru-tranzactii-t323814-72.html
post2692853.html#p2692853
anunturi/addons-furien-classic-cyby-t348802.html
Image
| Afiseaza codul
Image
Image
Post Reply

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: Yandex [Bot] and 33 guests