VIP System( SQL Version ) [Support for Nobs] [16.02.2014]

Pluginuri facute de utilizatorii forumului eXtream.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
remusbest123
Membru, skill 0
Membru, skill 0
Posts: 35
Joined: 03 Dec 2012, 00:02
Detinator Steam: Da
CS Status: Modific Serverul :D
Detinator server CS: Da
Has thanked: 6 times
Contact:

02 Jun 2014, 01:59

Salut super tare Systemul VIP la-m testat , sar putea ca la Echipa tero sa nu mai dea Gravitate si Speed , adica sa fie default ? :D
RoyalServer 2
stropww3
Membru, skill 0
Membru, skill 0
Posts: 1
Joined: 29 Nov 2014, 18:20
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

30 Nov 2014, 11:13

Salut,mie nu imi merge sa dezactivez VIP-ul adica ala la event vip...,eu il am activat si merge bun,intru in sma il dezactivez cu 0 si il compliez il bag in plugins si degeaba tot este eventu on...,si as avea o intrebare daca as putea sa fac ceva in users.ini de ex: ; VIP
"Nume" "Parola" "bit" "a"
sau
"ip" "password" "bit" "de"

si sa stiu daca merge :) si daca ai putea sa ma juti cu problema cu event vip...
LawreN
Membru, skill 0
Membru, skill 0
Posts: 15
Joined: 21 Nov 2014, 15:45
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

02 Dec 2014, 20:09

Foarte frumos, cel mai frumos mod de vip.
Image
User avatar
rafy21
Membru, skill +1
Membru, skill +1
Posts: 148
Joined: 16 Jan 2013, 17:15
Detinator Steam: Da
CS Status: O caut Pe Zana Maseluta!
SteamID: STEAM_0:0:32316119
Location: Arad
Has thanked: 1 time
Been thanked: 1 time
Contact:

11 Dec 2014, 22:11

Ptrimesc aceasta eroare...


vip.sma(21) : fatal error 100: cannot read from file: "CC_ColorChat"

EDIT: am in logs aceasta eroare:

L 12/27/2014 - 00:45:35: Info (map "de_dust2x2") (file "addons/amxmodx/logs/error_20141227.log")
L 12/27/2014 - 00:45:35: [FUN] Player out of range (0)
L 12/27/2014 - 00:45:35: [AMXX] Displaying debug trace (plugin "VipSystem.amxx")
L 12/27/2014 - 00:45:35: [AMXX] Run time error 10: native error (native "set_user_health")
L 12/27/2014 - 00:45:35: [AMXX] [0] VipSystem.sma::event_DeathMsg (line 284)

...
Last edited by YONTU on 12 Dec 2014, 15:23, edited 1 time in total.
Reason: Ai nevoie de aceasta librarie in folderul include. O gasesti in primul topic.
Y!M: rafi_fdr

Web-Pedia : http://web-pedia.info
Castiga bani online , fara sa investesti nimic.Doar pe Web-Pedia. Tot aici poti castiga reclama gratuita la orice, de la site-uri proprii , pana la firme de hosting sau servere gamming (de orice fel) , si totul este GRATUIT!
User avatar
rafy21
Membru, skill +1
Membru, skill +1
Posts: 148
Joined: 16 Jan 2013, 17:15
Detinator Steam: Da
CS Status: O caut Pe Zana Maseluta!
SteamID: STEAM_0:0:32316119
Location: Arad
Has thanked: 1 time
Been thanked: 1 time
Contact:

27 Dec 2014, 15:35

Cineva?!
Y!M: rafi_fdr

Web-Pedia : http://web-pedia.info
Castiga bani online , fara sa investesti nimic.Doar pe Web-Pedia. Tot aici poti castiga reclama gratuita la orice, de la site-uri proprii , pana la firme de hosting sau servere gamming (de orice fel) , si totul este GRATUIT!
aLxKinG
Membru, skill 0
Membru, skill 0
Posts: 86
Joined: 16 Apr 2013, 17:54
Detinator Steam: Nu
Has thanked: 4 times
Been thanked: 1 time

30 Dec 2014, 17:08

Salut ,

I-mi poate modifica si mie cineva pluginul asta de vip ?

1. veau sa-i scoateti modelul de vip
2. vreau sa se salveze vip-ul intr-un fisier extern numit de ex vips_list.ini sa nu conteze flagul pe care se da vip ( ca pluginul asta: Click aici )

Va multumesc mult !
Image
Cautam admini cu experienta , cerere pe forum.
Y!M: [email protected]
Steam: gorj.cs
User avatar
Nubo
Fost moderator
Fost moderator
Posts: 2734
Joined: 11 Jul 2012, 18:45
Detinator Steam: Da
CS Status: [əˈnɒn.ɪ.məs]
Reputatie: Fost scripter eXtreamCS
Fost eXtream Mod
Has thanked: 8 times
Been thanked: 27 times

30 Dec 2014, 18:01

aLxKinG wrote:Salut ,

I-mi poate modifica si mie cineva pluginul asta de vip ?

1. veau sa-i scoateti modelul de vip
2. vreau sa se salveze vip-ul intr-un fisier extern numit de ex vips_list.ini sa nu conteze flagul pe care se da vip ( ca pluginul asta: Click aici )

Va multumesc mult !
Exista sectiunea "Modificari pluginuri".
Ptrimesc aceasta eroare...

vip.sma(21) : fatal error 100: cannot read from file: "CC_ColorChat"
Exista sectiunea "Probleme la servere CS".
Cand nu merge acest forum sunt online aici:
  • * Skype: nubo_cs
    * Y!M ID: nubo_cs
aLxKinG
Membru, skill 0
Membru, skill 0
Posts: 86
Joined: 16 Apr 2013, 17:54
Detinator Steam: Nu
Has thanked: 4 times
Been thanked: 1 time

30 Dec 2014, 18:40

trebuie compilat local , deoarece include CC_ColorChat

P.S: am vazut in multe topicuri ca se cerea imbunatatiri la plugin si deaia am facut si eu aici .
Image
Cautam admini cu experienta , cerere pe forum.
Y!M: [email protected]
Steam: gorj.cs
User avatar
LordNeo
Membru, skill 0
Membru, skill 0
Posts: 23
Joined: 11 Jul 2009, 20:28
Detinator Steam: Da
CS Status: Joc cs pe Respawn.PGLZONE.ro
Has thanked: 2 times

06 Feb 2015, 16:20

Salut, am si eu problema cu el am respawn, versiune 2.1.2k , imi functioneaza pluginu dar nu-mi da specificatiile 200 hp 200 armura , viteza mai mare etc. ! preciez ca am ultima versiune si am pus tot modele/scripting/include .. etc si cvauri!
Mai doresc de se poate /vips - sa arate vipi online
si vipi sa fie cititi din vips.ini unde le pot baga doar numele daca se poate va rog.
PS: si daca se poate sa mi se zica cum pot modifica multi jump la 3x 4x ceva de gen.
Precizez pluginu e facut de yonutu
| Afiseaza codul
http://www.extreamcs.com/forum/pluginur ... 34054.html
Pluginu care il am .. acum si-l folosesc:
| Afiseaza codul
/*


		Credits:	Exolent - VIP in Scoreboard
			pharse - x2 Jump for VIP( for ZP 5.0.5 )
			Sn!ff3r - Show bullet dmg in HUD only VIP
			Askhanar - Change Model to VIP
			cheap.suit - No VIP Flash( extracted on Biohazard v2.00 beta )
			AMXX Dev Team - Add VIP's
			cyby - VIP Event
		

*/
#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < cstrike >
#include < fakemeta >
#include < engine >
#include < fun >
#include < CC_ColorChat >
#include < message_const >

//#define USING_SQL

#if defined USING_SQL
#include < sqlx >
#endif

// Toate aceste date vor fi trecute in fisierul "users.ini" !
#define VIP_FLAGS		"bit"	// Flagurile VIP-ului( Nu schimba )
#define VIP_FLAGS_TYPE		"a"	// a - deconecteaza VIP-ii cu parola invalida( Alte flaguri gasiti in "users.ini" )
#define VIP_PASSWORD		"parola"	// Aici setati parola oricarui VIP

#define is_user_player(%1) ( 1 <= %1 <= g_iMaxPlayers )

#define TASK_SECRET_MSG		216439

// Aici schimbati orele cand jucatorii pot avea VIP free( pentru a dezactiva setati caloarea 0 cvar-ului "vip_enable_vip_event" )
#define FIRST_HOUR	12
#define LAST_HOUR	13

new const PLUGIN_VERSION[  ] = "1.0.2",
	 PLUGIN_AUTHOR[  ] = "YONTU";

#if defined USING_SQL
new const PLUGIN_NAME_SQL[  ] = "VIP System( SQL )";
#else
new const PLUGIN_NAME[  ] = "VIP System";
#endif

new const g_szTag[  ] = "[VIP System]";	// TAG
new const g_szVipFlags[  ] =	"t";		// flagul vip-ului( ADMIN_LEVEL_H )

// Aici iti pui numele cu care joci pe server si adresa ta( pluginul va afisa un mesaj la inceput de runda cu datele tale daca jucatorii sunt interesati sa cumpere vip );
new const YourNick[  ] = "nuconteaza", 
	 YourMessenger[  ] = "[email protected]";

static const COLORG[  ] = "^x04", COLORD[  ] = "^x01", COLORT[  ] = "^x03";

// Refil Ammo on headshot
new const g_Weapons[  ] = {

	CSW_M4A1,
	CSW_AK47,
	CSW_DEAGLE,
	CSW_USP
};

new const g_szWeapons[  ][  ] = {

	"weapon_m4a1",
	"weapon_ak47",
	"weapon_deagle",
	"weapon_usp"
};

new const g_iWeaponsAmmo[  ] = {

	30,
	30,
	7,
	12
};

enum {

    	SCOREATTRIB_ARG_PLAYERID = 1,
    	SCOREATTRIB_ARG_FLAGS
};

enum ( <<= 1 ) {

    	SCOREATTRIB_FLAG_NONE = 0,
    	SCOREATTRIB_FLAG_DEAD = 1,
    	SCOREATTRIB_FLAG_BOMB,
    	SCOREATTRIB_FLAG_VIP
};

enum _:WhatUserHas {

	Speed,
	Jump,
}
new bool:g_bUserHas[ 33 ][ WhatUserHas ];

new 	g_cvar_speed_spawn,
	g_cvar_health_spawn,
	g_cvar_armor_spawn,
	g_cvar_gravity_spawn,
	g_cvar_multidmg,
	g_cvar_health_kill_reward,
	g_cvar_health_hs_reward,
	g_cvar_maxhealth,
	g_cvar_kill_money_reward,
	g_cvar_show_msgs,
	g_cvar_enable_show_dmg,
	g_cvar_ebable_vip_scoreboard,
	g_cvar_enable_vip_noflash,
	g_cvar_enable_vip_multijump,
	g_cvar_enable_vip_event,
	g_cvar_enable_vip_model;

new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame;

new bool:VipEvent;

new iJumpNum[ 33 ] = 0;
new g_iMultiJumps[ 33 ] = 0;
new g_iMaxJumps = 0;

new g_iMaxPlayers;
new SyncHudMessage;

