/* ======================== SPRÓBUJ KURWA SKOPIOWAĆ! ===================================== */
/* ======================== CREATED BY 0x.! mix OFF! ===================================== */
#include <amxmodx>
#include <fakemeta_util>
#include <fakemeta>
#include <fun>
#include <codmod>
#include <hamsandwich>
#include <cstrike>
#define fm_get_user_money(%1) get_pdata_int(%1, MONEY_F)
#define THE_VIP ADMIN_LEVEL_H


#define SCOREATTRIB_VIP (1 << 2)
#define SCOREATTRIB_DEAD (1 << 0) 
#define MONEY_F 115
new cod_vexp, cod_vmoney, cod_vkillhp, cod_vgranaty, cod_vhsxp, cod_vhshp, cod_vhsmoney, cod_vinfo;
new cod_vwyt, cod_vint, cod_vkon, cod_vhp;
new g_MsgScoreAttrib = 0;
new nick_gracza[32]

/* STOKI */

stock fm_set_user_money(index, money, flash = 1)
{
	set_pdata_int(index, MONEY_F, money)
	message_begin(MSG_ONE, get_user_msgid("Money"), _, index);
	write_long(money);
	write_byte(flash ? 1 : 0);
	message_end();
}

/* END OF STOKI */

public plugin_init() 
{
	register_plugin("ProCodVIP", "1.0", "0x?");
	g_MsgScoreAttrib = get_user_msgid("ScoreAttrib");
	register_message(g_MsgScoreAttrib, "messageScoreAttrib");
	RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1);
	
	
	/*================CVARY======================*/
	
	//Dodatkowa ilosc doswiadczenia za zabicie innego gracza:
	cod_vexp = register_cvar("cod_vexp","5");
	//Dodatkowa ilosc pieniedzy za zabicie innego gracza:
	cod_vmoney = register_cvar("cod_vmoney","1000");
	//Dodatkowa ilosc zycia za zabicie innego gracza:
	cod_vkillhp = register_cvar("cod_vkillhp","20");
	//Dodatkowa kondycja gracza:
	cod_vkon = register_cvar("cod_vkon","10");
	//Dodatkowa inteligecja gracza:
	cod_vint = register_cvar("cod_vint","10");
	//Dodatkowa wytrzymalosc gracza:
	cod_vwyt = register_cvar("cod_vwyt","0");
	//Dodatkowe zycie gracza:
	cod_vhp = register_cvar("cod_vhp","10");
	//VIP ma dostawac wszystkie granaty w ilosci 2 (2he, 2flash, 2smoke) 0nie 1tak
	cod_vgranaty = register_cvar("cod_vgranaty","0");
	//Dodatkowa ilosc doswiadczenia za zabicie innego gracza headshootem:
	cod_vhsxp = register_cvar("cod_vhsxp","10");
	//Dodatkowa ilosc zycia za zabicie innego gracza headshootem:
	cod_vhshp = register_cvar("cod_vhshp","1500");
	//Dodatkowa ilosc kasy za zabicie innego gracza headshootem:
	cod_vhsmoney = register_cvar("cod_vhsmoney","30");
	//Informacja (Na serwer wszedl VIP (nick) ) przy wejsciu gracza, 0nie 1tak
	cod_vinfo = register_cvar("cod_vinfo","0");
	
	/*==============KONIEC CVARÓW===============*/
}
public fwHamPlayerSpawnPost(id){
	
	if (is_user_connected(id) && is_user_alive(id) && get_user_flags(id) & THE_VIP) 
	{
		new granaty = get_pcvar_num(cod_vgranaty)		
		if (granaty == 1)
		{
			cod_give_weapon(id, CSW_HEGRENADE);
			cod_give_weapon(id, CSW_FLASHBANG);
			cod_give_weapon(id, CSW_FLASHBANG);
			cod_give_weapon(id, CSW_SMOKEGRENADE);
			cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 2);
			cs_set_user_bpammo(id, CSW_HEGRENADE, 2);
		}
		new hp = get_pcvar_num(cod_vhp);
		new bonus = cod_get_user_health(id, 0, 0, 1);
		if(is_user_alive(id) && bonus < hp)
		{
			cod_set_user_bonus_health(id, cod_get_user_health(id)+ get_pcvar_num(cod_vhp));
			cod_set_user_bonus_trim(id, cod_get_user_trim(id) + get_pcvar_num(cod_vkon));
			cod_set_user_bonus_intelligence(id, cod_get_user_intelligence(id) + get_pcvar_num(cod_vint));
			cod_set_user_bonus_stamina(id, cod_get_user_stamina(id) + get_pcvar_num(cod_vwyt));
		}	
	}
}
public client_death(killer, victim, wpnindex, hitplace, TK)
{ 	
	if (is_user_alive(killer) && (get_user_flags(killer) & THE_VIP))
	{		
		if(hitplace == HIT_HEAD)
		{
			new hs_xp = get_pcvar_num(cod_vhsxp)
			new hs_hp = get_pcvar_num(cod_vhshp)
			new hs_money = get_pcvar_num(cod_vhsmoney)
			cod_set_user_xp(killer, cod_get_user_xp(killer) + hs_xp);
			fm_set_user_money(killer, fm_get_user_money(killer) + hs_money, 1)
			set_user_health(killer, get_user_health(killer) + hs_hp);
			new sync = CreateHudSyncObj();
			set_hudmessage(255, 255, 0, -1.0, 0.01, 1, 6.0, 4.0);
			ShowSyncHudMsg(killer, sync, "^n^n^n^n^n^nVIP: ZA HS DOSTALES +%i XP", hs_xp);
		}	
		else
		{	
			cod_set_user_xp(killer, cod_get_user_xp(killer) + get_pcvar_num(cod_vexp));	
			fm_set_user_money(killer, fm_get_user_money(killer) + get_pcvar_num(cod_vmoney), 1);
			set_user_health(killer, get_user_health(killer) + get_pcvar_num(cod_vkillhp));
				
			new add_exp = get_pcvar_num(cod_vexp);
			new sync = CreateHudSyncObj();
			set_hudmessage(255, 255, 0, -1.0, 0.01, 1, 6.0, 4.0);
			ShowSyncHudMsg(killer, sync, "^n^n^n^n^n^nVIP: ZA KILL DOSTALES +%i XP", add_exp);
		}
	}
	
}
public client_disconnect(id)
{
	new info_vip_con = get_pcvar_num(cod_vinfo)
	if(info_vip_con == 1)
	{
		if (get_user_flags(id) & THE_VIP) 
		{
			get_user_name(id, nick_gracza, 32);
			set_hudmessage(255, 255, 0, 0.04, 0.28, 0, 6.0, 12.0)
			show_hudmessage(0, "Serwer opuscil VIP:^n(%s)", nick_gracza)
		}}
}
public client_authorized(id)
{
	new info_vip_con = get_pcvar_num(cod_vinfo)	
	if(info_vip_con == 1)
	{
		if (get_user_flags(id) & THE_VIP) 
		{
			get_user_name(id, nick_gracza, 32);
			set_hudmessage(255, 255, 0, 0.04, 0.28, 0, 6.0, 12.0)
			show_hudmessage(0, "Na serwer wchodzi VIP!^n(%s)", nick_gracza);}}
		}
public messageScoreAttrib(iMsgID, iDest, iReceiver) 
{   
	new iPlayer = get_msg_arg_int(1);
        
	if(is_user_connected(iPlayer) && (get_user_flags(iPlayer) & THE_VIP))   
	set_msg_arg_int(2, ARG_BYTE, is_user_alive(iPlayer) ? SCOREATTRIB_VIP : SCOREATTRIB_DEAD);
        
}		
/* ======================== SPRÓBUJ KURWA SKOPIOWAĆ! ===================================== */
/* ======================== CREATED BY 0x.! mix OFF! ===================================== */
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/