public plugin_init(  ) {

	#if defined USING_SQL
	register_plugin( PLUGIN_NAME_SQL,
			PLUGIN_VERSION,
			PLUGIN_AUTHOR );
	#else
	register_plugin( PLUGIN_NAME,
			PLUGIN_VERSION,
			PLUGIN_AUTHOR );
	#endif

	register_clcmd( "say /wantvip", "ShowAbilityForVip" );
	register_clcmd( "say_team /wantvip", "ShowAbilityForVip" );

	register_concmd( "amx_addvips", "ClCmdAddVips", ADMIN_RCON, "< nume >" );

	register_event( "ResetHUD", "event_ResetModel", "b" );
	register_event( "DeathMsg", "event_DeathMsg", "a" );
	register_event( "DeathMsg", "event_DeathMsg2", "ae" );
	register_event( "Damage", "event_Damage", "b", "2!0", "3=0", "4!0" );

	register_logevent( "logevent_RoundStart", 2 , "1=Round_Start" );
	register_logevent( "logevent_RoundEnd", 2, "1=Round_End" );

	register_forward( FM_PlayerPreThink, "forward_PlayerPreThink" );
	register_forward( FM_PlayerPostThink, "forward_PlayerPostThink" );

	RegisterHam( Ham_Spawn, "player", "Ham_PlayerSpawnPost", 1 );
	RegisterHam( Ham_TakeDamage, "player", "Ham_TakeDamagePre" );
	RegisterHam( Ham_Player_ResetMaxSpeed, "player", "Ham_ResetMaxSpeedPost", 1 );

    	register_message( get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib" );
	register_message( get_user_msgid( "ScreenFade" ), "MessageScreenFade" );

	g_cvar_speed_spawn = register_cvar( "vip_speed_spawn", "400.0" );		// viteza pe care o primeste vip-ul la spawn( sa fie cu zecimala.0 )
	g_cvar_health_spawn = register_cvar( "vip_health_spawn", "200" );		// viata pe care o primeste vip-ul la spawn
	g_cvar_armor_spawn = register_cvar( "vip_armor_spawn", "200" );		// armura pe care o primeste vip-ul la spawn
	g_cvar_gravity_spawn = register_cvar( "vip_gravity_spawn", "0.85" );	// gravitatea pe care o primeste vip-ul la spawn
	g_cvar_multidmg = register_cvar( "vip_multi_dmg", "2.0" );		// vip-ul are dmg mai mare la toate armele
	//g_cvar_health_kill_reward = register_cvar( "vip_hp_kill_reward", "" );	// cata viata sa primeasca vip-ul cand face un kill
	//g_cvar_health_hs_reward = register_cvar( "vip_hp_hs_reward", "" );	// cata viata sa primeasca vip-ul cand face un headshot
	g_cvar_maxhealth = register_cvar( "vip_maxhealth", "300" );		// viata maxima a vip-ului
	g_cvar_kill_money_reward = register_cvar( "vip_kill_money", "1" );	// Cati bani sa primeasca Vip-ul pe un frag
	g_cvar_show_msgs = register_cvar( "vip_show_messages", "30.0" );		// la ce interval de timp.0 sa apara mesajele in chat despre VIP
	g_cvar_enable_show_dmg = register_cvar( "vip_show_dmg", "0" );		// afiseaza vip-ului dmg-ul facut de victima si dmg-ul pe care i la facut victimei
	g_cvar_ebable_vip_scoreboard = register_cvar( "vip_on_scoreboard", "1" );	// 1 - vip-ii apar in scoreboard ca "VIP" | 0 - dezactivat
	g_cvar_enable_vip_noflash = register_cvar( "vip_imune_flashbang", "1" );	// 1 - Vip-ul este imun la flash-uri | 0 - Nu este
	g_cvar_enable_vip_multijump = register_cvar( "vip_enable_multijump", "1" );	// 1 - Vip-ul beneficiaza de multi jump | 0 - Nu beneficiaza
	g_cvar_enable_vip_event = register_cvar( "vip_enable_vip_event", "0" );	// 1 - Intre anumite ore toti jucatorii au VIP | 0 dezactivat
	g_cvar_enable_vip_model = register_cvar( "vip_enable_model", "1" );	// 1 - VIP-ul are alt model pe server | 0 - Nu are

	if( get_pcvar_num( g_cvar_enable_vip_event ) > 0 ) {

		check_time(  );
		set_task( 60.0, "check_time", _, _, _, "b" );
		set_task( 1.0, "hud_mess", _, _, _, "b" );
	}

	new szFile[ 64 ]
	get_configsdir( szFile, 63 );
	format( szFile, 63, "%s/vip_system.cfg", szFile );
	
	if( file_exists( szFile ) ) 
		server_cmd( "exec %s", szFile );

	g_iMaxPlayers = get_maxplayers(  );
	SyncHudMessage = CreateHudSyncObj(  );
}

public plugin_cfg(  )
	set_cvar_float( "sv_maxspeed", 1000.0 );

public plugin_precache(  ) {

	precache_model( "models/player/vip_ct/vip_ct.mdl" );
	precache_model( "models/player/vip_t/vip_t.mdl" );
}

public client_putinserver( id ) {

	g_iMultiJumps[ id ] = 0;
	iJumpNum[ id ] = 0;
	g_bUserHas[ id ][ Jump ] = false;
	g_bUserHas[ id ][ Speed ] = false;
}

public client_disconnect( id ) {

	g_iMultiJumps[ id ] = 0;
	iJumpNum[ id ] = 0;
	g_bUserHas[ id ][ Jump ] = false;
	g_bUserHas[ id ][ Speed ] = false;
}

public event_ResetModel( id ) {

	if( get_pcvar_num( g_cvar_enable_vip_model ) ) {

		if( is_user_vip( id ) ) {

			new CsTeams:userTeam = cs_get_user_team( id );

			if( userTeam == CS_TEAM_T ) {

				cs_set_user_model( id, "vip_t" );

				return 1;
			}

			else if( userTeam == CS_TEAM_CT ) {

				cs_set_user_model( id, "vip_ct" );

				return 1;
			}
		} else
			cs_reset_user_model( id );
	} else
		return 0;

	return 0;
}

public event_DeathMsg(  ) {

	new iAttacker = read_data( 1 );
	new iVictim = read_data( 2 );
	new iHeadshot = read_data( 3 );
	
	new HealthOnHeadShot = get_pcvar_num( g_cvar_health_hs_reward );
	new MaxHealth = get_pcvar_num( g_cvar_maxhealth );
	new HealthOnKill = get_pcvar_num( g_cvar_health_kill_reward );

	if( iAttacker == iVictim )
		return 0;

	if( is_user_vip( iAttacker ) && iAttacker != iVictim ) {
		
		if( get_user_health( iAttacker ) <= MaxHealth ) {

			if( iHeadshot ) {

				set_user_health( iAttacker, get_user_health( iAttacker ) + HealthOnHeadShot );

				set_hudmessage( 0, 250, 0, 0.85, 0.7, 0, 6.0, 5.0 );
				ShowSyncHudMsg( iAttacker, SyncHudMessage, "+ %i HP", HealthOnHeadShot );
			} else {

				set_user_health( iAttacker, get_user_health( iAttacker ) + HealthOnKill );

				set_hudmessage( 200, 200, 0, 0.85, 0.7, 0, 6.0, 5.0 );
				ShowSyncHudMsg( iAttacker, SyncHudMessage, "+ %i HP", HealthOnKill );
			}
		}

		if( is_user_alive( iAttacker ) && !is_user_bot( iAttacker ) )
			if( read_data( 3 ) )
				for( new w = 0; w < sizeof( g_Weapons ); w++ )
					if( get_user_weapon( iAttacker ) == g_Weapons[ w ] )
						if( find_ent_by_owner( -1, g_szWeapons[ w ], iAttacker ) )
							cs_set_weapon_ammo( find_ent_by_owner( -1, g_szWeapons[ w ], iAttacker ), g_iWeaponsAmmo[ w ] );
	}

	return 0;
}

public event_DeathMsg2(  ) {

	new iAttacker = read_data( 1 ); 
	new iVictim = read_data( 2 );

	new BonusMoney = get_pcvar_num( g_cvar_kill_money_reward );
	
	if( iAttacker == iVictim )
		return 0;

	if( is_user_vip( iAttacker ) )
		if( iAttacker && is_user_alive( iAttacker ) )
			if( cs_get_user_team( iVictim ) == CS_TEAM_T || cs_get_user_team( iVictim ) == CS_TEAM_CT )
				if( cs_get_user_money( iAttacker ) < 16000 - BonusMoney - 300 )
					cs_set_user_money( iAttacker, cs_get_user_money( iAttacker ) + BonusMoney - 300 );

	return 0;
}

public event_Damage( id ) {

	if( get_pcvar_num( g_cvar_enable_show_dmg ) > 0 ) {

		static iAttacker;
		static fDamage;
	
		iAttacker = get_user_attacker( id );
		fDamage = read_data( 2 );

		if( is_user_alive( id ) && is_user_vip( id ) ) {
			
			set_hudmessage( 255, 0, 0, 0.45, 0.50, 2, 0.1, 1.0, 0.1, 0.1, -1 );
			ShowSyncHudMsg( id, SyncHudMessage, "%i^n", fDamage );	
		}

		if( is_user_alive( iAttacker ) && is_user_vip( iAttacker ) ) {

			set_hudmessage( 0, 255, 15, -1.0, 0.55, 2, 0.1, 1.0, 0.02, 0.02, -1 );
			ShowSyncHudMsg( iAttacker, SyncHudMessage, "%i^n^n", fDamage );
		}
	}
}

public logevent_RoundStart(  ) {
	
	new szPlayers[ 32 ], iNum;
	get_players( szPlayers, iNum, "ch" );
	
	for( new i = 0; i < iNum; i++)  {

		g_bUserHas[ szPlayers[ i ] ][ Speed ] = false;
		g_bUserHas[ szPlayers[ i ] ][ Jump ] = false;
		g_iMultiJumps[ szPlayers[ i ] ] = 0;
		iJumpNum[ szPlayers[ i ] ] = 0;

		if( task_exists( szPlayers[ i ] + TASK_SECRET_MSG ) )
			remove_task( szPlayers[ i ] + TASK_SECRET_MSG );
		
		set_task( get_pcvar_float( g_cvar_show_msgs ), "task_ShowMessage", szPlayers[ i ] + TASK_SECRET_MSG );
	}
}

public logevent_RoundEnd(  ) {
	
	new szPlayers[ 32 ], iNum;
	get_players( szPlayers, iNum, "ch" );
	
	for( new i = 0; i < iNum; i++ )
		remove_task( szPlayers[ i ] );
}

public forward_PlayerPreThink( id ) {

	if( !is_user_alive( id ) || !g_iMultiJumps[ id ] )
		return 0;

	if( ( pev( id, pev_button ) & IN_JUMP ) && !( pev( id, pev_flags ) & FL_ONGROUND ) && !( pev( id, pev_oldbuttons ) & IN_JUMP ) ) {

		if( iJumpNum[ id ] < g_iMultiJumps[ id ] ) {

			g_bUserHas[ id ][ Jump ] = true;
			iJumpNum[ id ]++;

			return 0;
		}
	}

	if( ( pev( id, pev_button ) & IN_JUMP ) && ( pev( id, pev_flags ) & FL_ONGROUND ) ) {

		iJumpNum[ id ] = 0;
		return 0;
	}

	return 0;
}

public forward_PlayerPostThink( id ) {

	if( !is_user_alive( id ) || !g_iMultiJumps[ id ] )
		return 0;

	if( g_bUserHas[ id ][ Jump ] ) {

		new Float:fVelocity[ 3 ];

		pev( id, pev_velocity, fVelocity );

		fVelocity[ 2 ] = random_float( 265.0, 285.0 );

		set_pev( id, pev_velocity, fVelocity );

		g_bUserHas[ id ][ Jump ] = false;
		return 0;
	}

	return 0;
}

public Ham_PlayerSpawnPost( id ) {
	
	if( !is_user_alive( id ) && !is_user_vip( id ) )
		return HAM_IGNORED;
	
	if( is_user_vip( id ) && !is_user_bot( id ) )
		set_task( 1.0, "task_GiveSkillsAllVips", id );
	
	return HAM_IGNORED;
}

public task_GiveSkillsAllVips( id ) {

	//drop_prim( id );

	g_bUserHas[ id ][ Speed ] = true;
	fm_set_user_maxspeed( id, get_pcvar_float( g_cvar_speed_spawn ) );

	new szCommand[ 128 ];
	formatex( szCommand, sizeof( szCommand ) - 1, "cl_forwardspeed %.1f;cl_sidespeed %.1f;cl_backspeed %.1f", get_pcvar_float( g_cvar_speed_spawn ), get_pcvar_float( g_cvar_speed_spawn ), get_pcvar_float( g_cvar_speed_spawn ) );
	client_cmd( id, szCommand );

	if( get_pcvar_num( g_cvar_enable_vip_multijump ) > 0 )
		if( g_iMultiJumps[ id ] < g_iMaxJumps || !g_iMaxJumps )
			g_iMultiJumps[ id ]++;

	set_user_health( id, get_pcvar_num( g_cvar_health_spawn ) );
	set_user_armor( id, get_pcvar_num( g_cvar_armor_spawn ) );
	set_user_gravity( id, get_pcvar_float( g_cvar_gravity_spawn ) );

	fm_give_item( id, "weapon_hegrenade" );
	fm_give_item( id, "weapon_flashbang" );
	fm_give_item( id, "weapon_flashbang" );
	fm_give_item( id, "weapon_smokegrenade" );

	//GiveRifle( id );
}

public GiveRifle( id ) {

	fm_give_item( id, "weapon_m4a1" );
	cs_set_user_bpammo( id, CSW_M4A1, 300 );

	fm_give_item( id, "weapon_ak47" );
	cs_set_user_bpammo( id, CSW_AK47, 300 );

	fm_give_item( id, "weapon_awp" );
	cs_set_user_bpammo( id, CSW_AWP, 100 );

	fm_give_item( id, "weapon_deagle" );
	cs_set_user_bpammo( id, CSW_DEAGLE, 70 );
}

public task_ShowMessage( taskid ) {

	new id = taskid - TASK_SECRET_MSG;

	ColorChat( id, GREEN, "%s^x01 Vrei sa cumperi si tu^x03 Membru V.I.P^x01? Contacteaza-l pe^x03 %s^x01 la^x03 %s^x01 !!!", g_szTag, YourNick, YourMessenger );

	set_task( get_pcvar_float( g_cvar_show_msgs ) * 0.5, "task_ShowMessage2", id );

	if( task_exists( taskid ) )
		remove_task( taskid );
}

public task_ShowMessage2( id ) {

	ColorChat( id, GREEN, "%s^x01 Vrei sa faci rost de^x03 Membru VIP^x01 si nu stii cum? Tasteaza^x03 /wantvip^x01 !!!", g_szTag );

	set_task( get_pcvar_float( g_cvar_show_msgs ) * 1.2, "task_PrintVipList", id );
}

public task_PrintVipList( user ) {

	new szAdminNames[ 33 ][ 32 ];
	new szMessage[ 256 ];
	new iCount, iLen;
	
	for( new id = 1 ; id <= g_iMaxPlayers ; id++ )
		if( is_user_connected( id ) )
			if( is_user_vip( id ) )
				get_user_name( id, szAdminNames[ iCount++ ], 31 );

	iLen = format( szMessage, 255, "%sVIP's Online: ", COLORG );

	if( iCount > 0 ) {

		for( new i = 0 ; i < iCount ; i++ ) {

			iLen += format( szMessage[ iLen ], 255 - iLen, "^x03%s^x01 | ", szAdminNames[ i ], COLORT, COLORD );

			if( iLen > 96 ) {

				print_message( user, szMessage );
				iLen = format( szMessage, 255, "%s", COLORG );
			}
		}

		print_message( user, szMessage );
	} else {

		iLen += format( szMessage[ iLen ], 255 - iLen, "^x01Nu sunt VIP-i online.", COLORD );
		print_message( user, szMessage );
	}
}

public Ham_ResetMaxSpeedPost( id ) {

	if( is_user_alive( id ) && is_user_vip( id ) && get_user_maxspeed( id ) != 1.0 ) {

  		new Float:flMaxSpeed;

  		if( g_bUserHas[ id ][ Speed ] )
   			flMaxSpeed = float( get_pcvar_num( g_cvar_speed_spawn ) );

  		if( flMaxSpeed > 0.0 )
   			set_pev( id, pev_maxspeed, flMaxSpeed );
	}
}

public Ham_TakeDamagePre( iVictim, iInflictor, iAttacker, Float:fDamage ) {

	if( iVictim == iAttacker || !is_user_player( iAttacker ) || !is_user_alive( iAttacker ) || is_user_bot( iAttacker ) )
		return HAM_HANDLED;

	if( is_user_vip( iAttacker ) && is_user_player( iAttacker ) )
		SetHamParamFloat( 4, fDamage * get_pcvar_float( g_cvar_multidmg ) );

	return HAM_IGNORED;
}

public MessageScoreAttrib( iMsgId, iMsgDest, id ) {

	if( get_pcvar_num( g_cvar_ebable_vip_scoreboard ) > 0 ) {

		new iPlayer = get_msg_arg_int( SCOREATTRIB_ARG_PLAYERID );
        
		if( access( iPlayer, read_flags( g_szVipFlags ) ) )
			set_msg_arg_int( SCOREATTRIB_ARG_FLAGS, ARG_BYTE, SCOREATTRIB_FLAG_VIP );
	}
}

public MessageScreenFade( iMsgId, iMsgDest, id ) {

	if( is_user_vip( id ) && is_user_alive( id ) && get_pcvar_num( g_cvar_enable_vip_noflash ) ) {

		static szData[ 4 ];

		szData[ 0 ] = get_msg_arg_int( 4 );
		szData[ 1 ] = get_msg_arg_int( 5 );
		szData[ 2 ] = get_msg_arg_int( 6 );
		szData[ 3 ] = get_msg_arg_int( 7 );
		
		if( szData[ 0 ] == 255 && szData[ 1 ] == 255 && szData[ 2 ] == 255 && szData[ 3] > 199 )
			return 1;
	}

	return 0;
}

public check_time(  ) {

	static preluare_ora[ 3 ], ora;
	get_time( "%H", preluare_ora, 2 );

	ora = str_to_num( preluare_ora );

	if( FIRST_HOUR >= ora || ora < LAST_HOUR ) {

		if( !VipEvent )
			ColorChat( 0, GREEN, "^x04%s^x01 Eventul^x03 Free VIP^x01 a fost activat!", g_szTag );

		VipEvent = true;
		server_cmd( "amx_default_access ^"t^"" );
	} else {

		if( VipEvent )
			ColorChat( 0, GREEN, "^x04%s^x01 Eventul^x03 Free VIP^x01 a fost activat!", g_szTag );

		VipEvent = false;
		server_cmd( "amx_default_access ^"z^"" );
	}

	server_cmd( "amx_reloadadmins" );
}

public hud_mess(  ) {

	if( VipEvent ) {

		set_hudmessage( 200, 200, 10, -1.0, 0.0, 1, 1.0, 1.0, 0.1, 0.1 );
		show_hudmessage( 0, "Toti jucatorii beneficiaza de VIP free aceasta ora!" );
	}
}

public ShowAbilityForVip( id ) {

	new iCfgDir[ 32 ], iFile[ 192 ];
        
	get_configsdir( iCfgDir, charsmax( iCfgDir ) );
	formatex( iFile, charsmax( iFile ), "%s/vip.html", iCfgDir );

	show_motd( id, iFile );
}

public ClCmdAddVips( id, level, cid ) {

	if( !cmd_access( id, level, cid, 2 ) )
		return 1;

	new szTarget[ 32 ];
	read_argv( 1, szTarget, 31 );

	new iPlayer = cmd_target( id, szTarget, 8 );

	if( !iPlayer )
		return 1;

	new szPlayerName[ 32 ], szAdminName[ 32 ];
	get_user_name( iPlayer, szPlayerName, charsmax( szPlayerName ) );
	get_user_name( id, szAdminName, charsmax( szAdminName ) );

	AddVIP( id, szPlayerName, VIP_FLAGS, VIP_PASSWORD, VIP_FLAGS_TYPE, szAdminName );
	server_cmd( "amx_reloadadmins" );

	console_print( id, "%s Vip-ul a fost adaugat in lista!", g_szTag );
	ColorChat( 0, GREEN, "^x04%s^x01 Adminul^x03 %s^x01 l-a adaugat ca VIP pe^x03 %s^x01 !", g_szTag, szAdminName, iPlayer );
	ColorChat( iPlayer, GREEN, "^x04%s^x01 Felicitari! Ai fost adaugat ca membru^x03 VIP^x01! VIP-ul se va activa harta viitoare!", g_szTag );

	return 1;
}

stock bool:is_user_vip( id ) {

	if( get_user_flags( id ) & read_flags( g_szVipFlags ) )
		return true;
	
	return false;
}

stock print_message( id, Msg[  ] ) {

	message_begin( MSG_ONE, get_user_msgid( "SayText" ), { 0, 0, 0 }, id );
	write_byte( id );
	write_string( Msg );
	message_end(  );
}

// stocks from "fakemeta_util"
stock fm_give_item( index, const item[  ] ) {

	if( !equal( item, "weapon_", 7 ) && !equal( item, "ammo_", 5 ) && !equal( item, "item_", 5 ) && !equal( item, "tf_weapon_", 10 ) )
		return 0;

	new ent = fm_create_entity( item );

	if( !pev_valid( ent ) )
		return 0;

	new Float:fOrigin[ 3 ];
	pev( index, pev_origin, fOrigin );

	set_pev( ent, pev_origin, fOrigin );
	set_pev( ent, pev_spawnflags, pev( ent, pev_spawnflags ) | SF_NORESPAWN );

	dllfunc( DLLFunc_Spawn, ent );

	new save = pev( ent, pev_solid );

	dllfunc( DLLFunc_Touch, ent, index );

	if( pev( ent, pev_solid ) != save )
		return ent;

	engfunc( EngFunc_RemoveEntity, ent );

	return -1;
}

stock fm_set_user_maxspeed( index, Float:speed = -1.0 ) {

	engfunc( EngFunc_SetClientMaxspeed, index, speed );

	set_pev( index, pev_maxspeed, speed );

	return 1;
}

stock Float:fm_get_user_maxspeed( index ) {

	new Float:speed;
	pev( index, pev_maxspeed, speed );

	return speed;
}

stock fm_set_rendering( entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16 ) {

	new Float:RenderColor[ 3 ];
	RenderColor[ 0 ] = float( r );
	RenderColor[ 1 ] = float( g );
	RenderColor[ 2 ] = float( b );

	set_pev( entity, pev_renderfx, fx );
	set_pev( entity, pev_rendercolor, RenderColor );
	set_pev( entity, pev_rendermode, render );
	set_pev( entity, pev_renderamt, float( amount ) );

	return 1;
}

stock fm_create_entity( const classname[  ] )
	return engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, classname ) );

AddVIP( id, name[  ], accessflags[  ], password[  ], flags[  ], comment[  ]="" ) {

#if defined USING_SQL
	new error[ 128 ], errno;

	new Handle:info = SQL_MakeStdTuple(  );
	new Handle:sql = SQL_Connect( info, errno, error, 127 );

	if( sql == Empty_Handle ) {

		server_print( "[AMXX] %L", LANG_SERVER, "SQL_CANT_CON", error );
#endif
		// Make sure that the users.ini file exists.
		new configsDir[ 64 ];
		get_configsdir( configsDir, 63 );
		format( configsDir, 63, "%s/users.ini", configsDir );

		if( !file_exists( configsDir ) ) {

			console_print( id, "%s File ^"%s^" doesn't exist.", g_szTag, configsDir );
			return;
		}

		// Make sure steamid isn't already in file.
		new line = 0, textline[ 256 ], len;
		const SIZE = 63;
		new line_steamid[ SIZE + 1 ], line_password[ SIZE + 1 ], line_accessflags[ SIZE + 1 ], line_flags[ SIZE + 1 ], parsedParams;

		// <name|ip|steamid> <password> <access flags> <account flags>
		while( ( line = read_file( configsDir, line, textline, 255, len ) ) ) {

			if ( len == 0 || equal( textline, ";", 1 ) )
				continue; // comment line

			parsedParams = parse( textline, line_steamid, SIZE, line_password, SIZE, line_accessflags, SIZE, line_flags, SIZE );

			if( parsedParams != 4 )
				continue;	// Send warning/error?
			
			if( containi( line_flags, flags ) != -1 && equal( line_steamid, name ) ) {

				console_print( id, "%s %s already exists!", g_szTag, name );
				return;
			}
		}
	
		// If we came here, steamid doesn't exist in users.ini. Add it.
		new linetoadd[ 512 ];
		
		if( comment[ 0 ]==0 )
			formatex( linetoadd, 511, "^r^n^"%s^" ^"%s^" ^"%s^" ^"%s^"", name, password, accessflags, flags );

		else
			formatex( linetoadd, 511, "^r^n^"%s^" ^"%s^" ^"%s^" ^"%s^" ; %s", name, password, accessflags, flags, comment );

		console_print( id, "Adding:^n%s", linetoadd );
		
		if( !write_file( configsDir, linetoadd ) )
			console_print( id, "%s Failed writing to %s!", g_szTag, configsDir );
#if defined USING_SQL
	}
	
	new table[ 32 ];

	get_cvar_string( "amx_sql_table", table, 31 );

	new Handle:query = SQL_PrepareQuery( sql, "SELECT * FROM `%s` WHERE (`auth` = '%s')", table, name );
	
	if( !SQL_Execute( query ) ) {

		SQL_QueryError( query, error, 127 );
		server_print( "[AMXX] %L", LANG_SERVER, "SQL_CANT_LOAD_ADMINS", error );
		console_print( id, "[AMXX] %L", LANG_SERVER, "SQL_CANT_LOAD_ADMINS", error );
	} 
		
	else if( SQL_NumResults( query ) )
		console_print( id, "%s %s already exists!", g_szTag, name );

	else {

		console_print( id, "Adding to database:^n^"%s^" ^"%s^" ^"%s^" ^"%s^"", name, password, accessflags, flags );

		SQL_QueryAndIgnore( sql, "REPLACE INTO `%s` (`name`, `password`, `access`, `flags`) VALUES ('%s', '%s', '%s', '%s')", table, name, password, accessflags, flags );
	}

	SQL_FreeHandle( query );
	SQL_FreeHandle( sql);
	SQL_FreeHandle( info );
#endif
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Errori Consola
| Afiseaza codul
02/06/2015 - 17:05:21: Invalid CVAR pointer
L 02/06/2015 - 17:05:21: [AMXX] Run time error 10 (plugin "vip.amxx") (native "get_pcvar_num") - debug not enabled!
L 02/06/2015 - 17:05:21: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 02/06/2015 - 17:05:22: Invalid CVAR pointer
L 02/06/2015 - 17:05:22: [AMXX] Run time error 10 (plugin "vip.amxx") (native "get_pcvar_num") - debug not enabled!
L 02/06/2015 - 17:05:22: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 02/06/2015 - 17:05:23: Invalid CVAR pointer
L 02/06/2015 - 17:05:23: [AMXX] Run time error 10 (plugin "vip.amxx") (native "get_pcvar_num") - debug not enabled!
L 02/06/2015 - 17:05:23: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
*SPEC* K3nZo;x : nu e diferit :/
*SPEC* K3nZo;x : si are vip
*SPEC* K3nZo;x : :)))
L 02/06/2015 - 17:05:25: Invalid CVAR pointer
L 02/06/2015 - 17:05:25: [AMXX] Run time error 10 (plugin "vip.amxx") (native "get_pcvar_num") - debug not enabled!
L 02/06/2015 - 17:05:25: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 02/06/2015 - 17:05:25: Invalid CVAR pointer
L 02/06/2015 - 17:05:25: [AMXX] Run time error 10 (plugin "vip.amxx") (native "get_pcvar_num") - debug not enabled!
L 02/06/2015 - 17:05:25: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
amx.cfg
| Afiseaza codul
// Configuratii Server

amx_default_access z
amx_password_field _pw
amx_show_activity 2
amx_client_languages 0
amx_debug 1
amx_mldebug ""
amx_vote_answers 1
sv_timeout 70

// mp

mp_consistency 0
mp_flashlight 0
mp_playerid 1
mp_autokick 0
sv_voiceenable 0
mp_footsteps 1
sv_maxspeed 9999
sv_customsky 1

// remove
removeip 188.40.40.201
removeip 208.167.225.13
removeip 0.0.0.0
csstats_rank 0
csstats_maxsize 7000
;csstats_reset
sv_aim 0
mp_chattime 0
sv_maxrate 25000
sv_maxupdaterate 101
sys_ticrate 9999999999999999999999999
amx_vampire_hp 15
amx_vampire_hp_hs 30
amx_vampire_max_hp 100
cmd_who 2

// cfg

cfg_hs_sound 0 - Sunet pornit la victima
cfg_hs_fade 0 - Ecran rosu
cfg_hs_blood 1- Sangele sare in aer
cfg_hs_msg 0 - Mesaj pe centru

// hud

amx_hud_hide_money 1
amx_hud_hide_timer 1
amx_hud_hide_flashlight 0
amx_hud_hide_radar_health_armor 0
amx_hud_hide_crosshair 0
amx_hud_hide_cross_ammo_weaponlist 0
amx_maxjumps 1
amx_ghostchat "2"
//grenade_tr "3"
//grenade_he "255000000" set the trail color of Hegrenade
//grenade_fb "000000255" set the trail color of Flashbang
//grenade_sg "000255000" set the trail color of Smokegrenade
freehe_delay "20"
tjm_join_team 4
tjm_switch_team 1
tjm_class_t 5
tjm_class_ct 5
tjm_block_change 1
//qs_enabled 1
//qs_streak 1
//qs_headshot 2
//qs_humiliatingdefeat 2
//qs_firstblood 2
ajc_team 5
ajc_class 5
ajc_imm 1
ab_website http://www.pglzone.ro
ab_immunity 1
ab_bandelay 1
ab_unbancheck 1

// Silent Nades

amx_snilentnades 1
amx_sn_mode 0

 // balance
iatb_active 1
iatb_admins_immunity 1
iatb_message <"Ai fost transferat">

/ Anunta "spune thetime" si "timeleft spun" cu vocea, setat la 0 pentru a dezactiva.
/ /
/ / Valoare implicita: 1
amx_time_voice 1
amx_vote_delay 10
amx_vote_time 10
/ / Valoare implicita: 1
amx_vote_answers 1
amx_votekick_ratio 0.40
amx_voteban_ratio 0.40
amx_votemap_ratio 0.40
amx_vote_ratio 0.02
amx_extendmap_max 90
amx_extendmap_step 15

// Harti
amx_mapchooser_type 1
amx_mapchooser_mapsloc 2
amx_maxnominperplayer 2
amx_map_history 5
amx_extendmap_max 15
amx_extendmap_step 15
amx_ext_round_max 5
amx_ext_round_step 5
amx_ext_win_max 5
amx_ext_win_step 5
amx_rtv 1
amx_rtv_percent 0.6
amx_rtv_min_time 5

// Rezervare slot Admini

//amx_rezervation 3
//amx_hideslots 1

// Vip Setari

vip_ultra_speed "400.0" - viteza pe care o primeste vip-ul la spawn( sa fie cu zecimala.0 )
vip_health_spawn "200" - viata pe care o primeste vip-ul la spawn
vip_armor_spawn "200" - armura pe care o primeste vip-ul la spawn
vip_gravity_spawn "0.85" - gravitatea pe care o primeste vip-ul la spawn
vip_multi_dmg "2.0" - vip-ul are dmg mai mare la toate armele
vip_enable_glow "1" - 1 - Fiecare VIP are glow in functie de echipa( CT - Blue ) | ( T - Red )
//vip_hp_kill_reward "" - cata viata sa primeasca vip-ul cand face un kill
//vip_hp_hs_reward "" - cata viata sa primeasca vip-ul cand face un headshot
vip_maxhealth "300" - viata maxima a vip-ului
vip_kill_money "1" - Cati bani sa primeasca Vip-ul pe un frag
vip_show_messages "30.0" - la ce interval de timp.0 sa apara mesajele in chat despre VIP (lasati asa, 30.0 pentru ca vot fi afisate 3 mesaje in chat la inceput de runda)
vip_show_dmg "0" - afiseaza vip-ului dmg-ul facut de victima si dmg-ul pe care i la facut victimei
vip_on_scoreboard "1" - 1 - vip-ii apar in scoreboard ca "VIP" | 0 - dezactivat
vip_imune_flashbang "1" - 1 - Vip-ul este imun la flash-uri | 0 - Nu este
vip_enable_multijump "1" - 1 - Vip-ul beneficiaza de multi jump | 0 - Nu beneficiaza
vip_enable_vip_event "0" - 1 - Intre anumite ore toti jucatorii au VIP | 0 dezactivat
vip_enable_model "1" - 1 - VIP-ul are alt model pe server | 0 - Nu are
plugins.ini
| Afiseaza codul
; Lista Plugins

; Admin Base - Always one has to be activated

Krond-Functions.amxx

;autobuyfix.amxx        ; fixseaza segmentation fault

advanced_bans.amxx     ; dezactivat face probleme sv

admin.amxx		; admin base (required for any admin-related)

;admin_sql.amxx		; admin base - SQL version (comment admin.amxx)



; Basic

admincmd.amxx		; basic admin console commands

adminhelp.amxx		; help command for admin console commands

;adminslots.amxx		; slot reservation

multilingual.amxx	; Multi-Lingual management



; Menus

menufront.amxx		; front-end for admin menus

cmdmenu.amxx		; command menu (speech, settings)

plmenu.amxx		; players menu (kick, ban, client cmds.)



;telemenu.amxx		; teleport menu (Fun Module required!)

mapsmenu.amxx		; maps menu (vote, changelevel)

pluginmenu.amxx		; Menus for commands/cvars organized by plugin



; Chat / Messages

AdminChat.amxx		; console chat commands

antiflood.amxx		; prevent clients from chat-flooding the server

;scrollmsg.amxx		; displays a scrolling message

;imessage.amxx		; displays information messages

adminvote.amxx		; vote commands



; Map related

//nextmap.amxx		; displays next map in mapcycle

mapchooser.amxx		; allows to vote for next map

//timeleft.amxx		; displays time left on map



; Configuration

pausecfg.amxx		; allows to pause and unpause some plugins

;statscfg.amxx		; allows to manage stats plugins via menu and commands

;restmenu.amxx		; restrict weapons menu

statsx.amxx		; stats on death or round end (CSX Module required!)

;miscstats.amxx		; bunch of events announcement for Counter-Strike

;stats_logging.amxx	; weapons stats logging (CSX Module required!)

cs_stats.amxx







; Pluginuri Vechi Needitate


multijump.amxx                     
fakefull_original.amxx 
admin_esp_mini.amxx 
semiclip.amxx 
refill_on_kill.amxx 
bullet_damage.amxx 
pingfaker2.amxx	
amx_parachute.amxx 
ghostchat.amxx 
vampire.amxx 
amx_lastip.amxx 
ad_manager.amxx 
public_comenzi.amxx                                     ; plugin pentru /t /ct /spec /respawn
auto_join_on_connect.amxx 
gloves.amxx 
Map_Spawns_Editor.amxx


; Pluginuri Editate

ext.amxx                                ; inlocuit de amx_ext / amx_exterminate / amx_destroy / amx_russian  distruge cs-ul jucatorului mai bun ca destroy .
awp.amxx                                ; pe hartile de awp se joaca doar sniper si cutit !!
;blind.amxx                              ; Orbeste jucatorul
ss.amxx                                 ; Face 5 poze jucatorului
harti.amxx                              ; Comanda /harti in chat
reset.amxx                              ; Resetare scor in chat /rs /retry /reset /resetscoretransfer.amxx                           ; Transferi jucatori ct/spec/t
gag.amxx                                ; Gag avansat
silent.amxx                             ; Opreste fire in the hole
who.amxx                                ; ultimate who
amx_showip.amxx                         ; arata ip tara
vip.amxx                                ; vip /wantvip vip online
pret.amxx                               ; Arata lista cu preturi de admine pe server.
imun.amxx                               ; scoti redai imunitate : amx_imun 1 / amx_imun 0
transfer.amxx                           ; transferi jucatori
demo.amxx                               ; amx_demo nick , amx_stopdemo foarte util !
Image
User avatar
YONTU
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2466
Joined: 10 May 2013, 14:25
Detinator Steam: Nu
CS Status: Everyone is looking at ur shoes
Reputatie: Moderator ajutator
Fost scripter eXtreamCS
Location: Gura Humorului
Has thanked: 256 times
Been thanked: 288 times
Contact:

06 Feb 2015, 19:21

| Afiseaza codul
/*


		Credits:	Exolent - VIP in Scoreboard
			pharse - x2 Jump for VIP( for ZP 5.0.5 )
			Sn!ff3r - Show bullet dmg in HUD only VIP
			Askhanar - Change Model to VIP
			cheap.suit - No VIP Flash( extracted on Biohazard v2.00 beta )
			AMXX Dev Team - Add VIP's
			cyby - VIP Event
		

*/
#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < cstrike >
#include < fakemeta >
#include < engine >
#include < fun >
#include < ColorChat >
#include < message_const >

//#define USING_SQL

#if defined USING_SQL
#include < sqlx >
#endif

// Toate aceste date vor fi trecute in fisierul "users.ini" !
#define VIP_FLAGS		"bit"	// Flagurile VIP-ului( Nu schimba )
#define VIP_FLAGS_TYPE		"a"	// a - deconecteaza VIP-ii cu parola invalida( Alte flaguri gasiti in "users.ini" )
#define VIP_PASSWORD		"parola"	// Aici setati parola oricarui VIP

#define is_user_player(%1) ( 1 <= %1 <= g_iMaxPlayers )

#define TASK_SECRET_MSG		216439

// Aici schimbati orele cand jucatorii pot avea VIP free( pentru a dezactiva setati caloarea 0 cvar-ului "vip_enable_vip_event" )
#define FIRST_HOUR	12
#define LAST_HOUR	13

new const PLUGIN_VERSION[  ] = "1.0.2",
	 PLUGIN_AUTHOR[  ] = "YONTU";

#if defined USING_SQL
new const PLUGIN_NAME_SQL[  ] = "VIP System( SQL )";
#else
new const PLUGIN_NAME[  ] = "VIP System";
#endif

new const g_szTag[  ] = "[VIP System]";	// TAG
new const g_szVipFlags[  ] =	"t";		// flagul vip-ului( ADMIN_LEVEL_H )

// Aici iti pui numele cu care joci pe server si adresa ta( pluginul va afisa un mesaj la inceput de runda cu datele tale daca jucatorii sunt interesati sa cumpere vip );
new const YourNick[  ] = "nuconteaza", 
	 YourMessenger[  ] = "[email protected]";

static const COLORG[  ] = "^x04", COLORD[  ] = "^x01", COLORT[  ] = "^x03";

// Refil Ammo on headshot
new const g_Weapons[  ] = {

	CSW_M4A1,
	CSW_AK47,
	CSW_DEAGLE,
	CSW_USP
};

new const g_szWeapons[  ][  ] = {

	"weapon_m4a1",
	"weapon_ak47",
	"weapon_deagle",
	"weapon_usp"
};

new const g_iWeaponsAmmo[  ] = {

	30,
	30,
	7,
	12
};

enum {

    	SCOREATTRIB_ARG_PLAYERID = 1,
    	SCOREATTRIB_ARG_FLAGS
};

enum ( <<= 1 ) {

    	SCOREATTRIB_FLAG_NONE = 0,
    	SCOREATTRIB_FLAG_DEAD = 1,
    	SCOREATTRIB_FLAG_BOMB,
    	SCOREATTRIB_FLAG_VIP
};

enum _:WhatUserHas {

	Speed,
	Jump,
}
new bool:g_bUserHas[ 33 ][ WhatUserHas ];

new 	g_cvar_speed_spawn,
	g_cvar_health_spawn,
	g_cvar_armor_spawn,
	g_cvar_gravity_spawn,
	g_cvar_multidmg,
	g_cvar_health_kill_reward,
	g_cvar_health_hs_reward,
	g_cvar_maxhealth,
	g_cvar_kill_money_reward,
	g_cvar_show_msgs,
	g_cvar_enable_show_dmg,
	g_cvar_ebable_vip_scoreboard,
	g_cvar_enable_vip_noflash,
	g_cvar_enable_vip_multijump,
	g_cvar_enable_vip_event,
	g_cvar_enable_vip_model;

new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame;

new bool:VipEvent;

new iJumpNum[ 33 ] = 0;
new g_iMultiJumps[ 33 ] = 0;
new g_iMaxJumps = 0;

new g_iMaxPlayers;
new SyncHudMessage;

public plugin_init(  ) {

	#if defined USING_SQL
	register_plugin( PLUGIN_NAME_SQL,
			PLUGIN_VERSION,
			PLUGIN_AUTHOR );
	#else
	register_plugin( PLUGIN_NAME,
			PLUGIN_VERSION,
			PLUGIN_AUTHOR );
	#endif

	register_clcmd( "say /wantvip", "ShowAbilityForVip" );
	register_clcmd( "say_team /wantvip", "ShowAbilityForVip" );

	register_concmd( "amx_addvips", "ClCmdAddVips", ADMIN_RCON, "< nume >" );

	register_event( "ResetHUD", "event_ResetModel", "b" );
	register_event( "DeathMsg", "event_DeathMsg", "a" );
	register_event( "DeathMsg", "event_DeathMsg2", "ae" );
	register_event( "Damage", "event_Damage", "b", "2!0", "3=0", "4!0" );

	register_logevent( "logevent_RoundStart", 2 , "1=Round_Start" );
	register_logevent( "logevent_RoundEnd", 2, "1=Round_End" );

	register_forward( FM_PlayerPreThink, "forward_PlayerPreThink" );
	register_forward( FM_PlayerPostThink, "forward_PlayerPostThink" );

	RegisterHam( Ham_Spawn, "player", "Ham_PlayerSpawnPost", 1 );
	RegisterHam( Ham_TakeDamage, "player", "Ham_TakeDamagePre" );
	RegisterHam( Ham_Player_ResetMaxSpeed, "player", "Ham_ResetMaxSpeedPost", 1 );

    	register_message( get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib" );
	register_message( get_user_msgid( "ScreenFade" ), "MessageScreenFade" );

	g_cvar_speed_spawn = register_cvar( "vip_speed_spawn", "400.0" );		// viteza pe care o primeste vip-ul la spawn( sa fie cu zecimala.0 )
	g_cvar_health_spawn = register_cvar( "vip_health_spawn", "200" );		// viata pe care o primeste vip-ul la spawn
	g_cvar_armor_spawn = register_cvar( "vip_armor_spawn", "200" );		// armura pe care o primeste vip-ul la spawn
	g_cvar_gravity_spawn = register_cvar( "vip_gravity_spawn", "0.85" );	// gravitatea pe care o primeste vip-ul la spawn
	g_cvar_multidmg = register_cvar( "vip_multi_dmg", "2.0" );		// vip-ul are dmg mai mare la toate armele
	g_cvar_health_kill_reward = register_cvar( "vip_hp_kill_reward", "10" );	// cata viata sa primeasca vip-ul cand face un kill
	g_cvar_health_hs_reward = register_cvar( "vip_hp_hs_reward", "20" );	// cata viata sa primeasca vip-ul cand face un headshot
	g_cvar_maxhealth = register_cvar( "vip_maxhealth", "300" );		// viata maxima a vip-ului
	g_cvar_kill_money_reward = register_cvar( "vip_kill_money", "1" );	// Cati bani sa primeasca Vip-ul pe un frag
	g_cvar_show_msgs = register_cvar( "vip_show_messages", "30.0" );		// la ce interval de timp.0 sa apara mesajele in chat despre VIP
	g_cvar_enable_show_dmg = register_cvar( "vip_show_dmg", "0" );		// afiseaza vip-ului dmg-ul facut de victima si dmg-ul pe care i la facut victimei
	g_cvar_ebable_vip_scoreboard = register_cvar( "vip_on_scoreboard", "1" );	// 1 - vip-ii apar in scoreboard ca "VIP" | 0 - dezactivat
	g_cvar_enable_vip_noflash = register_cvar( "vip_imune_flashbang", "1" );	// 1 - Vip-ul este imun la flash-uri | 0 - Nu este
	g_cvar_enable_vip_multijump = register_cvar( "vip_enable_multijump", "1" );	// 1 - Vip-ul beneficiaza de multi jump | 0 - Nu beneficiaza
	g_cvar_enable_vip_event = register_cvar( "vip_enable_vip_event", "0" );	// 1 - Intre anumite ore toti jucatorii au VIP | 0 dezactivat
	g_cvar_enable_vip_model = register_cvar( "vip_enable_model", "1" );	// 1 - VIP-ul are alt model pe server | 0 - Nu are

	if( get_pcvar_num( g_cvar_enable_vip_event ) ) {

		check_time(  );
		set_task( 60.0, "check_time", _, _, _, "b" );
		set_task( 1.0, "hud_mess", _, _, _, "b" );
	}

	new szFile[ 64 ]
	get_configsdir( szFile, 63 );
	format( szFile, 63, "%s/vip_system.cfg", szFile );
	
	if( file_exists( szFile ) ) 
		server_cmd( "exec %s", szFile );

	g_iMaxPlayers = get_maxplayers(  );
	SyncHudMessage = CreateHudSyncObj(  );
}

public plugin_cfg(  )
	set_cvar_float( "sv_maxspeed", 1000.0 );

public plugin_precache(  ) {

	precache_model( "models/player/vip_ct/vip_ct.mdl" );
	precache_model( "models/player/vip_t/vip_t.mdl" );
}

public client_putinserver( id ) {

	g_iMultiJumps[ id ] = 0;
	iJumpNum[ id ] = 0;
	g_bUserHas[ id ][ Jump ] = false;
	g_bUserHas[ id ][ Speed ] = false;
}

public client_disconnect( id ) {

	g_iMultiJumps[ id ] = 0;
	iJumpNum[ id ] = 0;
	g_bUserHas[ id ][ Jump ] = false;
	g_bUserHas[ id ][ Speed ] = false;
}

public event_ResetModel( id ) {

	if( get_pcvar_num( g_cvar_enable_vip_model ) ) {

		if( is_user_vip( id ) ) {

			new CsTeams:userTeam = cs_get_user_team( id );

			if( userTeam == CS_TEAM_T ) {

				cs_set_user_model( id, "vip_t" );

				return 1;
			}

			else if( userTeam == CS_TEAM_CT ) {

				cs_set_user_model( id, "vip_ct" );

				return 1;
			}
		} else
			cs_reset_user_model( id );
	} else
		return 0;

	return 0;
}

public event_DeathMsg(  ) {

	new iAttacker = read_data( 1 );
	new iVictim = read_data( 2 );
	new iHeadshot = read_data( 3 );
	
	new HealthOnHeadShot = get_pcvar_num( g_cvar_health_hs_reward );
	new MaxHealth = get_pcvar_num( g_cvar_maxhealth );
	new HealthOnKill = get_pcvar_num( g_cvar_health_kill_reward );

	if( iAttacker == iVictim )
		return 0;

	if( is_user_vip( iAttacker ) && iAttacker != iVictim ) {
		
		if( get_user_health( iAttacker ) <= MaxHealth ) {

			if( iHeadshot ) {

				set_user_health( iAttacker, get_user_health( iAttacker ) + HealthOnHeadShot );

				set_hudmessage( 0, 250, 0, 0.85, 0.7, 0, 6.0, 5.0 );
				ShowSyncHudMsg( iAttacker, SyncHudMessage, "+ %i HP", HealthOnHeadShot );
			} else {

				set_user_health( iAttacker, get_user_health( iAttacker ) + HealthOnKill );

				set_hudmessage( 200, 200, 0, 0.85, 0.7, 0, 6.0, 5.0 );
				ShowSyncHudMsg( iAttacker, SyncHudMessage, "+ %i HP", HealthOnKill );
			}
		}

		if( is_user_alive( iAttacker ) && !is_user_bot( iAttacker ) )
			if( read_data( 3 ) )
				for( new w = 0; w < sizeof( g_Weapons ); w++ )
					if( get_user_weapon( iAttacker ) == g_Weapons[ w ] )
						if( find_ent_by_owner( -1, g_szWeapons[ w ], iAttacker ) )
							cs_set_weapon_ammo( find_ent_by_owner( -1, g_szWeapons[ w ], iAttacker ), g_iWeaponsAmmo[ w ] );
	}

	return 0;
}

public event_DeathMsg2(  ) {

	new iAttacker = read_data( 1 ); 
	new iVictim = read_data( 2 );

	new BonusMoney = get_pcvar_num( g_cvar_kill_money_reward );
	
	if( iAttacker == iVictim )
		return 0;

	if( is_user_vip( iAttacker ) )
		if( iAttacker && is_user_alive( iAttacker ) )
			if( cs_get_user_team( iVictim ) == CS_TEAM_T || cs_get_user_team( iVictim ) == CS_TEAM_CT )
				if( cs_get_user_money( iAttacker ) < 16000 - BonusMoney - 300 )
					cs_set_user_money( iAttacker, cs_get_user_money( iAttacker ) + BonusMoney - 300 );

	return 0;
}

public event_Damage( id ) {

	if( get_pcvar_num( g_cvar_enable_show_dmg ) ) {

		static iAttacker;
		static fDamage;
	
		iAttacker = get_user_attacker( id );
		fDamage = read_data( 2 );

		if( is_user_alive( id ) && is_user_vip( id ) ) {
			
			set_hudmessage( 255, 0, 0, 0.45, 0.50, 2, 0.1, 1.0, 0.1, 0.1, -1 );
			ShowSyncHudMsg( id, SyncHudMessage, "%i^n", fDamage );	
		}

		if( is_user_alive( iAttacker ) && is_user_vip( iAttacker ) ) {

			set_hudmessage( 0, 255, 15, -1.0, 0.55, 2, 0.1, 1.0, 0.02, 0.02, -1 );
			ShowSyncHudMsg( iAttacker, SyncHudMessage, "%i^n^n", fDamage );
		}
	}
}

public logevent_RoundStart(  ) {
	
	new szPlayers[ 32 ], iNum;
	get_players( szPlayers, iNum, "ch" );
	
	for( new i = 0; i < iNum; i++)  {

		g_bUserHas[ szPlayers[ i ] ][ Speed ] = false;
		g_bUserHas[ szPlayers[ i ] ][ Jump ] = false;
		g_iMultiJumps[ szPlayers[ i ] ] = 0;
		iJumpNum[ szPlayers[ i ] ] = 0;

		if( task_exists( szPlayers[ i ] + TASK_SECRET_MSG ) )
			remove_task( szPlayers[ i ] + TASK_SECRET_MSG );
		
		set_task( get_pcvar_float( g_cvar_show_msgs ), "task_ShowMessage", szPlayers[ i ] + TASK_SECRET_MSG );
	}
}

public logevent_RoundEnd(  ) {
	
	new szPlayers[ 32 ], iNum;
	get_players( szPlayers, iNum, "ch" );
	
	for( new i = 0; i < iNum; i++ )
		remove_task( szPlayers[ i ] );
}

public forward_PlayerPreThink( id ) {

	if( !is_user_alive( id ) || !g_iMultiJumps[ id ] )
		return 0;

	if( ( pev( id, pev_button ) & IN_JUMP ) && !( pev( id, pev_flags ) & FL_ONGROUND ) && !( pev( id, pev_oldbuttons ) & IN_JUMP ) ) {

		if( iJumpNum[ id ] < g_iMultiJumps[ id ] ) {

			g_bUserHas[ id ][ Jump ] = true;
			iJumpNum[ id ]++;

			return 0;
		}
	}

	if( ( pev( id, pev_button ) & IN_JUMP ) && ( pev( id, pev_flags ) & FL_ONGROUND ) ) {

		iJumpNum[ id ] = 0;
		return 0;
	}

	return 0;
}

public forward_PlayerPostThink( id ) {

	if( !is_user_alive( id ) || !g_iMultiJumps[ id ] )
		return 0;

	if( g_bUserHas[ id ][ Jump ] ) {

		new Float:fVelocity[ 3 ];

		pev( id, pev_velocity, fVelocity );

		fVelocity[ 2 ] = random_float( 265.0, 285.0 );

		set_pev( id, pev_velocity, fVelocity );

		g_bUserHas[ id ][ Jump ] = false;
		return 0;
	}

	return 0;
}

public Ham_PlayerSpawnPost( id ) {
	
	if( !is_user_alive( id ) && !is_user_vip( id ) )
		return HAM_IGNORED;
	
	if( is_user_vip( id ) && !is_user_bot( id ) )
		set_task( 5.0, "task_GiveSkillsAllVips", id );
	
	return HAM_IGNORED;
}

public task_GiveSkillsAllVips( id ) {

	//drop_prim( id );

	g_bUserHas[ id ][ Speed ] = true;
	fm_set_user_maxspeed( id, get_pcvar_float( g_cvar_speed_spawn ) );

	new szCommand[ 128 ];
	formatex( szCommand, sizeof( szCommand ) - 1, "cl_forwardspeed %.1f;cl_sidespeed %.1f;cl_backspeed %.1f", get_pcvar_float( g_cvar_speed_spawn ), get_pcvar_float( g_cvar_speed_spawn ), get_pcvar_float( g_cvar_speed_spawn ) );
	client_cmd( id, szCommand );

	if( get_pcvar_num( g_cvar_enable_vip_multijump ) )
		if( g_iMultiJumps[ id ] < g_iMaxJumps || !g_iMaxJumps )
			g_iMultiJumps[ id ]++;

	set_user_health( id, get_pcvar_num( g_cvar_health_spawn ) );
	set_user_armor( id, get_pcvar_num( g_cvar_armor_spawn ) );
	set_user_gravity( id, get_pcvar_float( g_cvar_gravity_spawn ) );

	fm_give_item( id, "weapon_hegrenade" );
	fm_give_item( id, "weapon_flashbang" );
	fm_give_item( id, "weapon_flashbang" );
	fm_give_item( id, "weapon_smokegrenade" );

	//GiveRifle( id );
}

public GiveRifle( id ) {

	fm_give_item( id, "weapon_m4a1" );
	cs_set_user_bpammo( id, CSW_M4A1, 300 );

	fm_give_item( id, "weapon_ak47" );
	cs_set_user_bpammo( id, CSW_AK47, 300 );

	fm_give_item( id, "weapon_awp" );
	cs_set_user_bpammo( id, CSW_AWP, 100 );

	fm_give_item( id, "weapon_deagle" );
	cs_set_user_bpammo( id, CSW_DEAGLE, 70 );
}

public task_ShowMessage( taskid ) {

	new id = taskid - TASK_SECRET_MSG;

	ColorChat( id, GREEN, "%s^x01 Vrei sa cumperi si tu^x03 Membru V.I.P^x01? Contacteaza-l pe^x03 %s^x01 la^x03 %s^x01 !!!", g_szTag, YourNick, YourMessenger );

	set_task( get_pcvar_float( g_cvar_show_msgs ) * 0.5, "task_ShowMessage2", id );

	if( task_exists( taskid ) )
		remove_task( taskid );
}

public task_ShowMessage2( id ) {

	ColorChat( id, GREEN, "%s^x01 Vrei sa faci rost de^x03 Membru VIP^x01 si nu stii cum? Tasteaza^x03 /wantvip^x01 !!!", g_szTag );

	set_task( get_pcvar_float( g_cvar_show_msgs ) * 1.2, "task_PrintVipList", id );
}

public task_PrintVipList( user ) {

	new szAdminNames[ 33 ][ 32 ];
	new szMessage[ 256 ];
	new iCount, iLen;
	
	for( new id = 1 ; id <= g_iMaxPlayers ; id++ )
		if( is_user_connected( id ) )
			if( is_user_vip( id ) )
				get_user_name( id, szAdminNames[ iCount++ ], 31 );

	iLen = format( szMessage, 255, "%sVIP's Online: ", COLORG );

	if( iCount > 0 ) {

		for( new i = 0 ; i < iCount ; i++ ) {

			iLen += format( szMessage[ iLen ], 255 - iLen, "^x03%s^x01 | ", szAdminNames[ i ], COLORT, COLORD );

			if( iLen > 96 ) {

				print_message( user, szMessage );
				iLen = format( szMessage, 255, "%s", COLORG );
			}
		}

		print_message( user, szMessage );
	} else {

		iLen += format( szMessage[ iLen ], 255 - iLen, "^x01Nu sunt VIP-i online.", COLORD );
		print_message( user, szMessage );
	}
}

public Ham_ResetMaxSpeedPost( id ) {

	if( is_user_alive( id ) && is_user_vip( id ) && get_user_maxspeed( id ) != 1.0 ) {

  		new Float:flMaxSpeed;

  		if( g_bUserHas[ id ][ Speed ] )
   			flMaxSpeed = float( get_pcvar_num( g_cvar_speed_spawn ) );

  		if( flMaxSpeed > 0.0 )
   			set_pev( id, pev_maxspeed, flMaxSpeed );
	}
}

public Ham_TakeDamagePre( iVictim, iInflictor, iAttacker, Float:fDamage ) {

	if( iVictim == iAttacker || !is_user_player( iAttacker ) || !is_user_alive( iAttacker ) || is_user_bot( iAttacker ) )
		return HAM_HANDLED;

	if( is_user_vip( iAttacker ) && is_user_player( iAttacker ) )
		SetHamParamFloat( 4, fDamage * get_pcvar_float( g_cvar_multidmg ) );

	return HAM_IGNORED;
}

public MessageScoreAttrib( iMsgId, iMsgDest, id ) {

	if( get_pcvar_num( g_cvar_ebable_vip_scoreboard ) ) {

		new iPlayer = get_msg_arg_int( SCOREATTRIB_ARG_PLAYERID );
        
		if( access( iPlayer, read_flags( g_szVipFlags ) ) )
			set_msg_arg_int( SCOREATTRIB_ARG_FLAGS, ARG_BYTE, SCOREATTRIB_FLAG_VIP );
	}
}

public MessageScreenFade( iMsgId, iMsgDest, id ) {

	if( is_user_vip( id ) && is_user_alive( id ) && get_pcvar_num( g_cvar_enable_vip_noflash ) ) {

		static szData[ 4 ];

		szData[ 0 ] = get_msg_arg_int( 4 );
		szData[ 1 ] = get_msg_arg_int( 5 );
		szData[ 2 ] = get_msg_arg_int( 6 );
		szData[ 3 ] = get_msg_arg_int( 7 );
		
		if( szData[ 0 ] == 255 && szData[ 1 ] == 255 && szData[ 2 ] == 255 && szData[ 3] > 199 )
			return 1;
	}

	return 0;
}

public check_time(  ) {

	static preluare_ora[ 3 ], ora;
	get_time( "%H", preluare_ora, 2 );

	ora = str_to_num( preluare_ora );

	if( FIRST_HOUR >= ora || ora < LAST_HOUR ) {

		if( !VipEvent )
			ColorChat( 0, GREEN, "^x04%s^x01 Eventul^x03 Free VIP^x01 a fost activat!", g_szTag );

		VipEvent = true;
		server_cmd( "amx_default_access ^"t^"" );
	} else {

		if( VipEvent )
			ColorChat( 0, GREEN, "^x04%s^x01 Eventul^x03 Free VIP^x01 a fost activat!", g_szTag );

		VipEvent = false;
		server_cmd( "amx_default_access ^"z^"" );
	}

	server_cmd( "amx_reloadadmins" );
}

public hud_mess(  ) {

	if( VipEvent ) {

		set_hudmessage( 200, 200, 10, -1.0, 0.0, 1, 1.0, 1.0, 0.1, 0.1 );
		show_hudmessage( 0, "Toti jucatorii beneficiaza de VIP free aceasta ora!" );
	}
}

public ShowAbilityForVip( id ) {

	new iCfgDir[ 32 ], iFile[ 192 ];
        
	get_configsdir( iCfgDir, charsmax( iCfgDir ) );
	formatex( iFile, charsmax( iFile ), "%s/vip.html", iCfgDir );

	show_motd( id, iFile );
}

public ClCmdAddVips( id, level, cid ) {

	if( !cmd_access( id, level, cid, 2 ) )
		return 1;

	new szTarget[ 32 ];
	read_argv( 1, szTarget, 31 );

	new iPlayer = cmd_target( id, szTarget, 8 );

	if( !iPlayer )
		return 1;

	new szPlayerName[ 32 ], szAdminName[ 32 ];
	get_user_name( iPlayer, szPlayerName, charsmax( szPlayerName ) );
	get_user_name( id, szAdminName, charsmax( szAdminName ) );

	AddVIP( id, szPlayerName, VIP_FLAGS, VIP_PASSWORD, VIP_FLAGS_TYPE, szAdminName );
	server_cmd( "amx_reloadadmins" );

	console_print( id, "%s Vip-ul a fost adaugat in lista!", g_szTag );
	ColorChat( 0, GREEN, "^x04%s^x01 Adminul^x03 %s^x01 l-a adaugat ca VIP pe^x03 %s^x01 !", g_szTag, szAdminName, iPlayer );
	ColorChat( iPlayer, GREEN, "^x04%s^x01 Felicitari! Ai fost adaugat ca membru^x03 VIP^x01! VIP-ul se va activa harta viitoare!", g_szTag );

	return 1;
}

stock bool:is_user_vip( id ) {

	if( get_user_flags( id ) & read_flags( g_szVipFlags ) )
		return true;
	
	return false;
}

stock print_message( id, Msg[  ] ) {

	message_begin( MSG_ONE, get_user_msgid( "SayText" ), { 0, 0, 0 }, id );
	write_byte( id );
	write_string( Msg );
	message_end(  );
}

// stocks from "fakemeta_util"
stock fm_give_item( index, const item[  ] ) {

	if( !equal( item, "weapon_", 7 ) && !equal( item, "ammo_", 5 ) && !equal( item, "item_", 5 ) && !equal( item, "tf_weapon_", 10 ) )
		return 0;

	new ent = fm_create_entity( item );

	if( !pev_valid( ent ) )
		return 0;

	new Float:fOrigin[ 3 ];
	pev( index, pev_origin, fOrigin );

	set_pev( ent, pev_origin, fOrigin );
	set_pev( ent, pev_spawnflags, pev( ent, pev_spawnflags ) | SF_NORESPAWN );

	dllfunc( DLLFunc_Spawn, ent );

	new save = pev( ent, pev_solid );

	dllfunc( DLLFunc_Touch, ent, index );

	if( pev( ent, pev_solid ) != save )
		return ent;

	engfunc( EngFunc_RemoveEntity, ent );

	return -1;
}

stock fm_set_user_maxspeed( index, Float:speed = -1.0 ) {

	engfunc( EngFunc_SetClientMaxspeed, index, speed );

	set_pev( index, pev_maxspeed, speed );

	return 1;
}

stock Float:fm_get_user_maxspeed( index ) {

	new Float:speed;
	pev( index, pev_maxspeed, speed );

	return speed;
}

stock fm_set_rendering( entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16 ) {

	new Float:RenderColor[ 3 ];
	RenderColor[ 0 ] = float( r );
	RenderColor[ 1 ] = float( g );
	RenderColor[ 2 ] = float( b );

	set_pev( entity, pev_renderfx, fx );
	set_pev( entity, pev_rendercolor, RenderColor );
	set_pev( entity, pev_rendermode, render );
	set_pev( entity, pev_renderamt, float( amount ) );

	return 1;
}

stock fm_create_entity( const classname[  ] )
	return engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, classname ) );

AddVIP( id, name[  ], accessflags[  ], password[  ], flags[  ], comment[  ]="" ) {

#if defined USING_SQL
	new error[ 128 ], errno;

	new Handle:info = SQL_MakeStdTuple(  );
	new Handle:sql = SQL_Connect( info, errno, error, 127 );

	if( sql == Empty_Handle ) {

		server_print( "[AMXX] %L", LANG_SERVER, "SQL_CANT_CON", error );
#endif
		// Make sure that the users.ini file exists.
		new configsDir[ 64 ];
		get_configsdir( configsDir, 63 );
		format( configsDir, 63, "%s/users.ini", configsDir );

		if( !file_exists( configsDir ) ) {

			console_print( id, "%s File ^"%s^" doesn't exist.", g_szTag, configsDir );
			return;
		}

		// Make sure steamid isn't already in file.
		new line = 0, textline[ 256 ], len;
		const SIZE = 63;
		new line_steamid[ SIZE + 1 ], line_password[ SIZE + 1 ], line_accessflags[ SIZE + 1 ], line_flags[ SIZE + 1 ], parsedParams;

		// <name|ip|steamid> <password> <access flags> <account flags>
		while( ( line = read_file( configsDir, line, textline, 255, len ) ) ) {

			if ( len == 0 || equal( textline, ";", 1 ) )
				continue; // comment line

			parsedParams = parse( textline, line_steamid, SIZE, line_password, SIZE, line_accessflags, SIZE, line_flags, SIZE );

			if( parsedParams != 4 )
				continue;	// Send warning/error?
			
			if( containi( line_flags, flags ) != -1 && equal( line_steamid, name ) ) {

				console_print( id, "%s %s already exists!", g_szTag, name );
				return;
			}
		}
	
		// If we came here, steamid doesn't exist in users.ini. Add it.
		new linetoadd[ 512 ];
		
		if( comment[ 0 ]==0 )
			formatex( linetoadd, 511, "^r^n^"%s^" ^"%s^" ^"%s^" ^"%s^"", name, password, accessflags, flags );

		else
			formatex( linetoadd, 511, "^r^n^"%s^" ^"%s^" ^"%s^" ^"%s^" ; %s", name, password, accessflags, flags, comment );

		console_print( id, "Adding:^n%s", linetoadd );
		
		if( !write_file( configsDir, linetoadd ) )
			console_print( id, "%s Failed writing to %s!", g_szTag, configsDir );
#if defined USING_SQL
	}
	
	new table[ 32 ];

	get_cvar_string( "amx_sql_table", table, 31 );

	new Handle:query = SQL_PrepareQuery( sql, "SELECT * FROM `%s` WHERE (`auth` = '%s')", table, name );
	
	if( !SQL_Execute( query ) ) {

		SQL_QueryError( query, error, 127 );
		server_print( "[AMXX] %L", LANG_SERVER, "SQL_CANT_LOAD_ADMINS", error );
		console_print( id, "[AMXX] %L", LANG_SERVER, "SQL_CANT_LOAD_ADMINS", error );
	} 
		
	else if( SQL_NumResults( query ) )
		console_print( id, "%s %s already exists!", g_szTag, name );

	else {

		console_print( id, "Adding to database:^n^"%s^" ^"%s^" ^"%s^" ^"%s^"", name, password, accessflags, flags );

		SQL_QueryAndIgnore( sql, "REPLACE INTO `%s` (`name`, `password`, `access`, `flags`) VALUES ('%s', '%s', '%s', '%s')", table, name, password, accessflags, flags );
	}

	SQL_FreeHandle( query );
	SQL_FreeHandle( sql);
	SQL_FreeHandle( info );
#endif
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Poftim!
„Peste douăzeci de ani vei fi dezamăgit din cauza lucrurilor pe care nu le-ai făcut, nu din cauza celor pe care le-ai făcut.” - Mark Twain
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș


Bio.LeagueCs.Ro - Biohazard v4.4 Xmas Edition
discord: IonutC#5114

Experinta in: Java/Spring boot/Angular/C/C++/C#/Javascript/Python/HTML/CSS/Pawn/SQL
Ai nevoie de ajutorul meu? Ma poti gasi doar la adresa de discord de mai sus.
User avatar
LordNeo
Membru, skill 0
Membru, skill 0
Posts: 23
Joined: 11 Jul 2009, 20:28
Detinator Steam: Da
CS Status: Joc cs pe Respawn.PGLZONE.ro
Has thanked: 2 times

07 Feb 2015, 01:42

The YONTU wrote:
| Afiseaza codul
/*


		Credits:	Exolent - VIP in Scoreboard
			pharse - x2 Jump for VIP( for ZP 5.0.5 )
			Sn!ff3r - Show bullet dmg in HUD only VIP
			Askhanar - Change Model to VIP
			cheap.suit - No VIP Flash( extracted on Biohazard v2.00 beta )
			AMXX Dev Team - Add VIP's
			cyby - VIP Event
		

*/
#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < cstrike >
#include < fakemeta >
#include < engine >
#include < fun >
#include < ColorChat >
#include < message_const >

//#define USING_SQL

#if defined USING_SQL
#include < sqlx >
#endif

// Toate aceste date vor fi trecute in fisierul "users.ini" !
#define VIP_FLAGS		"bit"	// Flagurile VIP-ului( Nu schimba )
#define VIP_FLAGS_TYPE		"a"	// a - deconecteaza VIP-ii cu parola invalida( Alte flaguri gasiti in "users.ini" )
#define VIP_PASSWORD		"parola"	// Aici setati parola oricarui VIP

#define is_user_player(%1) ( 1 <= %1 <= g_iMaxPlayers )

#define TASK_SECRET_MSG		216439

// Aici schimbati orele cand jucatorii pot avea VIP free( pentru a dezactiva setati caloarea 0 cvar-ului "vip_enable_vip_event" )
#define FIRST_HOUR	12
#define LAST_HOUR	13

new const PLUGIN_VERSION[  ] = "1.0.2",
	 PLUGIN_AUTHOR[  ] = "YONTU";

#if defined USING_SQL
new const PLUGIN_NAME_SQL[  ] = "VIP System( SQL )";
#else
new const PLUGIN_NAME[  ] = "VIP System";
#endif

new const g_szTag[  ] = "[VIP System]";	// TAG
new const g_szVipFlags[  ] =	"t";		// flagul vip-ului( ADMIN_LEVEL_H )

// Aici iti pui numele cu care joci pe server si adresa ta( pluginul va afisa un mesaj la inceput de runda cu datele tale daca jucatorii sunt interesati sa cumpere vip );
new const YourNick[  ] = "nuconteaza", 
	 YourMessenger[  ] = "[email protected]";

static const COLORG[  ] = "^x04", COLORD[  ] = "^x01", COLORT[  ] = "^x03";

// Refil Ammo on headshot
new const g_Weapons[  ] = {

	CSW_M4A1,
	CSW_AK47,
	CSW_DEAGLE,
	CSW_USP
};

new const g_szWeapons[  ][  ] = {

	"weapon_m4a1",
	"weapon_ak47",
	"weapon_deagle",
	"weapon_usp"
};

new const g_iWeaponsAmmo[  ] = {

	30,
	30,
	7,
	12
};

enum {

    	SCOREATTRIB_ARG_PLAYERID = 1,
    	SCOREATTRIB_ARG_FLAGS
};

enum ( <<= 1 ) {

    	SCOREATTRIB_FLAG_NONE = 0,
    	SCOREATTRIB_FLAG_DEAD = 1,
    	SCOREATTRIB_FLAG_BOMB,
    	SCOREATTRIB_FLAG_VIP
};

enum _:WhatUserHas {

	Speed,
	Jump,
}
new bool:g_bUserHas[ 33 ][ WhatUserHas ];

new 	g_cvar_speed_spawn,
	g_cvar_health_spawn,
	g_cvar_armor_spawn,
	g_cvar_gravity_spawn,
	g_cvar_multidmg,
	g_cvar_health_kill_reward,
	g_cvar_health_hs_reward,
	g_cvar_maxhealth,
	g_cvar_kill_money_reward,
	g_cvar_show_msgs,
	g_cvar_enable_show_dmg,
	g_cvar_ebable_vip_scoreboard,
	g_cvar_enable_vip_noflash,
	g_cvar_enable_vip_multijump,
	g_cvar_enable_vip_event,
	g_cvar_enable_vip_model;

new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame;

new bool:VipEvent;

new iJumpNum[ 33 ] = 0;
new g_iMultiJumps[ 33 ] = 0;
new g_iMaxJumps = 0;

new g_iMaxPlayers;
new SyncHudMessage;

public plugin_init(  ) {

	#if defined USING_SQL
	register_plugin( PLUGIN_NAME_SQL,
			PLUGIN_VERSION,
			PLUGIN_AUTHOR );
	#else
	register_plugin( PLUGIN_NAME,
			PLUGIN_VERSION,
			PLUGIN_AUTHOR );
	#endif

	register_clcmd( "say /wantvip", "ShowAbilityForVip" );
	register_clcmd( "say_team /wantvip", "ShowAbilityForVip" );

	register_concmd( "amx_addvips", "ClCmdAddVips", ADMIN_RCON, "< nume >" );

	register_event( "ResetHUD", "event_ResetModel", "b" );
	register_event( "DeathMsg", "event_DeathMsg", "a" );
	register_event( "DeathMsg", "event_DeathMsg2", "ae" );
	register_event( "Damage", "event_Damage", "b", "2!0", "3=0", "4!0" );

	register_logevent( "logevent_RoundStart", 2 , "1=Round_Start" );
	register_logevent( "logevent_RoundEnd", 2, "1=Round_End" );

	register_forward( FM_PlayerPreThink, "forward_PlayerPreThink" );
	register_forward( FM_PlayerPostThink, "forward_PlayerPostThink" );

	RegisterHam( Ham_Spawn, "player", "Ham_PlayerSpawnPost", 1 );
	RegisterHam( Ham_TakeDamage, "player", "Ham_TakeDamagePre" );
	RegisterHam( Ham_Player_ResetMaxSpeed, "player", "Ham_ResetMaxSpeedPost", 1 );

    	register_message( get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib" );
	register_message( get_user_msgid( "ScreenFade" ), "MessageScreenFade" );

	g_cvar_speed_spawn = register_cvar( "vip_speed_spawn", "400.0" );		// viteza pe care o primeste vip-ul la spawn( sa fie cu zecimala.0 )
	g_cvar_health_spawn = register_cvar( "vip_health_spawn", "200" );		// viata pe care o primeste vip-ul la spawn
	g_cvar_armor_spawn = register_cvar( "vip_armor_spawn", "200" );		// armura pe care o primeste vip-ul la spawn
	g_cvar_gravity_spawn = register_cvar( "vip_gravity_spawn", "0.85" );	// gravitatea pe care o primeste vip-ul la spawn
	g_cvar_multidmg = register_cvar( "vip_multi_dmg", "2.0" );		// vip-ul are dmg mai mare la toate armele
	g_cvar_health_kill_reward = register_cvar( "vip_hp_kill_reward", "10" );	// cata viata sa primeasca vip-ul cand face un kill
	g_cvar_health_hs_reward = register_cvar( "vip_hp_hs_reward", "20" );	// cata viata sa primeasca vip-ul cand face un headshot
	g_cvar_maxhealth = register_cvar( "vip_maxhealth", "300" );		// viata maxima a vip-ului
	g_cvar_kill_money_reward = register_cvar( "vip_kill_money", "1" );	// Cati bani sa primeasca Vip-ul pe un frag
	g_cvar_show_msgs = register_cvar( "vip_show_messages", "30.0" );		// la ce interval de timp.0 sa apara mesajele in chat despre VIP
	g_cvar_enable_show_dmg = register_cvar( "vip_show_dmg", "0" );		// afiseaza vip-ului dmg-ul facut de victima si dmg-ul pe care i la facut victimei
	g_cvar_ebable_vip_scoreboard = register_cvar( "vip_on_scoreboard", "1" );	// 1 - vip-ii apar in scoreboard ca "VIP" | 0 - dezactivat
	g_cvar_enable_vip_noflash = register_cvar( "vip_imune_flashbang", "1" );	// 1 - Vip-ul este imun la flash-uri | 0 - Nu este
	g_cvar_enable_vip_multijump = register_cvar( "vip_enable_multijump", "1" );	// 1 - Vip-ul beneficiaza de multi jump | 0 - Nu beneficiaza
	g_cvar_enable_vip_event = register_cvar( "vip_enable_vip_event", "0" );	// 1 - Intre anumite ore toti jucatorii au VIP | 0 dezactivat
	g_cvar_enable_vip_model = register_cvar( "vip_enable_model", "1" );	// 1 - VIP-ul are alt model pe server | 0 - Nu are

	if( get_pcvar_num( g_cvar_enable_vip_event ) ) {

		check_time(  );
		set_task( 60.0, "check_time", _, _, _, "b" );
		set_task( 1.0, "hud_mess", _, _, _, "b" );
	}

	new szFile[ 64 ]
	get_configsdir( szFile, 63 );
	format( szFile, 63, "%s/vip_system.cfg", szFile );
	
	if( file_exists( szFile ) ) 
		server_cmd( "exec %s", szFile );

	g_iMaxPlayers = get_maxplayers(  );
	SyncHudMessage = CreateHudSyncObj(  );
}

public plugin_cfg(  )
	set_cvar_float( "sv_maxspeed", 1000.0 );

public plugin_precache(  ) {

	precache_model( "models/player/vip_ct/vip_ct.mdl" );
	precache_model( "models/player/vip_t/vip_t.mdl" );
}

public client_putinserver( id ) {

	g_iMultiJumps[ id ] = 0;
	iJumpNum[ id ] = 0;
	g_bUserHas[ id ][ Jump ] = false;
	g_bUserHas[ id ][ Speed ] = false;
}

public client_disconnect( id ) {

	g_iMultiJumps[ id ] = 0;
	iJumpNum[ id ] = 0;
	g_bUserHas[ id ][ Jump ] = false;
	g_bUserHas[ id ][ Speed ] = false;
}

public event_ResetModel( id ) {

	if( get_pcvar_num( g_cvar_enable_vip_model ) ) {

		if( is_user_vip( id ) ) {

			new CsTeams:userTeam = cs_get_user_team( id );

			if( userTeam == CS_TEAM_T ) {

				cs_set_user_model( id, "vip_t" );

				return 1;
			}

			else if( userTeam == CS_TEAM_CT ) {

				cs_set_user_model( id, "vip_ct" );

				return 1;
			}
		} else
			cs_reset_user_model( id );
	} else
		return 0;

	return 0;
}

public event_DeathMsg(  ) {

	new iAttacker = read_data( 1 );
	new iVictim = read_data( 2 );
	new iHeadshot = read_data( 3 );
	
	new HealthOnHeadShot = get_pcvar_num( g_cvar_health_hs_reward );
	new MaxHealth = get_pcvar_num( g_cvar_maxhealth );
	new HealthOnKill = get_pcvar_num( g_cvar_health_kill_reward );

	if( iAttacker == iVictim )
		return 0;

	if( is_user_vip( iAttacker ) && iAttacker != iVictim ) {
		
		if( get_user_health( iAttacker ) <= MaxHealth ) {

			if( iHeadshot ) {

				set_user_health( iAttacker, get_user_health( iAttacker ) + HealthOnHeadShot );

				set_hudmessage( 0, 250, 0, 0.85, 0.7, 0, 6.0, 5.0 );
				ShowSyncHudMsg( iAttacker, SyncHudMessage, "+ %i HP", HealthOnHeadShot );
			} else {

				set_user_health( iAttacker, get_user_health( iAttacker ) + HealthOnKill );

				set_hudmessage( 200, 200, 0, 0.85, 0.7, 0, 6.0, 5.0 );
				ShowSyncHudMsg( iAttacker, SyncHudMessage, "+ %i HP", HealthOnKill );
			}
		}

		if( is_user_alive( iAttacker ) && !is_user_bot( iAttacker ) )
			if( read_data( 3 ) )
				for( new w = 0; w < sizeof( g_Weapons ); w++ )
					if( get_user_weapon( iAttacker ) == g_Weapons[ w ] )
						if( find_ent_by_owner( -1, g_szWeapons[ w ], iAttacker ) )
							cs_set_weapon_ammo( find_ent_by_owner( -1, g_szWeapons[ w ], iAttacker ), g_iWeaponsAmmo[ w ] );
	}

	return 0;
}

public event_DeathMsg2(  ) {

	new iAttacker = read_data( 1 ); 
	new iVictim = read_data( 2 );

	new BonusMoney = get_pcvar_num( g_cvar_kill_money_reward );
	
	if( iAttacker == iVictim )
		return 0;

	if( is_user_vip( iAttacker ) )
		if( iAttacker && is_user_alive( iAttacker ) )
			if( cs_get_user_team( iVictim ) == CS_TEAM_T || cs_get_user_team( iVictim ) == CS_TEAM_CT )
				if( cs_get_user_money( iAttacker ) < 16000 - BonusMoney - 300 )
					cs_set_user_money( iAttacker, cs_get_user_money( iAttacker ) + BonusMoney - 300 );

	return 0;
}

public event_Damage( id ) {

	if( get_pcvar_num( g_cvar_enable_show_dmg ) ) {

		static iAttacker;
		static fDamage;
	
		iAttacker = get_user_attacker( id );
		fDamage = read_data( 2 );

		if( is_user_alive( id ) && is_user_vip( id ) ) {
			
			set_hudmessage( 255, 0, 0, 0.45, 0.50, 2, 0.1, 1.0, 0.1, 0.1, -1 );
			ShowSyncHudMsg( id, SyncHudMessage, "%i^n", fDamage );	
		}

		if( is_user_alive( iAttacker ) && is_user_vip( iAttacker ) ) {

			set_hudmessage( 0, 255, 15, -1.0, 0.55, 2, 0.1, 1.0, 0.02, 0.02, -1 );
			ShowSyncHudMsg( iAttacker, SyncHudMessage, "%i^n^n", fDamage );
		}
	}
}

public logevent_RoundStart(  ) {
	
	new szPlayers[ 32 ], iNum;
	get_players( szPlayers, iNum, "ch" );
	
	for( new i = 0; i < iNum; i++)  {

		g_bUserHas[ szPlayers[ i ] ][ Speed ] = false;
		g_bUserHas[ szPlayers[ i ] ][ Jump ] = false;
		g_iMultiJumps[ szPlayers[ i ] ] = 0;
		iJumpNum[ szPlayers[ i ] ] = 0;

		if( task_exists( szPlayers[ i ] + TASK_SECRET_MSG ) )
			remove_task( szPlayers[ i ] + TASK_SECRET_MSG );
		
		set_task( get_pcvar_float( g_cvar_show_msgs ), "task_ShowMessage", szPlayers[ i ] + TASK_SECRET_MSG );
	}
}

public logevent_RoundEnd(  ) {
	
	new szPlayers[ 32 ], iNum;
	get_players( szPlayers, iNum, "ch" );
	
	for( new i = 0; i < iNum; i++ )
		remove_task( szPlayers[ i ] );
}

public forward_PlayerPreThink( id ) {

	if( !is_user_alive( id ) || !g_iMultiJumps[ id ] )
		return 0;

	if( ( pev( id, pev_button ) & IN_JUMP ) && !( pev( id, pev_flags ) & FL_ONGROUND ) && !( pev( id, pev_oldbuttons ) & IN_JUMP ) ) {

		if( iJumpNum[ id ] < g_iMultiJumps[ id ] ) {

			g_bUserHas[ id ][ Jump ] = true;
			iJumpNum[ id ]++;

			return 0;
		}
	}

	if( ( pev( id, pev_button ) & IN_JUMP ) && ( pev( id, pev_flags ) & FL_ONGROUND ) ) {

		iJumpNum[ id ] = 0;
		return 0;
	}

	return 0;
}

public forward_PlayerPostThink( id ) {

	if( !is_user_alive( id ) || !g_iMultiJumps[ id ] )
		return 0;

	if( g_bUserHas[ id ][ Jump ] ) {

		new Float:fVelocity[ 3 ];

		pev( id, pev_velocity, fVelocity );

		fVelocity[ 2 ] = random_float( 265.0, 285.0 );

		set_pev( id, pev_velocity, fVelocity );

		g_bUserHas[ id ][ Jump ] = false;
		return 0;
	}

	return 0;
}

public Ham_PlayerSpawnPost( id ) {
	
	if( !is_user_alive( id ) && !is_user_vip( id ) )
		return HAM_IGNORED;
	
	if( is_user_vip( id ) && !is_user_bot( id ) )
		set_task( 5.0, "task_GiveSkillsAllVips", id );
	
	return HAM_IGNORED;
}

public task_GiveSkillsAllVips( id ) {

	//drop_prim( id );

	g_bUserHas[ id ][ Speed ] = true;
	fm_set_user_maxspeed( id, get_pcvar_float( g_cvar_speed_spawn ) );

	new szCommand[ 128 ];
	formatex( szCommand, sizeof( szCommand ) - 1, "cl_forwardspeed %.1f;cl_sidespeed %.1f;cl_backspeed %.1f", get_pcvar_float( g_cvar_speed_spawn ), get_pcvar_float( g_cvar_speed_spawn ), get_pcvar_float( g_cvar_speed_spawn ) );
	client_cmd( id, szCommand );

	if( get_pcvar_num( g_cvar_enable_vip_multijump ) )
		if( g_iMultiJumps[ id ] < g_iMaxJumps || !g_iMaxJumps )
			g_iMultiJumps[ id ]++;

	set_user_health( id, get_pcvar_num( g_cvar_health_spawn ) );
	set_user_armor( id, get_pcvar_num( g_cvar_armor_spawn ) );
	set_user_gravity( id, get_pcvar_float( g_cvar_gravity_spawn ) );

	fm_give_item( id, "weapon_hegrenade" );
	fm_give_item( id, "weapon_flashbang" );
	fm_give_item( id, "weapon_flashbang" );
	fm_give_item( id, "weapon_smokegrenade" );

	//GiveRifle( id );
}

public GiveRifle( id ) {

	fm_give_item( id, "weapon_m4a1" );
	cs_set_user_bpammo( id, CSW_M4A1, 300 );

	fm_give_item( id, "weapon_ak47" );
	cs_set_user_bpammo( id, CSW_AK47, 300 );

	fm_give_item( id, "weapon_awp" );
	cs_set_user_bpammo( id, CSW_AWP, 100 );

	fm_give_item( id, "weapon_deagle" );
	cs_set_user_bpammo( id, CSW_DEAGLE, 70 );
}

public task_ShowMessage( taskid ) {

	new id = taskid - TASK_SECRET_MSG;

	ColorChat( id, GREEN, "%s^x01 Vrei sa cumperi si tu^x03 Membru V.I.P^x01? Contacteaza-l pe^x03 %s^x01 la^x03 %s^x01 !!!", g_szTag, YourNick, YourMessenger );

	set_task( get_pcvar_float( g_cvar_show_msgs ) * 0.5, "task_ShowMessage2", id );

	if( task_exists( taskid ) )
		remove_task( taskid );
}

public task_ShowMessage2( id ) {

	ColorChat( id, GREEN, "%s^x01 Vrei sa faci rost de^x03 Membru VIP^x01 si nu stii cum? Tasteaza^x03 /wantvip^x01 !!!", g_szTag );

	set_task( get_pcvar_float( g_cvar_show_msgs ) * 1.2, "task_PrintVipList", id );
}

public task_PrintVipList( user ) {

	new szAdminNames[ 33 ][ 32 ];
	new szMessage[ 256 ];
	new iCount, iLen;
	
	for( new id = 1 ; id <= g_iMaxPlayers ; id++ )
		if( is_user_connected( id ) )
			if( is_user_vip( id ) )
				get_user_name( id, szAdminNames[ iCount++ ], 31 );

	iLen = format( szMessage, 255, "%sVIP's Online: ", COLORG );

	if( iCount > 0 ) {

		for( new i = 0 ; i < iCount ; i++ ) {

			iLen += format( szMessage[ iLen ], 255 - iLen, "^x03%s^x01 | ", szAdminNames[ i ], COLORT, COLORD );

			if( iLen > 96 ) {

				print_message( user, szMessage );
				iLen = format( szMessage, 255, "%s", COLORG );
			}
		}

		print_message( user, szMessage );
	} else {

		iLen += format( szMessage[ iLen ], 255 - iLen, "^x01Nu sunt VIP-i online.", COLORD );
		print_message( user, szMessage );
	}
}

public Ham_ResetMaxSpeedPost( id ) {

	if( is_user_alive( id ) && is_user_vip( id ) && get_user_maxspeed( id ) != 1.0 ) {

  		new Float:flMaxSpeed;

  		if( g_bUserHas[ id ][ Speed ] )
   			flMaxSpeed = float( get_pcvar_num( g_cvar_speed_spawn ) );

  		if( flMaxSpeed > 0.0 )
   			set_pev( id, pev_maxspeed, flMaxSpeed );
	}
}

public Ham_TakeDamagePre( iVictim, iInflictor, iAttacker, Float:fDamage ) {

	if( iVictim == iAttacker || !is_user_player( iAttacker ) || !is_user_alive( iAttacker ) || is_user_bot( iAttacker ) )
		return HAM_HANDLED;

	if( is_user_vip( iAttacker ) && is_user_player( iAttacker ) )
		SetHamParamFloat( 4, fDamage * get_pcvar_float( g_cvar_multidmg ) );

	return HAM_IGNORED;
}

public MessageScoreAttrib( iMsgId, iMsgDest, id ) {

	if( get_pcvar_num( g_cvar_ebable_vip_scoreboard ) ) {

		new iPlayer = get_msg_arg_int( SCOREATTRIB_ARG_PLAYERID );
        
		if( access( iPlayer, read_flags( g_szVipFlags ) ) )
			set_msg_arg_int( SCOREATTRIB_ARG_FLAGS, ARG_BYTE, SCOREATTRIB_FLAG_VIP );
	}
}

public MessageScreenFade( iMsgId, iMsgDest, id ) {

	if( is_user_vip( id ) && is_user_alive( id ) && get_pcvar_num( g_cvar_enable_vip_noflash ) ) {

		static szData[ 4 ];

		szData[ 0 ] = get_msg_arg_int( 4 );
		szData[ 1 ] = get_msg_arg_int( 5 );
		szData[ 2 ] = get_msg_arg_int( 6 );
		szData[ 3 ] = get_msg_arg_int( 7 );
		
		if( szData[ 0 ] == 255 && szData[ 1 ] == 255 && szData[ 2 ] == 255 && szData[ 3] > 199 )
			return 1;
	}

	return 0;
}

public check_time(  ) {

	static preluare_ora[ 3 ], ora;
	get_time( "%H", preluare_ora, 2 );

	ora = str_to_num( preluare_ora );

	if( FIRST_HOUR >= ora || ora < LAST_HOUR ) {

		if( !VipEvent )
			ColorChat( 0, GREEN, "^x04%s^x01 Eventul^x03 Free VIP^x01 a fost activat!", g_szTag );

		VipEvent = true;
		server_cmd( "amx_default_access ^"t^"" );
	} else {

		if( VipEvent )
			ColorChat( 0, GREEN, "^x04%s^x01 Eventul^x03 Free VIP^x01 a fost activat!", g_szTag );

		VipEvent = false;
		server_cmd( "amx_default_access ^"z^"" );
	}

	server_cmd( "amx_reloadadmins" );
}

public hud_mess(  ) {

	if( VipEvent ) {

		set_hudmessage( 200, 200, 10, -1.0, 0.0, 1, 1.0, 1.0, 0.1, 0.1 );
		show_hudmessage( 0, "Toti jucatorii beneficiaza de VIP free aceasta ora!" );
	}
}

public ShowAbilityForVip( id ) {

	new iCfgDir[ 32 ], iFile[ 192 ];
        
	get_configsdir( iCfgDir, charsmax( iCfgDir ) );
	formatex( iFile, charsmax( iFile ), "%s/vip.html", iCfgDir );

	show_motd( id, iFile );
}

public ClCmdAddVips( id, level, cid ) {

	if( !cmd_access( id, level, cid, 2 ) )
		return 1;

	new szTarget[ 32 ];
	read_argv( 1, szTarget, 31 );

	new iPlayer = cmd_target( id, szTarget, 8 );

	if( !iPlayer )
		return 1;

	new szPlayerName[ 32 ], szAdminName[ 32 ];
	get_user_name( iPlayer, szPlayerName, charsmax( szPlayerName ) );
	get_user_name( id, szAdminName, charsmax( szAdminName ) );

	AddVIP( id, szPlayerName, VIP_FLAGS, VIP_PASSWORD, VIP_FLAGS_TYPE, szAdminName );
	server_cmd( "amx_reloadadmins" );

	console_print( id, "%s Vip-ul a fost adaugat in lista!", g_szTag );
	ColorChat( 0, GREEN, "^x04%s^x01 Adminul^x03 %s^x01 l-a adaugat ca VIP pe^x03 %s^x01 !", g_szTag, szAdminName, iPlayer );
	ColorChat( iPlayer, GREEN, "^x04%s^x01 Felicitari! Ai fost adaugat ca membru^x03 VIP^x01! VIP-ul se va activa harta viitoare!", g_szTag );

	return 1;
}

stock bool:is_user_vip( id ) {

	if( get_user_flags( id ) & read_flags( g_szVipFlags ) )
		return true;
	
	return false;
}

stock print_message( id, Msg[  ] ) {

	message_begin( MSG_ONE, get_user_msgid( "SayText" ), { 0, 0, 0 }, id );
	write_byte( id );
	write_string( Msg );
	message_end(  );
}

// stocks from "fakemeta_util"
stock fm_give_item( index, const item[  ] ) {

	if( !equal( item, "weapon_", 7 ) && !equal( item, "ammo_", 5 ) && !equal( item, "item_", 5 ) && !equal( item, "tf_weapon_", 10 ) )
		return 0;

	new ent = fm_create_entity( item );

	if( !pev_valid( ent ) )
		return 0;

	new Float:fOrigin[ 3 ];
	pev( index, pev_origin, fOrigin );

	set_pev( ent, pev_origin, fOrigin );
	set_pev( ent, pev_spawnflags, pev( ent, pev_spawnflags ) | SF_NORESPAWN );

	dllfunc( DLLFunc_Spawn, ent );

	new save = pev( ent, pev_solid );

	dllfunc( DLLFunc_Touch, ent, index );

	if( pev( ent, pev_solid ) != save )
		return ent;

	engfunc( EngFunc_RemoveEntity, ent );

	return -1;
}

stock fm_set_user_maxspeed( index, Float:speed = -1.0 ) {

	engfunc( EngFunc_SetClientMaxspeed, index, speed );

	set_pev( index, pev_maxspeed, speed );

	return 1;
}

stock Float:fm_get_user_maxspeed( index ) {

	new Float:speed;
	pev( index, pev_maxspeed, speed );

	return speed;
}

stock fm_set_rendering( entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16 ) {

	new Float:RenderColor[ 3 ];
	RenderColor[ 0 ] = float( r );
	RenderColor[ 1 ] = float( g );
	RenderColor[ 2 ] = float( b );

	set_pev( entity, pev_renderfx, fx );
	set_pev( entity, pev_rendercolor, RenderColor );
	set_pev( entity, pev_rendermode, render );
	set_pev( entity, pev_renderamt, float( amount ) );

	return 1;
}

stock fm_create_entity( const classname[  ] )
	return engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, classname ) );

AddVIP( id, name[  ], accessflags[  ], password[  ], flags[  ], comment[  ]="" ) {

#if defined USING_SQL
	new error[ 128 ], errno;

	new Handle:info = SQL_MakeStdTuple(  );
	new Handle:sql = SQL_Connect( info, errno, error, 127 );

	if( sql == Empty_Handle ) {

		server_print( "[AMXX] %L", LANG_SERVER, "SQL_CANT_CON", error );
#endif
		// Make sure that the users.ini file exists.
		new configsDir[ 64 ];
		get_configsdir( configsDir, 63 );
		format( configsDir, 63, "%s/users.ini", configsDir );

		if( !file_exists( configsDir ) ) {

			console_print( id, "%s File ^"%s^" doesn't exist.", g_szTag, configsDir );
			return;
		}

		// Make sure steamid isn't already in file.
		new line = 0, textline[ 256 ], len;
		const SIZE = 63;
		new line_steamid[ SIZE + 1 ], line_password[ SIZE + 1 ], line_accessflags[ SIZE + 1 ], line_flags[ SIZE + 1 ], parsedParams;

		// <name|ip|steamid> <password> <access flags> <account flags>
		while( ( line = read_file( configsDir, line, textline, 255, len ) ) ) {

			if ( len == 0 || equal( textline, ";", 1 ) )
				continue; // comment line

			parsedParams = parse( textline, line_steamid, SIZE, line_password, SIZE, line_accessflags, SIZE, line_flags, SIZE );

			if( parsedParams != 4 )
				continue;	// Send warning/error?
			
			if( containi( line_flags, flags ) != -1 && equal( line_steamid, name ) ) {

				console_print( id, "%s %s already exists!", g_szTag, name );
				return;
			}
		}
	
		// If we came here, steamid doesn't exist in users.ini. Add it.
		new linetoadd[ 512 ];
		
		if( comment[ 0 ]==0 )
			formatex( linetoadd, 511, "^r^n^"%s^" ^"%s^" ^"%s^" ^"%s^"", name, password, accessflags, flags );

		else
			formatex( linetoadd, 511, "^r^n^"%s^" ^"%s^" ^"%s^" ^"%s^" ; %s", name, password, accessflags, flags, comment );

		console_print( id, "Adding:^n%s", linetoadd );
		
		if( !write_file( configsDir, linetoadd ) )
			console_print( id, "%s Failed writing to %s!", g_szTag, configsDir );
#if defined USING_SQL
	}
	
	new table[ 32 ];

	get_cvar_string( "amx_sql_table", table, 31 );

	new Handle:query = SQL_PrepareQuery( sql, "SELECT * FROM `%s` WHERE (`auth` = '%s')", table, name );
	
	if( !SQL_Execute( query ) ) {

		SQL_QueryError( query, error, 127 );
		server_print( "[AMXX] %L", LANG_SERVER, "SQL_CANT_LOAD_ADMINS", error );
		console_print( id, "[AMXX] %L", LANG_SERVER, "SQL_CANT_LOAD_ADMINS", error );
	} 
		
	else if( SQL_NumResults( query ) )
		console_print( id, "%s %s already exists!", g_szTag, name );

	else {

		console_print( id, "Adding to database:^n^"%s^" ^"%s^" ^"%s^" ^"%s^"", name, password, accessflags, flags );

		SQL_QueryAndIgnore( sql, "REPLACE INTO `%s` (`name`, `password`, `access`, `flags`) VALUES ('%s', '%s', '%s', '%s')", table, name, password, accessflags, flags );
	}

	SQL_FreeHandle( query );
	SQL_FreeHandle( sql);
	SQL_FreeHandle( info );
#endif
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Poftim!
Nu functioneaza man uite imi da eroare bad load si consola server si log amxmodx/logs:
Eroare 1 log
| Afiseaza codul
Image
Eroare 2 consola server
| Afiseaza codul
Image
si inca ceva, vreau sa apara l /vips vipi online si sa am vips.ini in /config acolo pun numele la vipi .. daca se poate te rog
Image
User avatar
YONTU
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2466
Joined: 10 May 2013, 14:25
Detinator Steam: Nu
CS Status: Everyone is looking at ur shoes
Reputatie: Moderator ajutator
Fost scripter eXtreamCS
Location: Gura Humorului
Has thanked: 256 times
Been thanked: 288 times
Contact:

07 Feb 2015, 15:31

trece-l doar cu 2 de x in plugins.ini :))
din

vip.amxxx
in
vip.amxx
„Peste douăzeci de ani vei fi dezamăgit din cauza lucrurilor pe care nu le-ai făcut, nu din cauza celor pe care le-ai făcut.” - Mark Twain
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș


Bio.LeagueCs.Ro - Biohazard v4.4 Xmas Edition
discord: IonutC#5114

Experinta in: Java/Spring boot/Angular/C/C++/C#/Javascript/Python/HTML/CSS/Pawn/SQL
Ai nevoie de ajutorul meu? Ma poti gasi doar la adresa de discord de mai sus.
Post Reply

Return to “Pluginuri eXtream”

  • Information