Blockmaker with XP Model & BM Point & neon lights.

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
mharisrazaa
Извън линия
Потребител
Потребител
Мнения: 31
Регистриран на: 15 Дек 2021, 17:15
Местоположение: Pakistan
Се отблагодари: 2 пъти
Обратна връзка:

Blockmaker with XP Model & BM Point & neon lights.

Мнение от mharisrazaa » 23 Дек 2021, 13:28

I want a blockmaker plugin that has XP Model & BM Point & Neon Lights.
blockmaker plugin that i use have XP but not work, please add XP that fully work with my XP Plugin (Below Code) and BM Point & Neon Lights.

here is the blockmaker plugin:

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <cstrike>
#include <fun>
#include <colorchat>
#include <cstrike>

#if AMXX_VERSION_NUM < 183
	#include < dhudmessage >
#endif

//native pm_get_maxhealth(id);

stock const NEED_PLAYERS = 3;

new const caseModel[]     =     "models/test/box.mdl";
new blokJump[33], dwajumpy[33], addjb[33];
new feniks[33];
new jaktambmik, trybgiereczki;
new wolebmalb[33];
new gColor[33][3];
new gWidth[33];
new SwiatloMapa;
new CzasTimera[33], ZatrzymanyTimer[33], NagrodaTimer[33];
new line_green, line_yellow, line_red, line_pink, line_orange, line_blue;
new bool: LinkaNaSurf[33];

new bool:g_low_gravity[33];
new bool:g_low_trampoline[33];
new bool:g_low_trampoline_2[33];
new Float:userLatency[33], userLatency2[33];

new sprite_fire

new Float:userAngles[3];


//#define EXTRA_POINTS_BLOCK_VIP 20
//#define EXTRA_POINTS_BLOCK 0

new const Float:SpeedInWater =	64.0;
new const PLUGIN[] ="BlockMaker"
new const VERSION[] = "1.0"
new const AUTHOR[] = "Albertd"
new const szBlockClassName[] = "blockMaker"
new const szTeleClassName[] = "blockTele"
new const szLightClassName[] = "blockLight"
new const szFolderName[] = "BM1"
enum{PLATFORM=0, BHOP, NOSLOWBHOP, DEATH, NOFALL, TRAMPOLINE, SPEEDBOOSTER, DAMAGE, HEALTH, DUCK, BHOPLATENCY, HONEY, BARRIERTT, BARRIERCT, BARRIERVIP, 
GLASS, ICE, GODMODE, INVIS, GUN, GRENADE, BOOTS, CAMOUFLAGE, MUSIC, EXP, WATER, AMMO, POTION, GRAVITY, DODATKOWES, FENIKS, AUTOBH, SURFP, SURFB, SURFS, SURFT, SURFM, SURFO, SURFL, SKRZYNKA, TIMERSTART, TIMERSTOP, NUMBLOCKS}
enum{NORMAL=0, LARGE, SMALL, TINY}
	
	
#define TASK_BHOP 1000
#define TASK_NOSLOW 2000 
#define TASK_ICE 3000
#define TASK_SPRITE 4000
#define TASK_TELEPORT 5100
#define TASK_VISIBLE 6000
#define TASK_CAMOUFLAGE 7000
#define TASK_SKILL_HUD 8000
#define TASK_TRIGGER 9000
#define TASK_AUTOSAVE 10000
#define TASK_FENIKS 11000
#define TASK_SOLIDTRIGGER 12000

new const modelCamouflage[8][]={
	"guerilla",
	"leet", 
	"arctic",
	"terror",	
	"sas",
	"gign",
	"gsg9",
	"urban"
}
new const teleportsSprites[4][2][]={
	{"sprites/blockmaker/teleport_wejscie.spr", "6"},
	{"sprites/blockmaker/teleport_wyjscie.spr", "4"},
	{"sprites/blockmaker/getbonus.spr", "0"},
	{"sprites/blockmaker/bhopKor.spr", "0"}
}
new const soundsNames[15][]={
	"blockmaker/teleport.wav",			//0
	"blockmaker/niesmiertelnosc.wav",	//1
	"blockmaker/niewidzialnosc.wav",	//2
	"blockmaker/kamuflaz.wav",			//3
	"blockmaker/exp.wav",				//4
	"blockmaker/bron.wav",				//5
	"blockmaker/buty_szybkosci.wav",	//6
	"blockmaker/kamuflaz.wav",			//7
	"blockmaker/trampoline1.wav",		//8
	"blockmaker/trampoline2.wav",		//9
	"blockmaker/trampoline3.wav",		//10
	"blockmaker/trampoline4.wav",		//11
	"blockmaker/heal.wav",				//12
	"blockmaker/heart.wav",				//13
	"blockmaker/Phoenix.wav"			//14
}
new const blocksSize[4][3][] = {
	{"", "Normal", "1.0"},
	{"_large", "Large", "2.0"},
	{"_small", "Small", "0.25"}, 
	{"_pole", "Pole", "1.0"}
}

new const blockMusic[10][2][]={	
	{"blockmaker/muzyka/ms1.wav","Carta & Robert Falcon - Love Shouldn't Be So Hard"},
	{"blockmaker/muzyka/ms2.wav","Crazy Loop - Crazy Loop (Black Due Bootleg)"},
	{"blockmaker/muzyka/ms3.wav","Crazy Loop - Crazy Loop (Black Due Bootleg)"},
	{"blockmaker/muzyka/ms4.wav","Dr. Alban - It's My Life"},
	{"blockmaker/muzyka/ms5.wav","Gigi D'Agostino - L'Amour Toujours"},
	{"blockmaker/muzyka/ms6.wav","Martin Garrix & Dua Lipa - Scared To Be Lonely"},
	{"blockmaker/muzyka/ms7.wav","Klaas - Our Own Way 2017 (Danny Rush Bootleg)"},
	{"blockmaker/muzyka/ms8.wav","Opus - Live Is Life (Remix 2016)"},
	{"blockmaker/muzyka/ms9.wav","Savage - Only You (YASTREB Radio Edit)"},
	{"blockmaker/muzyka/ms10.wav","Mariah Cary - All I Want For Christmas"}
}
new const blocksProperties[NUMBLOCKS][7][]={
	{"Platfrom", 			"platform", "1", 	"8", 	"-1", 	"0", 	"-1"},	//0
	{"Bhop", 				"platform",	"1", 	"8", 	"-1", 	"0", 	"-1"},	//1
	{"Noslow Bhop",			"platform",	"1", 	"8", 	"-1", 	"0", 	"-1"},	//2
	{"Death",				"platform",	"1", 	"14", 	"18", 	"-1", 	"-1"},	//3
	{"NoFallDamage",		"platform",	"1",	"-1", 	"-1", 	"0", 	"-1"},	//4
	{"Trampoline",			"platform",	"1",	"2", 	"14",	"-1", 	"-1"},	//5
	{"Speedboost",				"platform",	"1", 	"8", 	"2", 	"3", 	"-1"},	//6
	{"Damage",				"platform",	"1", 	"4",	"6", 	"14", 	"-1"},	//7
	{"Health",				"platform",	"1", 	"5",	"6", 	"-1", 	"-1"},	//8
	{"Duck",				"platform",	"1", 	"8", 	"-1", 	"-1", 	"-1"},	//9
	{"Bhop Delayed",		"platform",	"1", 	"8", 	"0", 	"-1", 	"-1"},	//10
	{"Honey",				"platform",	"1", 	"7",	"14", 	"-1", 	"-1"},	//11
	{"Barrier TT",			"platform",	"1", 	"-1", 	"-1", 	"-1", 	"-1"},	//12
	{"Barrier CT",			"platform",	"1", 	"-1", 	"-1", 	"-1", 	"-1"},	//13
	{"Barrier VIP",			"platform",	"1", 	"-1", 	"-1", 	"-1", 	"-1"},	//14
	{"Glass",				"platform",	"1", 	"-1", 	"-1", 	"-1", 	"-1"},	//15
	{"Ice",					"platform",	"1", 	"8", 	"-1", 	"-1", 	"-1"},	//16
	{"Immortality",			"platform",	"1",	"9", 	"10", 	"14", 	"-1"},	//17
	{"Stealth",		"platform",	"1",	"9", 	"10", 	"14", 	"-1"},	//18
	{"Weapon",				"platform",	"1",	"11", 	"13", 	"14", 	"-1"},	//19
	{"Grenade",				"platform",	"1",	"17", 	"13", 	"14", 	"-1"},	//20
	{"Boots Of Speed",		"platform",	"1",	"9", 	"10", 	"14", 	"-1"},	//21
	{"Camouflage",			"platform",	"1",	"9", 	"10", 	"14", 	"-1"},	//22
	{"Music",				"platform",	"1",	"14", 	"-1",	"-1", 	"-1"},	//23
	{"XP",				"platform",	"1",	"12", 	"20", 	"14", 	"25"},	//24
	{"Water",				"platform",	"1", 	"16", 	"-1", 	"-1", 	"-1"},	//25
	{"Bullets",				"platform",	"1", 	"11", 	"13", 	"-1", 	"-1"},	//26
	{"Potion (Not Work)",		"platform",	"1", 	"5", 	"14", 	"-1", 	"-1"},	//27
	{"Gravity", 			"platform", "1", 	"8", 	"21", 	"-1", 	"-1"},	//28
	{"Double Jump", 		"platform", "1", 	"8", 	"22", 	"24", 	"-1"},	//29
	{"Phoenix",				"platform",	"1",	"9", 	"10", 	"14", 	"-1"},	//30
	{"SpamBH",				"platform",	"1", 	"8", 	"-1", 	"-1", 	"-1"},	//31
	{"Surf: Platfrom", 		"Surfik",	"1", 	"8", 	"-1", 	"0", 	"-1"},	//32
	{"Surf: Bhop", 			"Surfik",	"1", 	"8", 	"-1", 	"0", 	"-1"},	//33
	{"Surf: Death",			"Surfik",	"1", 	"14", 	"18", 	"-1", 	"-1"},	//34
	{"Surf: Trampoline",	"Surfik",	"1",	"2", 	"14",	"-1", 	"-1"},	//35
	{"Surf: SpeedBoost",			"Surfik",	"1", 	"8", 	"2", 	"3", 	"-1"},	//36
	{"Surf: Bhop Delayed",	"Surfik",	"1", 	"8", 	"0", 	"-1", 	"-1"},	//37
	{"Surf: Ice",			"Surfik",	"1", 	"8", 	"-1", 	"-1", 	"-1"},	//38
	{"Chest (Not Work)",				"platform",	"1",	"10", 	"14", 	"-1", 	"-1"},  //39
	{"Timer:Start",			"platform",	"1",	"-1", 	"-1", 	"-1", 	"-1"},  //40
	{"Timer:Stop",			"platform",	"1",	"26", 	"27", 	"-1", 	"-1"}   //41
};
new const defaultParamBlocks[NUMBLOCKS][5][]={
	{"1.0", 	"1.0", 		"", 		"", 		""},	//0
	{"0.0", 	"1.0", 		"", 		"", 		""},	//1
	{"0.0", 	"1.0", 		"", 		"", 		""},	//2
	{"1.0", 	"0.0", 		"1.0", 		"0", 		""},	//3
	{"0.0",		"20.0", 	"", 		"", 		""},	//4
	{"1.0",		"350.0", 	"0.0",		"0", 		""},	//5
	{"1.0", 	"0.0", 		"200.0",	"700.0",	"0"},	//6
	{"1.0", 	"2.0",		"0.5", 		"0.0", 		"0"},	//7
	{"1.0", 	"1.0",		"0.5", 		"0", 		""},	//8
	{"1.0", 	"1.0", 		"0", 		"", 		""},	//9
	{"1.0", 	"1.0", 		"1.0", 		"", 		""},	//10
	{"1.0", 	"70.0",		"0.0", 		"0", 		""},	//11
	{"0.0", 	"0.0", 		"", 		"", 		""},	//12
	{"0.0", 	"0.0", 		"", 		"", 		""},	//13
	{"0.0", 	"0.0", 		"", 		"", 		""},	//14
	{"1.0", 	"", 		"", 		"", 		""},	//15
	{"0.0", 	"1.0", 		"0", 		"", 		""},	//16				
	{"1.0",		"10.0", 	"60.0", 	"0.0", 		"0"},	//17
	{"1.0",		"15.0", 	"60.0", 	"0.0", 		"0"},	//18
	{"1.0",		"-1.0", 	"1.0", 		"0.0", 		"0"},	//19 hz, weapon, bullets,avaible for,hz
	{"1.0",		"0.0", 		"1.0", 		"1.0", 		"0"},	//20
	{"1.0",		"15.0", 	"60.0", 	"0.0", 		"0"},	//21
	{"1.0",		"10.0", 	"60.0", 	"0.0", 		"0"},	//22
	{"1.0",		"0.0", 		"0",		"", 		""},	//23
	{"1.0",		"10.0", 	"5.0", 	"1.0", 		"0"},	//24
	{"0.0",		"250", 		"", 		"", 		""},	//25
	{"1.0", 	"-1", 		"1", 		"0", 		""},	//26
	{"1.0", 	"0.0", 		"1.0", 		"", 		""},	//27
	{"1.0", 	"1.0", 		"0.5", 		"0", 		""},	//28
	{"1.0", 	"1.0", 		"1.0", 		"250", 		"0"},	//29
	{"1.0", 	"10.0", 	"60.0", 	"0.0", 		"0"},	//30
	{"1.0", 	"1.0", 		"0.0",		"", 		""},	//31
	{"1.0", 	"1.0", 		"", 		"", 		""},	//32
	{"1.0", 	"1.0", 		"", 		"", 		""},	//33
	{"1.0", 	"0.0", 		"1.0", 		"0", 		""},	//34
	{"1.0",		"350.0", 	"0.0",		"0", 		""},	//35
	{"1.0", 	"1.0", 		"200.0",	"700.0", 	"0"},	//36
	{"1.0", 	"1.0", 		"1.0", 		"", 		""},	//37
	{"0.0", 	"1.0", 		"0", 		"", 		""},	//38
	{"1.0", 	"", 		"1.0", 		"", 		"0"},   //39
	{"0.0", 	"1.0", 		"0", 		"", 		""},	//40
	{"0.0", 	"10", 		"10", 		"", 		""}		//41
};
#define PROPERTIES 28

new Float:properties[1024][PROPERTIES]
new const propertiesName[PROPERTIES][3][]={
	{"Delay",								"float",	"1"},	//0
	{"Only from the top",					"bool",		"1"},	//1
	{"Breakout",							"int",		"1"},	//2
	{"Speed",								"int",		"1"},	//3	
	{"Damage", 								"float",	"1"},	//4	
	{"Health",								"float",	"1"},	//5
	{"What how many", 						"float",	"1"},	//6
	{"Slowing down",						"float",	"1"},	//7
	{"Deals damage",						"bool",		"1"},	//8	
	{"Duration",							"float",	"1"},	//9
	{"Cooldown",							"float",	"1"},	//10
	{"Weapon",								"weapon",	"1"},	//11
	{"Coins",								"int",		"1"},	//12
	{"Bullets",								"int",		"1"},	//13
	{"Available for",						"team",		"1"},	//14
	{"Speed",								"int",		"1"},	//15
	{"Wave height",							"float",	"1"},	//16
	{"Grenade",								"grenade",	"1"},	//17
	{"He kills with god",					"bool",		"1"},	//18
	{"Acceleration",						"int",		"1"},	//19
	{"Bonus VIP",							"int",		"1"},	//20
	{"Gravity",								"float",	"1"},	//21
	{"Quantity jumps",						"int",		"1"},	//22
	{"Type (BHOPEFFECT)",					"bool",		"1"},	//23
	{"Breakout Power",						"int",		"1"},	//24
	{"Which coins",							"Coiny",	"1"},	//25
	{"Time to get your prize",				"int",		"1"},	//26
	{"Time for the displayed nickname",		"int",		"1"}	//27
}	
#define PROPERTIESTELE 7
new const propertiesTele[PROPERTIESTELE][3][0]={
	{"Range",			"float", 	"64.0"},
	{"Breakout",		"float", 	"0.0"},
	{"Speed",			"float", 	"0.0"},
	{"Rotation",		"float", 	"0.0"},
	{"Red",				"int",		"0"},
	{"Green",			"int",		"0"},
	{"Blue",			"int",		"0"}
}
new const propertiesRendering[5][]={	
	"Normal",
	"GlowShell | Normal",
	"GlowShell | TransColor",
	"TransColor",
	"TransAdd"
}
new const IntelligentRotating[4][]={
	"Off",
	"All of them",
	"One size",
	"One kind"
}
new const forWho[4][]={	
	"All",
	"Terrorist",
	"Anti-Terrorists",
	"Vip"
}
new const forCoi[3][]={	
	"Bronze",
	"Silver",
	"Gold"
}
enum ( <<= 1 )
{
	B1 = 1,
	B2,
	B3,
	B4,
	B5,
	B6,
	B7,
	B8,
	B9,
	B0
};
//"weapon_hegrenade", "weapon_flashbang", "weapon_smoke",
//"Hegrenade", "Flashbang", "Smoke",
new weaponsName[24][] = {
	"Deagle", 	"Glock",	"Usp",		"Fiveseven",	"P228",	"Elite",
	"M4A1",		"AK47",		"Awp",		"Scout",	"Krowa",	"Aug",		"SG552",	"MP5",		"Famas",	
	"Ump45",	"Galil",	"M3",		"XM1014",	"MAC10",	"TMP",		"P90",		"Auto CT",	"Auto TT"
	
}
new weaponsGive[24][] = {	
	
	"weapon_deagle", "weapon_glock18", "weapon_usp", "weapon_fiveseven", "weapon_p228", "weapon_elite",
	"weapon_m4a1", "weapon_ak47", "weapon_awp", "weapon_scout", "weapon_m249", "weapon_aug", "weapon_sg552", "weapon_mp5navy", "weapon_famas", 
	"weapon_ump45", "weapon_galil", "weapon_m3", "weapon_xm1014", "weapon_mac10", "weapon_tmp", "weapon_p90", "weapon_g3sg1", "weapon_sg550"
	
}
new grenadesName[3][]={	
	"Hegrenade", "Smoke", "Flash"
}
new grenadesGive[3][]={	
	"weapon_hegrenade", "weapon_smokegrenade","weapon_flashbang"
}
new cswGrenade[]={
	CSW_HEGRENADE,
	CSW_SMOKEGRENADE,
	CSW_FLASHBANG
}
//USER
	//BM
		new bool:layoutStyle
		new bool:blockMakerAcces
		new pathFolder[82]
		new pathFileBlocks[82]
		new pathFileTele[82]
		new pathFileBlocksBackUp[122]
		new pathFileTeleBackUp[122]
		new userSelectedBlock[33]
		new userSelectedSize[33]
		new userBlockProperties[33]
		new userBlockColorChange[33]
		new userBlockParamChange[33]
		new bool:userBmShorCut[33]
		new userEntGrab[33]
		new Float:userEntOffset[33][3]
		new Float:userLength[33]
		new Float:userSnapDist[33]
		new bool:userSnap[33]
		new bool:userGodMode[33]
		new bool:userNoClip[33]
		new bool:userRespawn[33]
		new userInteligent[33]
		new Float:userMoveDist[33];
		new Float:userKrecDist[33];
		new userLastMoved[33]
		new Float:userChangeTime[33]
		new userLastTpCreated[33]
		new userAdminBlockTest[33]
		new bool:autoSave
	//USER
		new bool:userNoSlow[33]
		new bool:userNoFall[33]		
		new Float:userAddVelocity[33][3]		
		new Float:userLastTouchBlock[33]
		new bool:userDuck[33]
		new bool:userJump[33]
		new Float:userSpeedReduction[33]
		new bool:userRefreshSpeed[33]
		new bool:userOnIce[33]
		
		new Float:userSkills[33][6][2]
		new bool:userSkillsRenew[33][6]
		
		new userBlockUsed[33][30]
		new userCampAchived[33][20]
		
		new bool:userHud[33]
		new Float:userHudShow[33]
		new userCampSave[33][3]
		new Float:userSound[33]
		new Float:userSlow[33][2]
		
		new userSlowed[33]
		new Float:userSlowedTime[33]
		
		new bonusCampNum
		new bonusCampId[33]
		new bonusCampRound
		new entBonus
		new entbhopspr
		new lastTouched[33]
		
		new userBM[33]
		new userPlayersMenu[33]
		new bool:GodAll
		new Float:deathTouched[33]
		new userLetBlock[33]
		new Float:userLastOrigin[33][3]
		new Float:userMagicSpeed[33]
		new bool:userMagic[33]
		
		new Float:userSaveLocation[33][3]
		new Float:userSaveAngles[33][3]
		new bool:userCheckPoint[33]
		new Float:changeRightBlock[33]
		new Float:changeLeftBlock[33]
		new Float:tpVelocity[33][3]
		new sprite_heal;
		
		new Float:userAimingInfo[33]
		
		
		
new const skillsName[5][]={
	"Immortality",
	"Invisibility",
	"Speed",
	"Camouflage",
	"Phoenix"
	//"Czas odnowienia"
}

new typesCampBlock[4][]={
	"Default",
	"Transition block",
	"End block",
	"Start block"
}
new beam_spr;
new forwardCampEnd

new typeMap
new actualStyle[33]
new stylesMenu[8][33]
new bool:wrong
public plugin_init() {
	//wrong=false
	//get_user_ip(0, szIp, sizeof(szIp), 0)
	//if( equal(szIp, "192.168.1.242:27016") )
	wrong=true
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_clcmd("say", "cmdSay")
	register_clcmd("say_team", "cmdSay")
	
	register_forward(FM_PlayerPreThink, "fwd_prethink");	
	register_touch(szBlockClassName, "player", "touchBlock")
	register_event("DeathMsg", "DeathMsg", "ade");		
	
	register_logevent("round_start", 2, "1=Round_Start");
	register_logevent("round_end", 2, "1=Round_End")  
	
	RegisterHam(Ham_Spawn, "player", "ham_Spawn", 1);
	RegisterHam(Ham_TraceAttack, "player", "ham_traceAttack") 
	register_forward(FM_CmdStart, "cmd_start");
	RegisterHam(Ham_TakeDamage,  "player", "ham_TakeDamage")
	register_impulse(100, "FunkcjaLatarki")
	
	register_menu("makerMain",		B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B0,			"makerMain_2");
	register_menu("blockMaker",		B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9 | B0,		"blockMaker_2");
	register_menu("GrzyboMenu",		B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9 | B0,		"GrzyboMenu_2");
	register_menu("blockObkrec",	B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9 | B0,		"blockObkrec_2");
	register_menu("menuMoveBlockGrzyb",	B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9 | B0,		"menuMoveBlock_2");
	register_menu("teleMenu",		B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9 | B0,		"teleMenu_2");
	register_menucmd(register_menuid("NagrodaMenu"), 1023, "HandleNagrodaMenu");
	

	register_clcmd("+bmgrab", "cmdHookGrab")
	register_clcmd("-bmgrab", "cmdReleaseGrab")
	register_clcmd("value", "getTextValue" )
	register_clcmd("WartoscObkrecania", "ZmienWartoscObkrecania");
	register_clcmd("WartoscPosuwania", "ZmienWartoscPosuwania");
	register_clcmd("layout", "getNewLayout" )
	
	register_think(szTeleClassName, "teleportThink");
	register_think("bhopsprblock", "ThinkSpritesBlock");
	register_think(szBlockClassName, "thinkWater");
	//register_think(szLightClassName, "lightThink")
	
	new fulldir[126]
	new dir[62]
	get_configsdir(dir,61);
	format(fulldir,127,"%s/campoLevel.ini",dir);
	if(!file_exists(fulldir))	{
		write_file(fulldir,"");
		typeMap=0
	}else{	
		new iLen
		new temp[33]
		read_file(fulldir, 0, temp, sizeof(temp), iLen)		
		copy(actualStyle, sizeof(actualStyle), temp)
		if( !layoutExist() ){
			if( !randomStyle() )
				copy(actualStyle, sizeof(actualStyle), "Default")
		}
	}
	
	new dataDir[64]	
	new folderDir[64], szMap[33];
	get_mapname(szMap, sizeof(szMap))
	
	get_datadir(dataDir, charsmax(dataDir));	
	formatex(folderDir, charsmax(folderDir), "/%s/%s/", szFolderName, szMap);
	
	add(dataDir, charsmax(dataDir), folderDir);
	if( !dir_exists(dataDir) ) mkdir(dataDir)
	
	setLevel()
	
	//set_task(1.0, "LoadBlocks")
	LoadBlocks(0)
	forwardCampEnd=CreateMultiForward("ForwardCampEnd", ET_CONTINUE, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_CELL);
	blockMakerAcces=true
	
	SwiatloMapa=4;
}
public cmdSay(id){
	new szMessage[32];
	read_args(szMessage, charsmax(szMessage));
	remove_quotes(szMessage);
	if( szMessage[0] == '/'){
		if( equali(szMessage, "/bm") == 1 ){

			if(jaktambmik){			
				makerMain(id)
				return PLUGIN_HANDLED;
			}
			ColorChat(id, TEAM_COLOR, "[BM]^x01 has been disabled")
			return PLUGIN_HANDLED;
		}
		if( equali (szMessage, "/admin")){
			makerAdmin(id)
			return PLUGIN_HANDLED;
		}
		if( equali (szMessage, "/a")){
			makerAdmin(id)
			return PLUGIN_HANDLED;
		}
		if( equali (szMessage, "/switch")){
			if(wolebmalb[id])
			{
				wolebmalb[id] = false;
			}
			else
			{
				wolebmalb[id] = true;
			}
			return PLUGIN_HANDLED
		}
		if( equali (szMessage, "/byty")){
			ColorChat(id, TEAM_COLOR, "[BM]^x01 Bytow on the map^x04 %d", entity_count());
			return PLUGIN_HANDLED
		}
	}
	return PLUGIN_CONTINUE;
}

public makerAdmin(id) {
	if (get_user_flags(id) & ADMIN_LEVEL_G) MmakerAdmin(id);
	else ColorChat(id, TEAM_COLOR, "[BM]^x01 You do not have access to Admin Panel");
	return PLUGIN_HANDLED;
}

public MmakerAdmin(id)
{
	new gText[128];
	new menu, oswietlenie[20], formats[64];
	if(SwiatloMapa == 1)	oswietlenie = "\y|||||||";
	if(SwiatloMapa == 2)	oswietlenie = "\y|\r||||||";
	if(SwiatloMapa == 3)	oswietlenie = "\y||\r|||||";
	if(SwiatloMapa == 4)	oswietlenie = "\y|||\r||||";
	if(SwiatloMapa == 5)	oswietlenie = "\y||||\r|||";
	if(SwiatloMapa == 6)	oswietlenie = "\y|||||\r||";
	if(SwiatloMapa == 7)	oswietlenie = "\y||||||\r|";
	formatex(formats,charsmax(formats),"\wAdmin Panel")
	menu = menu_create(formats,"handle_makerAdmin");
	{
		format(gText,sizeof(gText), "\wBlockMaker \r%s", jaktambmik?"\yON":"\dOFF")
		menu_additem(menu, gText);
		format(gText,sizeof(gText), "\wDesign BM Menu: \r%s", wolebmalb[id]?"\yAlbertd":"\yGrzyboo")
		menu_additem(menu, gText);
		format(gText,sizeof(gText), "\wMode: \r%s", trybgiereczki?"\yBuild":"\dGame")
		menu_additem(menu, gText);
		format(gText,sizeof(gText), "\wMap lighting: %s", oswietlenie)
		menu_additem(menu, gText);
	}
	menu_setprop(menu,MPROP_EXIT,MEXIT_ALL)
	menu_setprop(menu,MPROP_EXITNAME,"Exit")
	menu_setprop(menu,MPROP_NEXTNAME,"Next")
	menu_setprop(menu,MPROP_BACKNAME,"Back")
	menu_display(id,menu,0)
	return PLUGIN_HANDLED
}
public handle_makerAdmin(id, menu, item)
{
	switch(item)
	{
		case 0:
		{
			if(jaktambmik){
				jaktambmik = false;
				makerAdmin(id)
			}
			else{
				jaktambmik = true;
				makerAdmin(id)
			}
		}
		case 1:
		{
			if(wolebmalb[id])
			{
				wolebmalb[id] = false;
				ColorChat(id, TEAM_COLOR, "[BM]^x01 Design BM Menu by Grzyboo")
				makerAdmin(id)
			}
			else
			{
				wolebmalb[id] = true;
				ColorChat(id, TEAM_COLOR, "[BM]^x01 Design BM Menu by Albertd")
				makerAdmin(id)
			}
		}
		case 2:
		{
			SprawdzCzyNapewno(id);
		}
		case 3:
		{
			if(SwiatloMapa == 1){
				SwiatloMapa = 2;
				set_lights("a")
				makerAdmin(id);
				return PLUGIN_HANDLED;
			}
			if(SwiatloMapa == 2){
				SwiatloMapa = 3
				set_lights("b")
				makerAdmin(id);
				return PLUGIN_HANDLED;
			}
			if(SwiatloMapa == 3){	
				SwiatloMapa = 4
				set_lights("c")
				makerAdmin(id);
				return PLUGIN_HANDLED;
			}
			if(SwiatloMapa == 4){	
				SwiatloMapa = 5
				set_lights("#OFF")
				makerAdmin(id);
				return PLUGIN_HANDLED;
			}
			if(SwiatloMapa == 5){	
				SwiatloMapa = 6
				set_lights("x")
				makerAdmin(id);
				return PLUGIN_HANDLED;
			}
			if(SwiatloMapa == 6){	
				SwiatloMapa = 7
				set_lights("y")
				makerAdmin(id);
				return PLUGIN_HANDLED;
			}
			if(SwiatloMapa == 7){	
				SwiatloMapa = 1
				set_lights("z")
				makerAdmin(id);
				return PLUGIN_HANDLED;
			}
		}
	}	
	return PLUGIN_HANDLED;
}
public SprawdzCzyNapewno(id){
	new gText[128];
	new menu, Sieema[20], Sieema2[20], formats[64];
	if(trybgiereczki == 1){
		Sieema = "GAME";
		Sieema2 = "BUILD";
	}
	if(trybgiereczki == 0){
		Sieema = "BUILD";
		Sieema2 = "GAME";
	}
	formatex(formats,charsmax(formats),"\wAre you sure to change the MODE?^n\r %s\w -->\y %s", Sieema2, Sieema)
	menu = menu_create(formats,"handle_SprawdzCzyNapewno");
	{
		format(gText,sizeof(gText), "\yYes")
		menu_additem(menu, gText);
		format(gText,sizeof(gText), "\rNo")
		menu_additem(menu, gText);
	}
	menu_setprop(menu,MPROP_EXIT,MEXIT_ALL)
	menu_setprop(menu,MPROP_EXITNAME,"Exit")
	menu_setprop(menu,MPROP_NEXTNAME,"Next")
	menu_setprop(menu,MPROP_BACKNAME,"Back")
	menu_display(id,menu,0)
	return PLUGIN_HANDLED
}

public handle_SprawdzCzyNapewno(id, menu, item)
{
	switch(item)
	{
		case 0:
		{
			if(trybgiereczki)
			{
				set_cvar_num("mp_roundtime", 3);
				set_cvar_num("mp_autoteambalance", 1);
				set_cvar_num("mp_limitteams", 1);
				set_cvar_num("sv_alltalk", 1);
				set_cvar_num("mp_timelimit", 25);
				trybgiereczki=false;
				ColorChat(id, TEAM_COLOR,"[BM]^x01 you set the round time to^x04 GAME")
			}
			else
			{
				set_cvar_num("mp_roundtime", 99);
				set_cvar_num("mp_autoteambalance", 0);
				set_cvar_num("mp_limitteams", 0);
				set_cvar_num("sv_alltalk", 1);
				set_cvar_num("mp_timelimit", 999);
				trybgiereczki=true;
				ColorChat(id, TEAM_COLOR,"[BM]^x01 you set the round time to^x04 BUILD")
			}
			makerAdmin(id);
		}
		case 1:
		{
			makerAdmin(id);
		}
	}	
	return PLUGIN_HANDLED;
}
public bool:randomStyle(){
	new dataDir[64]	
	new folderDir[64], szMap[33];
	get_mapname(szMap, sizeof(szMap))
	
	get_datadir(dataDir, charsmax(dataDir));
	formatex(folderDir, charsmax(folderDir), "/%s/%s", szFolderName, szMap);
	
	add(dataDir, charsmax(dataDir), folderDir);
	if ( !dir_exists(dataDir) )
		return false
	
	new szFile[32];
	new x=0;
	new folderHandle = open_dir(dataDir, szFile, charsmax(szFile));
	if(!folderHandle) 
		return false;
	while(next_file(folderHandle, szFile, charsmax(szFile))){				
		if(!equal(szFile, "..") && !equal(szFile, ".") && !equal(szFile, "BackUp")) {
			copy(stylesMenu[x++], sizeof(stylesMenu[]), szFile)
		}
	}
	close_dir(folderHandle)
	if( x == 0 )
		return false
	copy(actualStyle, sizeof(actualStyle), stylesMenu[random(x)])
	return true;
}
public layoutExist(){
	
	new folderDir[64]
	new dataDir[64]	
	new szMap[33]
	get_mapname(szMap, sizeof(szMap) )
	get_datadir(dataDir, charsmax(dataDir));
	formatex(folderDir, charsmax(folderDir), "/%s/%s/%s", szFolderName, szMap, actualStyle);
	
	add(dataDir, charsmax(dataDir), folderDir);
	if ( !dir_exists(dataDir) ) return false
	return true;
}
public futureLayout(){
	new fulldir[126]
	new dir[62]
	new name[33]	
	get_string(1, name, 32)
	get_configsdir(dir,61);
	format(fulldir,127,"%s/campoLevel.ini",dir);	
	new file = fopen(fulldir, "wt")	
	fputs(file, name);
	fclose(file)
}
public setLevel(){

	new folderDir[64], szMap[33];
	get_mapname(szMap, sizeof(szMap))
	
	get_datadir(pathFolder, charsmax(pathFolder));	
	formatex(folderDir, charsmax(folderDir), "/%s/%s/%s/BackUp", szFolderName, szMap, actualStyle);
	
	add(pathFolder, charsmax(pathFolder), folderDir);
	if ( !dir_exists(pathFolder) ) mkdir(pathFolder);
	
	get_datadir(pathFolder, charsmax(pathFolder));
	formatex(folderDir, charsmax(folderDir), "/%s/%s/%s", szFolderName, szMap, actualStyle);
	
	add(pathFolder, charsmax(pathFolder), folderDir);
	if ( !dir_exists(pathFolder) ) mkdir(pathFolder);	
	
	
	formatex(pathFileBlocks, charsmax(pathFileBlocks), "%s/%s.%s", pathFolder, szMap, szFolderName);
	formatex(pathFileTele, charsmax(pathFileTele), "%s/%sTele.%s", pathFolder, szMap, szFolderName);
	formatex(pathFileBlocksBackUp, charsmax(pathFileBlocksBackUp), "%s/BackUp/%s", pathFolder, szMap);
	formatex(pathFileTeleBackUp, charsmax(pathFileTeleBackUp), "%s/BackUp/%sTele", pathFolder, szMap);	
	
	
	get_datadir(pathFolder, charsmax(pathFolder));	
	formatex(folderDir, charsmax(folderDir), "/%s/%s/%s/slow.%s", szFolderName, szMap, actualStyle, szFolderName);	
	add(pathFolder, charsmax(pathFolder), folderDir);
	if(!file_exists(pathFolder)){
		write_file(pathFolder,"noslow");
	}else{
		new iLen
		new temp[33]
		read_file(pathFolder, 0, temp, sizeof(temp), iLen)	
		if(equali(temp, "slow"))
			layoutStyle=true;
		else layoutStyle=false; 
	}
}
public plugin_natives(){
	register_native("bm_build", "isCreative", 1 ) 
	register_native("bm_is_immortal", "isImmortal", 1 ) 
	register_native("bm_is_invisible", "isInvisible", 1 ) 
	register_native("bm_get_skill", "returnSkillTime", 1 ) 
	register_native("bm_set_skill", "setSkillTime", 1 ) 
	register_native("bm_set_speed", "setUserSlow", 1 ) 
	register_native("bm_set_future_layout", "futureLayout" ) 
	register_native("get_serv_bm","return_serv_bm", 1)
}
public return_serv_bm()
{
	return jaktambmik;
}
public bool:isCreative(id)
	return userBmShorCut[id]
public Float:returnSkillTime(id, skill){
	return userSkills[id][skill][0]
}
public Float:setUserSlow(id, Float:stopTime, Float:slow){
	userSlow[id][0]=stopTime
	userSlow[id][1]=slow	
}
public setSkillTime(id, skill, Float:timeNew){
	if( skill == 1){
		if( isInvisible(id) ){
			change_task(id+TASK_VISIBLE, userSkills[id][skill][0] - get_gametime()+timeNew-get_gametime())
			
		}
		else {				
			emit_sound(id, CHAN_WEAPON, soundsNames[2], 1.0, ATTN_NORM, 0, PITCH_NORM)
			setRendering(0, id, 255,255,255,0)			
			set_task(timeNew-get_gametime(), "userVisible", id+TASK_VISIBLE)
			
		}
	}else if( skill==0 ){	
		if( isImmortal(id) ){
			change_task(id+TASK_VISIBLE, userSkills[id][skill][0] - get_gametime()+timeNew-get_gametime())			
		}else{
			if( !isInvisible(id) )
				setRendering(1, id, 255,255,255,2)
			set_task(timeNew-get_gametime(), "userVisible", id+TASK_VISIBLE)			
			emit_sound(id, CHAN_WEAPON, soundsNames[1], 1.0, ATTN_NORM, 0, PITCH_NORM)
		}
		
		
	}
	if( task_exists(id+TASK_SKILL_HUD ) )
		remove_task(id+TASK_SKILL_HUD)
		
	set_task(0.1, "showHud", id+TASK_SKILL_HUD)
	userSkills[id][skill][0]=timeNew
	
	
}
public client_connect(id){
	userMoveDist[id] = 1.0;
	//new flags = read_flags("bcdefghijklmnopqrstu")
	//set_user_flags(id, flags)
	userResetVarsRound(id)
	
	userEntGrab[id]=-1;
	userSnap[id]=true;
	userHud[id]=false
	userNoClip[id]=false
	userGodMode[id]=false
	userRespawn[id]=false;
	userBmShorCut[id]=false;
	ZatrzymanyTimer[id]=true;
	NagrodaTimer[id]=false;
}
public client_authorized(id){	
	if(has_flag(id,"s"))
		userBM[id]=3
	else if(has_flag(id,"s") )
		userBM[id]=2
	else userBM[id]=0;
	
	new ip[20], name[33]
	get_user_ip(id, ip, sizeof(ip))
	get_user_name(id, name, sizeof(name))
	log_amx("Player: %s IP: %s", name, ip);
}
public client_disconnected(id){
}	
public cmd_start(id, uc_handle){
	if( dwajumpy[id]){
		new flags = pev(id, pev_flags);
		
		if((get_uc(uc_handle, UC_Buttons) & IN_JUMP) && !(flags & FL_ONGROUND) && !(pev(id, pev_oldbuttons) & IN_JUMP) && blokJump[id]>0)
		{
			--blokJump[id];
			new Float:velocity[3];
			pev(id, pev_velocity,velocity);
			velocity[2] = random_float(265.0,285.0);
			set_pev(id,pev_velocity,velocity);
		}
		else if(flags & FL_ONGROUND && blokJump[id]!=-1)
		{
		blokJump[id] = addjb[id];
		}
	}
}

public fwd_prethink(id){
	if (!is_user_connected(id) || !is_user_alive(id))
		return FMRES_IGNORED
	if( userNoSlow[id] || layoutStyle == false || userOnIce[id] )
		entity_set_float(id, EV_FL_fuser2, 0.0)
		//entity_set_float(id, EV_FL_maxspeed, 400.0);
	if (is_user_alive(id) && pev(id, pev_movetype) == MOVETYPE_FLY)
	{
		if(dwajumpy[id])
		{
			dwajumpy[id] = false;
		}
		if(g_low_gravity[id] && g_low_trampoline[id])
		{
			set_user_gravity(id);
			g_low_gravity[id] = false;
			g_low_trampoline[id] = false 
			g_low_trampoline_2[id] = false
			return PLUGIN_CONTINUE;
		}
	}
	if (dwajumpy[id])
	{
		if ( (pev(id, pev_flags ) & FL_ONGROUND )  )
		{
			dwajumpy[id] = false;
		}
	}
	if (g_low_gravity[id])
	{
		if ( (pev(id, pev_flags ) & FL_ONGROUND )  )
		{
			if(g_low_trampoline_2[id] && g_low_trampoline[id]){
				g_low_trampoline_2[id] = false;
				#if defined POWTORZ_DRUGI_SKOK
					g_low_trampoline[id] = false;
				#endif
				return PLUGIN_CONTINUE;
			}

			set_user_gravity(id);
			g_low_gravity[id] = false;
			g_low_trampoline[id] = false 
			g_low_trampoline_2[id] = false
		}
	}
	static buttons, oldButtons;
	buttons =	get_user_button(id);
	oldButtons =	entity_get_int(id, EV_INT_oldbuttons);
	new target, bodytarget
	get_user_aiming(id, target, bodytarget)
	if(target >= 1 && target<33 ){
		if( is_user_connected(target) && is_user_alive(target) && !isInvisible(target) ){
			if( get_gametime() - userAimingInfo[id] > 0.1 ){
				new name[33]
				get_user_name(target, name, sizeof(name) )
				//set_dhudmessage(25, 125, 255, -1.0, 0.81, 0, 0.0, 0.1, 0.0, 0.0)	
				//show_dhudmessage(id, "%s", name)
				userAimingInfo[id]=get_gametime()
			}
		}
	}	
	if ( ( buttons & IN_USE ) && !( oldButtons & IN_USE ) ){
			
		new ent,body 
		get_user_aiming(id, ent, body)
		if( IsBlock(ent) ){
			if( get_gametime()-userHudShow[id] > 2.0){
				showInfoBlock(id,ent)				
				userHudShow[id]=get_gametime();
			}
		}
	}
	if( userBmShorCut[id] ){
		if( userBM[id]>0){
			if( userEntGrab[id] != -1 ){		
				if ( ( buttons & IN_ATTACK ) && !( oldButtons & IN_ATTACK ) ){
					
					new Float:fOrigin[3]
					entity_get_vector(id, EV_VEC_origin, fOrigin)
					new ent = createBlock(entity_get_int(userEntGrab[id], EV_INT_body),fOrigin,entity_get_int(userEntGrab[id], EV_INT_skin), entity_get_int(userEntGrab[id], EV_INT_iuser3), Float:{ 0.0 , 0.0, 0.0 })		
					
					copyDataBlock(userEntGrab[id], ent)
					cmdReleaseGrab(id)
					entity_set_int(ent, EV_INT_iuser1, id)
					
					userEntGrab[id]=ent	
				}
				if ( ( buttons & IN_JUMP ) && !( oldButtons & IN_JUMP ) ){
					userLength[id]+=16.0
						
					set_pev(id, pev_button, pev(id,pev_button) & ~IN_JUMP)
				}
				if ( ( buttons & IN_DUCK ) && !( oldButtons & IN_DUCK ) ){
					if( userLength[id] > 0 )
						userLength[id]-=16.0
					
					set_pev(id, pev_button, pev(id,pev_button) & ~IN_DUCK) 
				}
				if ( ( buttons & IN_ATTACK2 ) && !( oldButtons & IN_ATTACK2 ) ){
					
					new size, rotation;
					rotation = (entity_get_int(userEntGrab[id], EV_INT_iuser3)+1) % 3	
					size = entity_get_int(userEntGrab[id], EV_INT_skin)
					setSizeAngles(userEntGrab[id], size, rotation, Float:{-1.0, -1.0, -1.0})
				}
				moveGrabbedEnt(id)
				
			}else{		
			
				if( userBM[id]>0){
					if ( ( buttons & IN_ATTACK ) && !( oldButtons & IN_ATTACK ) ){
						
						new ent, body
						get_user_aiming(id, ent, body)
						if( IsBlock(ent) ){
							if( get_gametime() - changeLeftBlock[id] < 0.2 ){
								userSelectedBlock[id] = entity_get_int(ent, EV_INT_body)
								userSelectedSize[id] = entity_get_int(ent, EV_INT_skin)
														
							}else changeLeftBlock[id]=get_gametime();
						}	
					}
					
					if ( ( buttons & IN_ATTACK2 ) && !( oldButtons & IN_ATTACK2 ) ){
						
						new ent, body
						get_user_aiming(id, ent, body)
						if( IsBlock(ent) ){
							if( get_gametime() - changeRightBlock[id] < 0.2 ){
								new typeTarget=entity_get_int(ent, EV_INT_body)
								if( typeTarget != userSelectedBlock[id] || userSelectedSize[id]!=entity_get_int(ent, EV_INT_skin)){
									new Float:fOrigin[3]
									new Float:fAngles[3]
									
									entity_get_vector(ent, EV_VEC_origin, fOrigin)
									entity_get_vector(ent, EV_VEC_angles, fAngles)
									
									
									new newEnt = createBlock(userSelectedBlock[id], fOrigin, userSelectedSize[id], entity_get_int(ent, EV_INT_iuser3), fAngles)										
											
									new name[33]
									get_user_name(id, name, 32)
									ColorChat(0, TEAM_COLOR,"[BM]^x01 Player:^x04 %s^x01 swapped the block^x04 %s^x01>^x04%s", name,  blocksProperties[entity_get_int(ent, EV_INT_body)][0], blocksProperties[entity_get_int(newEnt, EV_INT_body)][0])								
									deleteBlock(ent)	
								}						
							}else changeRightBlock[id]=get_gametime();
						}
					}
					if ( ( buttons & IN_RELOAD ) && !( oldButtons & IN_RELOAD ) ){
						new ent,body 
						get_user_aiming(id, ent, body)
						if( IsBlock(ent) ){
							new size = (entity_get_int(ent, EV_INT_skin)+1)%sizeof(blocksSize)								
							entity_set_model(ent, pathModelBlock(entity_get_int(ent, EV_INT_body), size))
							setSizeAngles(ent,size,entity_get_int(ent, EV_INT_iuser3), Float:{ 0.0 , 0.0, 0.0 })			
						}
						userChangeTime[id]=get_gametime();
					}
				}
				if( userNoClip[id] ){
					
					
					if ( ( buttons & IN_JUMP ) && !( oldButtons & IN_JUMP ) ){
						new Float:fOrigin[3]
						new Float:fAngles[3]			
						entity_get_vector(id, EV_VEC_v_angle, fAngles)
						entity_get_vector(id, EV_VEC_origin, fOrigin)
						
						fOrigin[0]+= 95.0*floatcos(fAngles[1], degrees)
						fOrigin[1]+= 95.0*floatsin(fAngles[1], degrees)
						fOrigin[2]-= 15.0*floatsin(fAngles[0], degrees)
						entity_set_vector(id, EV_VEC_origin, fOrigin)
					}
				}
			}
		}
	}
	if(userLatency[id] > 0.0){
	
		static colors[ 3 ]	
		
		if(userLatency[id] > 1.0) colors = {0, 255, 0}
		else if(userLatency[id] > 0.4) colors = {255, 255, 0}
		else colors = {255, 0, 0}	
		
		set_hudmessage(colors[ 0 ],colors[ 1 ],colors[ 2 ], -1.0, 0.30, 0, 0.07, 0.09, 0.07, 0.07, 3);
		show_hudmessage(id, "Block will be deleted:^n[ %0.1f ]", userLatency[id]);
		//displayFade(id, 512,512,512, colors[ 0 ],colors[ 1 ],colors[ 2 ], 40);
		
		userLatency[id] -= 0.01;
	}
	if(ZatrzymanyTimer[id] == false && CzasTimera[id] <= 40){
		set_dhudmessage( 114, 152, 255, 0.10, 0.05, 0, 0.0, 0.1, 0.0, 0.0)
		show_dhudmessage(id, "TIMER: %i", CzasTimera[id] )
	}
	return FMRES_IGNORED
}
public killCloseEnemies(id){	
	new Float:fOrigin[3]
	new Float:fOriginEnt[3]
	entity_get_vector(id, EV_VEC_origin, fOrigin)
	for(new i=1; i<33;i ++){
		if( !is_user_alive(i) || !is_user_connected(i) )
			continue
		if(i==id)
			continue;
			
		entity_get_vector(i, EV_VEC_origin, fOriginEnt)
		if( get_distance_f(fOrigin,fOriginEnt) > 46.0 )
			continue;
		if( get_user_team(id) == get_user_team(i) )
			continue;
		
		if( !userGodMode[i] && !GodAll )
			user_kill(i,1);
	}
}
public teleportMakeSolid(ent){
	ent-=TASK_TELEPORT
	entity_set_int(ent, EV_INT_solid, SOLID_BBOX)
}
public client_PostThink(id){
	if (!is_user_connected(id) || !is_user_alive(id))
		return PLUGIN_CONTINUE
	if( userNoFall[id] )
	{
		entity_set_int(id, EV_INT_watertype, -3)
		userNoFall[id] = false;	
	}
	
	
	if( userAddVelocity[id][0] != 0.0 || userAddVelocity[id][1] != 0.0 || userAddVelocity[id][2] != 0.0 ){
		entity_set_vector(id, EV_VEC_velocity, userAddVelocity[id])
		userAddVelocity[id][0]=0.0
		userAddVelocity[id][1]=0.0
		userAddVelocity[id][2]=0.0
		
	}
	if( userDuck[id] ){
		set_pev(id, pev_bInDuck, 1)
		userDuck[id]=false;
	}
	if( userJump[id] ){
		new oldbuttons = ~IN_JUMP
		entity_set_int(id, EV_INT_oldbuttons, oldbuttons)
		userJump[id]=false;
	}
	
	if( userRefreshSpeed[id] ){
		set_user_maxspeed(id, 250.0)
		userRefreshSpeed[id]=false;
	}
	
	if( userSpeedReduction[id] != 0.0 ){
		//client_print(id,print_chat,"Redukcja: %f", userSpeedReduction[id])
		set_user_maxspeed(id, userSpeedReduction[id])
		userRefreshSpeed[id]=true;
		userSpeedReduction[id]=0.0;
	}else if( userSlow[id][0] - get_gametime() > 0.0 && !isSpeed(id)){
		//client_print(id,print_chat,"Speed: %f", userSlow[id][1])
		set_user_maxspeed(id, userSlow[id][1] )		
		userRefreshSpeed[id]=true;
	}else if( userSkills[id][2][0]-get_gametime() > 0.0 || userNoClip[id] || userOnIce[id]){		
		//client_print(id,print_chat,"Skill: 400.0")
		set_user_maxspeed(id, 400.0)		
		userRefreshSpeed[id]=true;
	}else if( userSkills[id][4][0]-get_gametime() > 0.0 || userNoClip[id] || userOnIce[id]){		
		//client_print(id,print_chat,"Skill: 400.0")
		set_user_maxspeed(id, 400.0)		
		userRefreshSpeed[id]=true;
	}else if(userMagic[id]){
		//client_print(id,print_chat,"Magia: %f", userMagicSpeed[id])
		set_user_maxspeed(id, 250.0+userMagicSpeed[id] )
		userRefreshSpeed[id]=true;
	}
	
	return PLUGIN_CONTINUE
}
public copyDataBlock(ent, toent){
	new type =  entity_get_int(ent, EV_INT_body)
	for( new i = 2; i < sizeof(blocksProperties[]); i ++ ){
		new param = str_to_num(blocksProperties[type][i])
		if( param == -1 )
			break;
		setParamBlock(toent, param, getParamBlock(ent, param))
	}
	new Float:fColor[3]
	entity_get_vector(ent, EV_VEC_rendercolor, fColor);
	entity_set_vector(toent, EV_VEC_rendercolor, fColor)
	entity_set_int(toent, EV_INT_iuser2, entity_get_int(ent, EV_INT_iuser2) )
	entity_set_int(toent, EV_INT_iuser4, entity_get_int(ent, EV_INT_iuser4) )
	entity_set_edict(toent, EV_ENT_euser1, entity_get_edict(ent, EV_ENT_euser1 ) )
	for( new i =0; i<3;i ++ )
	setEditBlock(toent, i, getEditBlock(ent, i))
	
	if( type != GLASS )
		setRenderingBlock(toent)
	
}	
public DeathMsg(){
	//new killer=read_data(1)
	new victim=read_data(2)
	if( userRespawn[victim] ){
		set_task(0.1, "respawnPlayer", victim )
	}
	return PLUGIN_CONTINUE
}
public round_start(){
	for( new i =1;i<33;i++){
		if( !is_user_connected(i) )
			continue
		userMagicSpeed[i] = random_float(0.0, 15.0)
		feniks[i] = false;
		NagrodaTimer[i] = false;
		CzasTimera[i] = 0;
		ZatrzymanyTimer[i] = true;
		for( new skill = 0; skill<sizeof(userSkills[]);skill++){
			userSkills[i][skill][0]=0.0
			userSkills[i][skill][1]=0.0
		}
		if(task_exists(i+TASK_SKILL_HUD) )
			remove_task(i+TASK_SKILL_HUD)
		userResetVarsRound(i)
	}
	randomCamp()
}
public round_end(){
	
}
public respawnPlayer(id){
	if( is_user_alive(id) || !is_user_connected(id) )
		return PLUGIN_CONTINUE
		
	ExecuteHamB(Ham_CS_RoundRespawn, id);
		
	if( userCheckPoint[id] ){
		backToCheckPoint(id)
	}
	return PLUGIN_CONTINUE
}	
public ham_Spawn(id){
	if( !is_user_alive(id) || !is_user_connected(id))
		return HAM_IGNORED
	
	set_task(0.2,"setVarsAdmin", id)
	
	if( !userHud[id] ){
		showHud(id)
		userHud[id]=false;
	}
	userResetVarsRound(id)
	
	return PLUGIN_CONTINUE
}
public setVarsAdmin(id){
	if( GodAll )
		set_user_godmode(id, GodAll)
	set_user_godmode(id, userGodMode[id])
	set_user_noclip(id, userNoClip[id])
}
public ham_traceAttack(victim, attacker, float:damage, Float:direction[3], trace, bits)
{
	if( !is_user_connected(attacker) || !is_user_alive(attacker) )
		return HAM_IGNORED
	if( userSkills[victim][0][0]-get_gametime()>0.0){
		return HAM_SUPERCEDE
	}
	else if( userSkills[victim][4][0]-get_gametime()>0.0){
		return HAM_SUPERCEDE
	}
	if( get_user_team(attacker) != get_user_team(victim )){
		userSlowed[victim]=attacker;
		userSlowedTime[victim] = get_gametime();
	}
	return HAM_IGNORED
} 
public ham_TakeDamage(victim, inflictor, attacker, Float:damage, damagebits){
	if( !is_user_alive(victim) )
		return HAM_IGNORED
	if( userSkills[victim][0][0]-get_gametime()>0.0){
		if( ( damagebits & DMG_FALL )){		
			SetHamParamFloat(4, 0.0)
		}
	}
	if( userSkills[victim][4][0]-get_gametime()>0.0){
		if( ( damagebits & DMG_FALL )){		
			SetHamParamFloat(4, 0.0)
		}
	}
	return HAM_IGNORED
}
public userResetVarsRound(id){
	
	if( task_exists(id+TASK_VISIBLE) )
		remove_task(id+TASK_VISIBLE)
		
	if( task_exists(id+TASK_CAMOUFLAGE) )
		remove_task(id+TASK_CAMOUFLAGE)		
		
	setRendering(0, id, 255,255,255,255)
	//set_user_maxspeed(id, 250.0)
	for( new i = 0; i<4;i++){
		userSkills[id][i][0]=0.0;
		userSkills[id][i][1]=0.0;
	}
	resetUsedBlock(id)
	resetCampAchived(id)
}

public touchBlock(ent, id){

	if ( !( 1 <= id <= 33 ) 	|| !IsBlock(ent)) 
		return PLUGIN_CONTINUE;
		
	if( !is_user_alive(id) || !is_user_connected(id) || !pev_valid(id))
		return PLUGIN_CONTINUE

	if( entity_get_int(ent, EV_INT_iuser1) != 0 )
		return PLUGIN_CONTINUE;
	
	new flags =entity_get_int(id, EV_INT_flags);
	new groundentity =	entity_get_edict(id, EV_ENT_groundentity);
	new typeBlock=entity_get_int(ent, EV_INT_body)	
	new barrier=true;
	/*
	if( typeBlock == BARRIERTT || typeBlock==BARRIERCT ){
		new Float:fOriginId[3], Float:fOriginTarget[3]
			
		pev(id, pev_origin, fOriginId)
		for(new i=1;i<33;i++){
			if(!is_user_connected(i) || !is_user_alive(i))
				continue;
			if(get_user_team(i) == get_user_team(id) )
				continue;
					
			pev(i, pev_origin, fOriginTarget)
			if(get_distance_f(fOriginId, fOriginTarget) < 700.0 ){
				barrier=true
				break;
			}
					
		}
	}*/
	if( getParamBlock(ent, 23) == 1.0 ){
		set_task(0.1, "makeNoSolid", ent+TASK_BHOP)
	}
	if( getParamBlock(ent, 1) == 1.0 ){	
		new bool:blockade=false;
		new Float:fOrigin[3]
		new Float:fMins[3]
		new Float:fMaxs[3]
		entity_get_vector(id, EV_VEC_origin, fOrigin)
		entity_get_vector(id, EV_VEC_mins, fMins)
		entity_get_vector(id, EV_VEC_maxs, fMaxs)
		
		new Float:fOriginEnt[3]
		new Float:fMinsEnt[3]
		new Float:fMaxsEnt[3]
		entity_get_vector(ent, EV_VEC_origin, fOriginEnt)
		entity_get_vector(ent, EV_VEC_mins, fMinsEnt)		
		entity_get_vector(ent, EV_VEC_maxs, fMaxsEnt)
		if( !(flags & FL_ONGROUND) ){			
			if( groundentity != ent ){					
				blockade=true;
			}			
			
		}else if( fOrigin[2] + fMins[2] < fOriginEnt[2]+fMaxsEnt[2] || groundentity != ent ) {
			blockade=true;			
		}
		if( getParamBlock(ent, 23) == 1.0 ){
			set_task(0.1, "makeNoSolid", ent+TASK_BHOP)
		}
		if( groundentity == ent || !(flags & FL_ONGROUND) || (groundentity == 0 && (flags & FL_ONGROUND))){
			//client_print(id,print_chat,"%2f %2f",  fOrigin[2], fMaxs[2] )
			if( fOrigin[2]+fMaxs[2]<fOriginEnt[2] )
				return PLUGIN_CONTINUE;
			if( typeBlock == BHOP || typeBlock == NOSLOWBHOP || typeBlock == BHOPLATENCY ){
				if( blockade ){
					
					new Float:fOrigin[3]
					entity_get_vector(id, EV_VEC_origin, fOrigin) 
					if( fOrigin[0] == userLastOrigin[id][0] && fOrigin[1] == userLastOrigin[id][1] && fOrigin[2] == userLastOrigin[id][2] ){				
						
						userLastOrigin[id][0]=fOrigin[0]
						userLastOrigin[id][1]=fOrigin[1]
						userLastOrigin[id][2]=fOrigin[2]
						if( !task_exists(id+88888) )
							set_task(0.1, "checkTrueOrigin", id+88888)
						userLetBlock[id]++;
						
						
						if( userLetBlock[id] > 50 ){
							
							blockade=false
							entity_set_edict(ent,EV_ENT_euser3, 1)
							userLetBlock[id]=0;	
						}				
					}else{
						userLastOrigin[id][0]=fOrigin[0]
						userLastOrigin[id][1]=fOrigin[1]
						userLastOrigin[id][2]=fOrigin[2]					
						userLetBlock[id]=0;
					}
				}
			}
		
		}
		if( blockade ){			
			return PLUGIN_CONTINUE;			
		}
	}	
	new bool:change=false;
	new Float:userVelocity[3]
	if( getEditBlock(ent,0) == 2 ){
		if( !campAchived(id, getEditBlock(ent,1) ) ){
			new iForwardOne;			
			ExecuteForward(forwardCampEnd, iForwardOne, id, ent, getEditBlock(ent,2), typeMap, bonusCampRound == getEditBlock(ent,1) ? 1:0 );
			setCampAchived(id, getEditBlock(ent,1))
		}
	}	 
	if( get_user_team(id) != 3 && ( getParamBlock(ent, 14) != 0 ) ){
		if( floatround(getParamBlock(ent, 14)) == 3 && !has_flag(id, "t") )
			return PLUGIN_CONTINUE
		else if( floatround(getParamBlock(ent, 14)) != get_user_team(id) && floatround(getParamBlock(ent, 14)) != 3 )
			return PLUGIN_CONTINUE
	}
	/* 	STRZALKA	*\	
	\* 	STRZALKA	*/
	pev(id, pev_velocity, userVelocity)
	
	if( getParamBlock(ent, 3) != 0.0 ){
		velocity_by_aim( id, floatround( getParamBlock(ent,3) ), userVelocity)		
		change=true;
		
	}
	
	/* 	TRAMPOLINA	*\
	\* 	TRAMPOLINA	*/
	if( getParamBlock(ent, 2) != 0.0 ){
		userVelocity[2]=getParamBlock(ent,2)
		change=true;
	}
	if( change )
		userAddVelocity[id] = userVelocity
	
		
	/* 	OBRAZENIA	*\	
	\* 	OBRAZENIA	*/
	if( getParamBlock(ent, 4) != 0.0 ){
		if( userSkills[id][0][0] < get_gametime() ){
			if( userSkills[id][4][0] < get_gametime() ){
				if( get_gametime() - userLastTouchBlock[id] > getParamBlock(ent,6) ){
					fakedamage(id, "", getParamBlock(ent, 4), DMG_GENERIC);	
			
					userLastTouchBlock[id]=get_gametime();
				}
			}
		}
	}
	/*	LECZNEIE	*\	
	\* 	LECZNEIE	*/
	if( getParamBlock(ent, 5) != 0.0 && typeBlock != POTION ){
		if( get_gametime() - userLastTouchBlock[id] > getParamBlock(ent,6) ){
			new health=min(100, get_user_health(id) + floatround( getParamBlock(ent,5) ))
			set_user_health(id, health )
			userLastTouchBlock[id]=get_gametime();
		}
		if( get_gametime() - pev(ent, pev_fuser1) >= 5.0 ){
			new Float:fOrigin[3]
			entity_get_vector(id, EV_VEC_origin, fOrigin)
			
			message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
			write_byte(TE_SPRITE)
			engfunc(EngFunc_WriteCoord,fOrigin[0])
			engfunc(EngFunc_WriteCoord,fOrigin[1])
			engfunc(EngFunc_WriteCoord,fOrigin[2]-20.0)
			write_short(sprite_heal) 
			write_byte(5) 
			write_byte(255)
			message_end()
			
			set_pev(ent, pev_fuser1, get_gametime())
		}
		if( get_gametime() - pev(ent, pev_fuser2) >= 1.5 ){
			
			emit_sound(ent, CHAN_WEAPON, soundsNames[13], 1.0, ATTN_NORM, 0, PITCH_NORM)		
			set_pev(ent, pev_fuser2, get_gametime())
		}
	}
	if( getParamBlock(ent, 7) != 0.0 && typeBlock == HONEY ){
		userSpeedReduction[id] = getParamBlock(ent,7)
	}
	if( getParamBlock(ent, 8) == 0.0 ){
		userNoFall[id]=true;
	}
	
	switch( typeBlock ){
		case BHOP:{
			if( lastTouched[id] != ent ){
				//xp_add_mission(id, 17, 1)
				lastTouched[id]=ent
			}
			//actionMagicSpeed(id,ent)
			actionBhop(ent);
		}
		case NOSLOWBHOP:{
			if( lastTouched[id] != ent ){
				//xp_add_mission(id, 17, 1)
				lastTouched[id]=ent
			}
			//actionMagicSpeed(id,ent)
			actionNoSlowBhop(id, ent);
		} 
		case DEATH: actionDeath(id, ent)
		case NOFALL:{
			if( userVelocity[2] < -500.0 ){
				if( get_gametime() - userSlow[id][0] > 0.0 ){
					/*if( getParamBlock(ent, 19) != 0.0 ){
						if( !isSpeed(id) ){
							new iOrigin[3];
							get_user_origin(id, iOrigin, 0)
							new Float:randFloat=random_float(0.7,1.5);
							//userSlow[id][1] = getParamBlock(ent, 19)+250.0
							//userSlow[id][0] = get_gametime()+randFloat
							
							if( !isInvisible(id) && !isImmortal(id) ){
								setRendering(1, id, 255,150,0,5)
								makeTrail(id)
								
								set_task( randFloat, "killAccelerate", id) 
							}
							
							message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin, 0)
			
							write_byte(TE_DLIGHT)			
							write_coord(iOrigin[0]);	
							write_coord(iOrigin[1]);
							write_coord(iOrigin[2]);			
							write_byte(25)			
						
							write_byte(255); 
							write_byte(150); 
							write_byte(0); 
							
							write_byte(10)			
							write_byte(50)			
							message_end()
							Display_Fade(id,(1<<12),0,0,255,150, 0, 40)
						}
					}*/
				}
			}
			userNoFall[id]=true;
		}
		case DUCK: userDuck[id]=true;
		
		case BHOPLATENCY: actionBhopLatency(id, ent)
		case BARRIERTT: if( get_user_team(id) != 1 || !barrier) actionBarrier(id, ent)
		case BARRIERCT: if( get_user_team(id) != 2 || !barrier) actionBarrier(id, ent)
		case BARRIERVIP: if(has_flag(id, "t")) actionBarrier(id,ent)
		case ICE: actionIce(id,ent)
		case GODMODE: actionGodMode(id,ent)
		case INVIS: actionInvisible(id,ent)
		case GUN: actionGun(id,ent)
		case GRENADE: actionGrenade(id,ent)
		case BOOTS: actionBoots(id,ent)
		case MUSIC: actionMusic(id,ent)
		case EXP: actionPoints(id,ent)
		case CAMOUFLAGE: actionCamouflage(id,ent)
		case TRAMPOLINE:{
			if( get_gametime() - userSound[id] > 0.3 ){
				//emit_sound(id, CHAN_WEAPON, soundsNames[random_num(8,11)], 1.0, ATTN_NORM, 0, PITCH_NORM)	
				userSound[id]=get_gametime();
			}
			userNoFall[id]=true
		}
		case AMMO: actionAmmo(id, ent);
		case POTION: actionPotion(id, ent)
		case WATER: actionWater(id, ent)
		case GRAVITY: actionGravity(id, ent)
		case DODATKOWES: actiondodatkoweS(id, ent)
		case FENIKS: actionFeniks(id, ent)
		case AUTOBH: actionSpamBH(id, ent)		
		case SURFB: actionBhop(ent)
		case SURFS: actionDeath(id, ent)
		case SURFO: actionBhopLatency(id, ent)
		case SURFL: actionIce(id, ent)
		case SKRZYNKA: ActionSkrzynka(id, ent)
		case TIMERSTART: ActionTimerStart(id, ent)
		case TIMERSTOP: ActionTimerStop(id, ent)
	}
	
	return PLUGIN_CONTINUE;
}
ActionSkrzynka(id, ent){
	
}
public checkTrueOrigin(id){
	id-=88888
	if(  !is_user_alive(id) || !is_user_connected(id) )
		return PLUGIN_CONTINUE
		
	new Float:fOrigin[3]
	entity_get_vector(id, EV_VEC_origin, fOrigin) 
	if( fOrigin[0] != userLastOrigin[id][0] || fOrigin[1] != userLastOrigin[id][1] || fOrigin[2] != userLastOrigin[id][2] ){		
		userLetBlock[id]=0
	}
		
	return PLUGIN_CONTINUE
}
public plugin_precache(){
	for( new i = 0; i < NUMBLOCKS; i ++ ){		
		new gText[98]		
		for( new x = 0; x < 4; x ++ ){
			format(gText, sizeof(gText), "models/FSBM1/%s%s.mdl", blocksProperties[i][1], blocksSize[x][0])
			precache_model(gText)	
		}
	}
	for( new i = 0; i < sizeof(teleportsSprites); i ++ ){		
		precache_model(teleportsSprites[i][0])
	}
	for(new i =0; i<sizeof(soundsNames);i++){
		precache_sound(soundsNames[i])
	}
	
	for(new i =0; i<sizeof(blockMusic);i++){
		precache_sound(blockMusic[i][0])
	}
	
	beam_spr = precache_model( "sprites/blockmaker/bluez.spr" )
	
	sprite_heal  =precache_model("sprites/blockmaker/health.spr");
	
	precache_model("sprites/lightbulb.spr");
	
	sprite_fire = precache_model("sprites/blockmaker/flame.spr")
	
	line_green = precache_model("sprites/test/line_green.spr");
	line_yellow = precache_model("sprites/test/line_yellow.spr");
	line_red = precache_model("sprites/test/line_red.spr");
	line_pink = precache_model("sprites/test/line_pink.spr");
	line_orange = precache_model("sprites/test/line_black.spr");
	line_blue = precache_model("sprites/test/line_blue.spr");
	//precache_model(caseModel);
}
public makerMain(id){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	
	new gText[290]
	
	format(gText, sizeof(gText), "\y[BM]^nTemplate:\r %s\
		^n\r1.\w Blocks menu\
		^n\r2.\w Teleports menu^n\
		^n\r3.\w Options menu\
		^n\r4.\w Admin menu\
		^n\r5.\w Save menu^n\
		^n\r6.\w Noclip: %s\
		^n\r7.\w Godmode: %s\
		^n\r8.\w Build Mode: %s^n\
		^n\r0.\w Exit\
	", actualStyle, 
		userNoClip[id]?"\yON":"\dOFF", 
		userGodMode[id]?"\yON":"\dOFF", 
		userBmShorCut[id]?"\yON":"\dOFF" 
	)
	show_menu(id, B1 | B2 | B3 | B4 | B5 | B6 | B7 |B8 | B0, gText, -1, "makerMain")
	
	
	return PLUGIN_CONTINUE

}
public autoSaveTask(){
	SaveBlocks(0, 2)
	if( autoSave ){
		set_task(45.0, "autoSaveTask", TASK_AUTOSAVE)
	}
}
public makerMain_2(id, item){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	/*if( item == MENU_EXIT ){
		menu_destroy(menu)
		return PLUGIN_CONTINUE;
	}*/
	switch(item){
		case 0:{
			if(wolebmalb[id])
			{
				blockMaker(id)
			}
			else
			{
				GrzyboblockMaker(id)
			}
			userBmShorCut[id]=true
		}
		case 1:teleMenu(id)		
		case 2:adminMenu(id)
		case 3:adminAddition(id)
		case 4:menuSaveAdmin(id)
		case 5:{
			userNoClip[id]=!userNoClip[id]
			makerMain(id)			
			set_user_noclip(id, userNoClip[id])	
		}
		case 6:{
			userGodMode[id]=!userGodMode[id];
			makerMain(id)			
			set_user_godmode(id, userGodMode[id])
		}
		case 7:{
			userBmShorCut[id]=!userBmShorCut[id];
			makerMain(id)
		}
		case 9:{
			
		}
			
	}
	
	
	return PLUGIN_CONTINUE
}
public blockMaker(id){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	new iNumBlocks=0
	new ent = find_ent_by_class(-1, "blockMaker")
	while( ent != 0 ){
		iNumBlocks++;
		ent=find_ent_by_class(ent, "blockMaker")
	}
		
	new menu[286]
	
	format(menu, sizeof(menu), "\
		\y[BM]^n\yBlocks:\r %d^n^n\
		\r1.\w Select block:\y %s^n\
		\r2.\w Create block^n\
		\r3.\w Delete block^n\
		\r4.\w Sliding move menu^n\
		\r5.\w Block properties^n^n\
		\r6.\w Noclip: %s^n\
		\r7.\w Godmode: %s^n\		
		\r8.\w Size:\y %s^n^n\
		\r9.\w Options^n\
		\r0.\w Exit\
	", iNumBlocks, blocksProperties[userSelectedBlock[id]][0], userNoClip[id] ? "\yON":"\dOFF", userGodMode[id] ? "\yON":"\dOFF", blocksSize[userSelectedSize[id]][1])
	show_menu(id, B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9 | B0, menu, -1, "blockMaker")
	return PLUGIN_CONTINUE
}
public GrzyboblockMaker(id){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	new iNumBlocks=0
	new ent = find_ent_by_class(-1, "blockMaker")
	while( ent != 0 ){
		iNumBlocks++;
		ent=find_ent_by_class(ent, "blockMaker")
	}
		
	new menu[286]
	
	format(menu, sizeof(menu), "\
		\y[BM]^n\yBlock menu:^n^n\
		\r1.\w Type of block:\y %s^n\
		\r2.\w Size:\y %s^n\
		\r3.\w Create^n\
		\r4.\w Delete^n\
		\r5.\w Replace^n^n\
		\r6.\w Rotate block:^n\
		\r7.\w Properties:^n\		
		\r8.\w Sliding:\y^n^n\
		\r9.\w More^n\
		\r0.\w Exit\
	", blocksProperties[userSelectedBlock[id]][0], blocksSize[userSelectedSize[id]][1])
	show_menu(id, B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9 | B0, menu, -1, "GrzyboMenu")
	return PLUGIN_CONTINUE
}
public GrzyboMenu_2(id, item ){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	/*if( item==MENU_EXIT ){
		menu_destroy(menu)
		return PLUGIN_CONTINUE
	}*/
	switch( item ){
		case 0: selectBlock(id)
		case 1:{
			userSelectedSize[id]=(userSelectedSize[id]+1)%sizeof(blocksSize)
			GrzyboblockMaker(id)
		}
		case 2:{
			createBlockAim(id)
			GrzyboblockMaker(id)
		}
		case 3:{
		
			new ent, body
			get_user_aiming(id, ent, body)
			if( !pev_valid(ent) )
				GrzyboblockMaker(id)
			
			if( entity_get_int(ent, EV_INT_iuser1) != 0 ){
				GrzyboblockMaker(id)
				return PLUGIN_CONTINUE
			}
			if( !IsBlock(ent) || IsTeleport(ent)){
				GrzyboblockMaker(id)
				return PLUGIN_CONTINUE
			}
			deleteBlock(ent)
			GrzyboblockMaker(id)
		}
		case 4:{
			new ent, body
			get_user_aiming(id, ent, body)
			if( IsBlock(ent) ){
				new typeTarget=entity_get_int(ent, EV_INT_body)
				if( typeTarget != userSelectedBlock[id] || userSelectedSize[id]!=entity_get_int(ent, EV_INT_skin)){
					new Float:fOrigin[3]
					new Float:fAngles[3]
						
					entity_get_vector(ent, EV_VEC_origin, fOrigin)
					entity_get_vector(ent, EV_VEC_angles, fAngles)
						
					new newEnt = createBlock(userSelectedBlock[id], fOrigin, userSelectedSize[id], entity_get_int(ent, EV_INT_iuser3), fAngles)	
					new name[33]
					get_user_name(id, name, 32)
					ColorChat(0, TEAM_COLOR,"[BM]^x01 Player:^x04 %s^x01 swapped the block^x04 %s^x01>^x04%s", name,  blocksProperties[entity_get_int(ent, EV_INT_body)][0], blocksProperties[entity_get_int(newEnt, EV_INT_body)][0])								
					deleteBlock(ent)	
				}						
			}GrzyboblockMaker(id);
		}
		case 5:{
			if(userBmShorCut[id]){
				new ent, body
				get_user_aiming(id, ent, body)
				if(IsBlock(ent)) {
					new size, rotation;
					rotation = (entity_get_int(ent, EV_INT_iuser3)+1) % 3	
					size = entity_get_int(ent, EV_INT_skin)
					setSizeAngles(ent, size, rotation, Float:{-1.0, -1.0, -1.0})
					GrzyboblockMaker(id)
				}
				GrzyboblockMaker(id)
			}
		}
		case 6:{
			new ent, body
			get_user_aiming(id, ent, body)
				
			if( IsTeleport(ent) ){		
				new target=entity_get_int(ent, EV_INT_iuser1);
				if( IsTeleport(target) ){
					userBlockProperties[id]=entity_get_int(ent, EV_INT_iuser2) == 1 ? target : ent 
					menuParamTele(id)
				}else GrzyboblockMaker(id)
				
				return PLUGIN_CONTINUE
			}
			if( !IsBlock(ent) ){
				GrzyboblockMaker(id)
				return PLUGIN_CONTINUE
			}			
			userBlockProperties[id]=ent
			propertiesBlock(id)	
		}
		case 7:{
			MenuMoveBlock2(id)
		}
		case 8:{
			adminMenu(id)
		}
		case 9:{
			makerMain(id)
		}
		
	}
	return PLUGIN_CONTINUE		
}
public deleteBlock(ent){
	
	entity_set_origin(ent, Float:{8192.0,8192.0,8192.0})			
	remove_entity(ent)
	
}
public blockMaker_2(id, item ){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	/*if( item==MENU_EXIT ){
		menu_destroy(menu)
		return PLUGIN_CONTINUE
	}*/
	switch( item ){
		case 0: selectBlock(id)
		case 1:{
			createBlockAim(id)
			blockMaker(id)
		}
		case 2:{
			new ent, body
			get_user_aiming(id, ent, body)
			if( !pev_valid(ent) )
				blockMaker(id)
			
			if( entity_get_int(ent, EV_INT_iuser1) != 0 ){
				blockMaker(id)
				return PLUGIN_CONTINUE
			}
			if( !IsBlock(ent) || IsTeleport(ent)){
				blockMaker(id)
				return PLUGIN_CONTINUE
			}
			
			deleteBlock(ent)
			blockMaker(id)
			
		}
		case 3:{
			MenuObracania(id);
		}
		case 4:{
			new ent, body
			get_user_aiming(id, ent, body)
				
			if( IsTeleport(ent) ){		
				new target=entity_get_int(ent, EV_INT_iuser1);
				if( IsTeleport(target) ){
					userBlockProperties[id]=entity_get_int(ent, EV_INT_iuser2) == 1 ? target : ent 
					menuParamTele(id)
				}else blockMaker(id)
				
				return PLUGIN_CONTINUE
			}
			if( !IsBlock(ent) ){
				blockMaker(id)
				return PLUGIN_CONTINUE
			}			
			userBlockProperties[id]=ent
			propertiesBlock(id)	
		}
		case 5:{
			userNoClip[id]=!userNoClip[id]
			set_user_noclip(id, userNoClip[id])	
			blockMaker(id)
		}
		case 6:{
			userGodMode[id]=!userGodMode[id];
			set_user_godmode(id, userGodMode[id])
			blockMaker(id)
		}
		case 7:{
			userSelectedSize[id]=(userSelectedSize[id]+1)%sizeof(blocksSize)
			blockMaker(id)
		}
		case 8:{
			adminMenu(id)
		}
		case 9:{
			makerMain(id)
		}
		
	}
	return PLUGIN_CONTINUE		
}
public MenuObracania(id)
{
	new menu[286]
	
	format(menu, sizeof(menu), "\
		\y[BM]^n\ySliding move menu:^n\
		\r1.\w Rotation size:\y %0.1f^n^n\
		\r2.\w Rotate \rX\y +^n\
		\r3.\w Rotate \rX\y -^n^n\
		\r4.\w Rotate \rY\y +^n\
		\r5.\w Rotate \rY\y -^n^n\
		\r6.\w Rotate \rZ\y +^n\
		\r7.\w Rotate \rZ\y -^n^n\
		\r8.\w Rotate \y( In Axis )^n\
		\r0.\w Exit\
	", userKrecDist[id])
	show_menu(id, B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9 | B0, menu, -1, "blockObkrec")
	return PLUGIN_CONTINUE
}
public blockObkrec_2(id, item )
{
	new ent, body, size, rotation;
	new Float:angles[3];
	get_user_aiming(id, ent, body)
	

	rotation = (entity_get_int(ent, EV_INT_iuser3)+1) % 3	
	size = entity_get_int(ent, EV_INT_skin)
	pev(ent, pev_angles, angles);
	for(new i = 0; i < 3; i ++) userAngles[i] = angles[i]
	
	
	
	switch( item ){
		case 0: 
		{
			client_cmd(id, "messagemode WartoscObkrecania")
		}
		case 1:
		{
		
			if(!IsBlock(ent)) {
				MenuObracania(id);
				return 0
			}
			userAngles[0] += userKrecDist[id];	
			userAngles[1] = angles[1] 
			userAngles[2] = angles[2] 
			
			setSizeAngles(ent, size, rotation, userAngles)
			MenuObracania(id);
		}
		case 2:
		{
			if(!IsBlock(ent)) {
				MenuObracania(id);
				return 0
			}
			userAngles[0] -= userKrecDist[id];	
			userAngles[1] = angles[1] 
			userAngles[2] = angles[2] 
	
			setSizeAngles(ent, size, rotation, userAngles)
			MenuObracania(id);
		}
		case 3:
		{
			
			if(!IsBlock(ent)) {
				MenuObracania(id);
				return 0
			}
			userAngles[0] = angles[0] 
			userAngles[1] += userKrecDist[id];	
			userAngles[2] = angles[2] 
	
			setSizeAngles(ent, size, rotation, userAngles)
			MenuObracania(id);
		}
		case 4:
		{
			if(!IsBlock(ent)) {
				MenuObracania(id);
				return 0
			}
			userAngles[0] = angles[0] 
			userAngles[1] -= userKrecDist[id];	
			userAngles[2] = angles[2] 	
			
	
			setSizeAngles(ent, size, rotation, userAngles)
			MenuObracania(id);
		}
		case 5:
		{
			if(!IsBlock(ent)) {
				MenuObracania(id);
				return 0
			}
			userAngles[0] = angles[0] 
			userAngles[1] = angles[1] 
			userAngles[2] += userKrecDist[id];	
			
		
			setSizeAngles(ent, size, rotation, userAngles)
			MenuObracania(id);
		}
		case 6:
		{
			if(!IsBlock(ent)) {
				MenuObracania(id);
				return 0
			}
			userAngles[0] = angles[0] 
			userAngles[1] = angles[1] 
			userAngles[2] -= userKrecDist[id];	
		
			setSizeAngles(ent, size, rotation, userAngles)
			MenuObracania(id);
		}
		case 7:
		{
			if(!IsBlock(ent)) {
				MenuObracania(id);
				return 0
			}
			new size, rotation;
			rotation = (entity_get_int(ent, EV_INT_iuser3)+1) % 3	
			size = entity_get_int(ent, EV_INT_skin)
			setSizeAngles(ent, size, rotation, Float:{-1.0, -1.0, -1.0})
			MenuObracania(id);
		}
		
		case 9:{
			makerMain(id)
		}
		
	}
	return PLUGIN_CONTINUE		
}
public ZmienWartoscObkrecania(id)
{
	new szCash[64];
	read_argv(1, szCash, 63)
	remove_quotes(szCash);
	new Float:Cash = str_to_float(szCash);

	userKrecDist[id] = Cash;
	
	client_print(id, 3, "You have set the rotation power to: %0.1f", Cash);
	MenuObracania(id);
	return PLUGIN_HANDLED;
}
public teleMenu(id){	
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	new iNumTele=0
	new ent = find_ent_by_class(-1, szTeleClassName)
	while( ent != 0 ){
		iNumTele++;
		ent=find_ent_by_class(ent, szTeleClassName)
	}
	if( userLastTpCreated[id] != 0 ){
		if( !IsTeleport(userLastTpCreated[id]) ){
			userLastTpCreated[id]=0;
		}
	}
	new menu[256]
	
	format(menu, sizeof(menu), "\
		\y[BM]^n\wTeleports:\r %d^n\
		\r1.\w Start^n\
		\r2.%s End^n\
		\r3.\w Delete teleport^n\
		\r4.\w Properties teleport ^n\
		\r5.\w Swap end and start^n\
		\r6.\w NoClip: %s^n\
		\r7.\w Godmode: %s^n\
		^n\
		\r9.\w Options^n\
		\r0.\w Exit",
		iNumTele, userLastTpCreated[id]!=0?"\w":"\d", userNoClip[id] ? "\yON":"\dOFF", userGodMode[id] ? "\yON":"\dOFF"
	)
		
	
	show_menu(id, B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9 | B0, menu, -1, "teleMenu")
	
	return PLUGIN_CONTINUE
}
public teleMenu_2(id, item){	
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	switch(item){
		case 0:{
			if( userLastTpCreated[id] == 0 || !IsTeleport(userLastTpCreated[id]))
				createTeleportAim(id)
			else{
				
					new iLook[3]
					new Float:fLook[3]
					get_user_origin(id, iLook, 3)
					IVecFVec(iLook, fLook)
					fLook[2]+=8.0
					entity_set_origin(userLastTpCreated[id], fLook)		
			}
			
			teleMenu(id)
		}
		case 1:{
			if( userLastTpCreated[id]!=0)
				createTeleportAim(id)
			
			teleMenu(id)
		}	
		case 2:{
			new ent, body
			get_user_aiming(id, ent, body)
			
			if( !IsTeleport(ent) ){
				teleMenu(id)
				return PLUGIN_CONTINUE
			}
			new target=entity_get_int(ent, EV_INT_iuser1)
			if( IsTeleport(target) ){				
				if( task_exists(target+TASK_SPRITE) )
					remove_task(target+TASK_SPRITE)
				if( task_exists(target+TASK_TELEPORT) )
					remove_task(target+TASK_TELEPORT)
					
				remove_entity(target)
			}
			
			if( task_exists(ent+TASK_TELEPORT) )
				remove_task(ent+TASK_TELEPORT)
				
			if( task_exists(ent+TASK_SPRITE) )
				remove_task(ent+TASK_SPRITE)
			remove_entity(ent)
			
			teleMenu(id)
			
		}	
		case 3:{
			new ent, body
			get_user_aiming(id, ent, body)
			if( IsTeleport(ent) ){				
				new target=entity_get_int(ent, EV_INT_iuser1);
				if( IsTeleport(target) ){
					userBlockProperties[id]=entity_get_int(ent, EV_INT_iuser2) == 1 ? target : ent 
					menuParamTele(id)
				}else teleMenu(id)
			}else teleMenu(id)
			
			
			
		}
		case 4:{
			new ent, body
			get_user_aiming(id, ent, body)
			
			if( !IsTeleport(ent) ){
				teleMenu(id)
				return PLUGIN_CONTINUE
			}
			
			new target=entity_get_int(ent, EV_INT_iuser1)
			if( !IsTeleport(target) ){
				return PLUGIN_CONTINUE
			}
			
			entity_set_int(ent, EV_INT_iuser2, entity_get_int(ent, EV_INT_iuser2 )==1?0:1)
			entity_set_int(target, EV_INT_iuser2, entity_get_int(ent, EV_INT_iuser2 )==1?0:1)
			refreshTeleportModel(target)
			refreshTeleportModel(ent)
			teleMenu(id)
		}	
		case 5:{
			userNoClip[id]=!userNoClip[id]
			set_user_noclip(id, userNoClip[id])	
			teleMenu(id)
			
		}
		case 6:{
			userGodMode[id]=!userGodMode[id];
			set_user_godmode(id, userGodMode[id])
			teleMenu(id)
		}
		case 8:{
			adminMenu(id)
		}
		case 9:{
			makerMain(id)
		}
	}
	return PLUGIN_CONTINUE
}
public menuParamTele(id){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	new gText[128]
	new menu=menu_create("\y[BM]^n\yTeleport Properties", "menuParamTele_2")
	menu_additem(menu, "Refresh")
	for(new i=0;i<sizeof(propertiesTele);i++){
		if(equal(propertiesTele[i][1],"bool"))
			format(gText, sizeof(gText), "%s:\y %s", propertiesTele[i][0], getParamBlock(userBlockProperties[id],i)==1.0?"Yes":"No")
		if(equal(propertiesTele[i][1],"int"))
			format(gText,sizeof(gText), "%s:\y %i", propertiesTele[i][0],floatround(getParamBlock(userBlockProperties[id],i)))	
		else format(gText,sizeof(gText), "%s:\y %0.1f", propertiesTele[i][0], getParamBlock(userBlockProperties[id],i))		
		menu_additem(menu, gText)
	}
	
	menu_display(id,menu,0)
	return PLUGIN_CONTINUE
}
public menuParamTele_2(id,menu,item){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	if(item==MENU_EXIT){
		teleMenu(id)
		return PLUGIN_CONTINUE
	}
	switch(item){
		case 0:{
			new ent, body
			get_user_aiming(id, ent, body)
			if( IsTeleport(ent) ){				
				new target=entity_get_int(ent, EV_INT_iuser1);
				if( IsTeleport(target) ){
					userBlockProperties[id]=entity_get_int(ent, EV_INT_iuser2) == 1 ? target : ent 
					ustawkolor(ent);
					ustawkolor(target);
					menuParamTele(id)
				}else teleMenu(id)
			}else teleMenu(id)
		}
		default:{
			item--;
			if(equal(propertiesTele[item][1],"bool")){
				setParamBlock(userBlockProperties[id],item,getParamBlock(userBlockProperties[id],item)==1.0?0.0:1.0)
			}else{
				userBlockParamChange[id] = item
				client_cmd(id, "messagemode value")
			}
		}
	}
	menuParamTele(id)
	return PLUGIN_CONTINUE
}
public createTeleportAim(id){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	new iLook[3]
	new Float:fLook[3]
	get_user_origin(id, iLook, 3)
	IVecFVec(iLook, fLook)
	fLook[2]+=36.0
	
	new ent = createTeleport(fLook, userLastTpCreated[id], userLastTpCreated[id]==0?0:1)
	if( userLastTpCreated[id]==0){
		userLastTpCreated[id]=ent;
	}else{	
		entity_set_int(userLastTpCreated[id], EV_INT_iuser1, ent)
		userLastTpCreated[id]=0;
		
	}
	return ent;
}
public createTeleport(Float:fOrigin[3], endEnter, typeTeleport ){

	new ent =create_entity("info_target");
	if( !pev_valid(ent) )
		return -1;
	
	entity_set_string(ent, EV_SZ_classname, szTeleClassName)	
	entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE);	
	entity_set_int(ent, EV_INT_solid, SOLID_BBOX)
	
	entity_set_int(ent, EV_INT_rendermode, 5);
	entity_set_float(ent, EV_FL_renderamt, 255.0);
	entity_set_model(ent, teleportsSprites[typeTeleport][0])
	entity_set_size(ent, Float:{ -8.0, -8.0, -8.0 }, Float:{ 8.0, 8.0, 8.0 });
	//DispatchSpawn( ent );
	
	entity_set_int(ent, EV_INT_iuser1, endEnter)
	entity_set_int(ent, EV_INT_iuser2, typeTeleport  )
	
	set_task(0.1, "teleportNextFrame", TASK_SPRITE + ent );
	setParamBlock(ent, 0, 70.0)	
	setDefaultParam(ent)
	entity_set_origin(ent, fOrigin)
	entity_set_float(ent, EV_FL_nextthink, get_gametime()+0.1);
	return ent;
}
public ustawkolor(ent)
{	
	new Float:colortele[3];
	colortele[0] = getParamBlock(ent,4)
	colortele[1] = getParamBlock(ent,5)
	colortele[2] = getParamBlock(ent,6)
	entity_set_int(ent, EV_INT_rendermode, 5);
	entity_set_float(ent, EV_FL_renderamt, 100.0);
	set_pev(ent, pev_rendercolor, colortele);
}
public refreshTeleportModel(ent){
	
	entity_set_model(ent, teleportsSprites[entity_get_int(ent, EV_INT_iuser2)][0])
}	
public teleportNextFrame(ent){
	
	ent -= TASK_SPRITE
	if( !pev_valid(ent) )
		return PLUGIN_CONTINUE
	new newFrame = floatround(entity_get_float(ent, EV_FL_frame)+1)%str_to_num(teleportsSprites[entity_get_int(ent, EV_INT_iuser2)][1])
	entity_set_float(ent, EV_FL_frame, float(newFrame))
	
	
	set_task(0.1, "teleportNextFrame", TASK_SPRITE + ent );
	return PLUGIN_CONTINUE
}
public adminMenu(id){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	new menu=menu_create("[BM]^n\yOptions","adminMenu_2")
	new gText[128]
	
	menu_additem(menu, "Moving  blocks")
	format(gText, sizeof(gText), "Group blocks: %s", userSnap[id] ? "\yON" : "\rOFF")
	menu_additem(menu, gText)
	format(gText, sizeof(gText), "%sDistance:\y %0.1f^n",userSnap[id] ? "\w" : "\d", userSnapDist[id])
	menu_additem(menu, gText)
	format(gText, sizeof(gText), "Intelligent rotation:\y %s", IntelligentRotating[userInteligent[id]])
	menu_additem(menu, gText)
	format(gText, sizeof(gText), "Respawn: %s", userRespawn[id] ? "\yYes":"\dNo")
	menu_additem(menu, gText)
	menu_additem(menu, "Find the blocks in the wall")
	menu_additem(menu, "Delete nearest")
	
	menu_setprop(menu,MPROP_EXITNAME,"Exit")
	menu_display(id, menu, 0)
	return PLUGIN_CONTINUE
}
public adminMenu_2(id, menu, item){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	if( item == MENU_EXIT ){
		makerMain(id)
		return PLUGIN_CONTINUE
	}
	
	switch(item){
		case 0:{
			if(wolebmalb[id])
			{
				menuMoveBlock(id)
			}
			else
			{
				MenuMoveBlock2(id);
			}
		}
		case 1:{
			userSnap[id] = !userSnap[id]
		}
		case 2:{
			userSnapDist[id] += 2.0;
			if(userSnapDist[id] > 40.0 ){
				userSnapDist[id]=0.0;
			}
			
		}
		case 3:{
			userInteligent[id]=(userInteligent[id]+1)%sizeof(IntelligentRotating)
			
		}
		case 4:{
			userRespawn[id]=!userRespawn[id]
			if( !is_user_alive(id) )
				ExecuteHamB(Ham_CS_RoundRespawn, id);
		}
		
		case 5:{
			new ent=find_ent_by_class(ent, szBlockClassName)
			while ( ( ent = find_ent_by_class(ent, szBlockClassName) ) ){
				if( isBlockStuck(ent) ){
					remove_entity(ent)
					continue
				}
			}
		}	
		case 6:{
			new Float:fOrigin[3]
			entity_get_vector(id, EV_VEC_origin, fOrigin )
			new Float:fOriginEnt[3]
			new Float:dist=9999.8
			new idEnt;
			new ent=find_ent_by_class(ent, szBlockClassName)
			while ( ( ent = find_ent_by_class(ent, szBlockClassName) ) ){
				if( !pev_valid(ent) ) 
					continue
				
				entity_get_vector(ent, EV_VEC_origin, fOriginEnt )
				if( get_distance_f(fOrigin, fOriginEnt) < dist ) {
					idEnt = ent;
					dist = get_distance_f(fOrigin, fOriginEnt)
				}
			}
			if( IsBlock(idEnt) ){
				entity_get_vector(idEnt, EV_VEC_origin, fOriginEnt )
				set_pev(id, pev_origin, fOriginEnt)
				remove_entity(idEnt)
			}
		}
	}
	if( item != 0 )
		adminMenu(id)
	
	return PLUGIN_CONTINUE
}
public FunkcjaLatarki(id){
	if(userBmShorCut[id]){
		new ent, body
		get_user_aiming(id, ent, body)
		if(IsBlock(ent)) {
			new size, rotation;
			rotation = (entity_get_int(ent, EV_INT_iuser3)+1) % 3	
			size = entity_get_int(ent, EV_INT_skin)
			setSizeAngles(ent, size, rotation, Float:{-1.0, -1.0, -1.0})
		}
	}
	return PLUGIN_HANDLED;
}
public menuLoad(id){
	new gText[128]
	format(gText, sizeof(gText), "[BM]^n\yCurrent template:\r %s\w^nLoad:", actualStyle)
	new menu=menu_create(gText, "menuLoad_2")
	
	
	new dataDir[64]	
	new folderDir[64], szMap[33];
	get_mapname(szMap, sizeof(szMap))
	
	get_datadir(dataDir, charsmax(dataDir));
	formatex(folderDir, charsmax(folderDir), "/%s/%s", szFolderName, szMap);
	
	add(dataDir, charsmax(dataDir), folderDir);
	
	new szFile[32]
	new x=0;
	new folderHandle = open_dir(dataDir, szFile, charsmax(szFile));
	if(!folderHandle) 
		return;
	while(next_file(folderHandle, szFile, charsmax(szFile))){
		if(!equal(szFile, "..") && !equal(szFile, ".") &&!equal(szFile, "BackUp")) {				
			format(gText, sizeof(gText),"Load template:\y %s", szFile)
			copy(stylesMenu[x++], sizeof(stylesMenu[]), szFile)
			menu_additem(menu, gText)
			if(sizeof(stylesMenu) == x-1 )
				break
		}
	}
	menu_display(id,menu,0)
	close_dir(folderHandle)
}
public menuLoad_2(id, menu, item){
	if( item == MENU_EXIT){
		menu_destroy(menu)
		return PLUGIN_CONTINUE
	}
	
	new ent
	while ( ( ent = find_ent_by_class(ent, szBlockClassName) ) ){
		if( !pev_valid(ent) ){
			continue;
		}	
		remove_entity(ent)
	}
	while ( ( ent = find_ent_by_class(ent, szTeleClassName) ) ){
		if( !pev_valid(ent) ){
			continue;
		}	
		remove_entity(ent)
	}
	copy(actualStyle, sizeof(actualStyle), stylesMenu[item])
	set_task(1.0, "LoadBlocks", id)
	return PLUGIN_CONTINUE
}
public menuSave(id){
	
	new gText[128]
	format(gText, sizeof(gText), "[BM]^n\wCurrent level:\r %s\w^nSave:", actualStyle)
	new menu=menu_create(gText, "menuSave_2")
	menu_additem(menu, "\rSave as new style");	
		
	new dataDir[64]	
	new folderDir[64], szMap[33];
	get_mapname(szMap, sizeof(szMap))
	
	get_datadir(dataDir, charsmax(dataDir));
	formatex(folderDir, charsmax(folderDir), "/%s/%s", szFolderName, szMap);
	
	add(dataDir, charsmax(dataDir), folderDir);
	
	
	new szFile[32]
	new x=0;
	
	new folderHandle = open_dir(dataDir, szFile, charsmax(szFile));
	if(!folderHandle) 
		return;
	while(next_file(folderHandle, szFile, charsmax(szFile))){	
			
		if(!equal(szFile, "..") && !equal(szFile, ".") && !equal(szFile, "BackUp")) {	
			if( equal(szFile, actualStyle) )
				format(gText, sizeof(gText),"Currently:\r %s", szFile)
			else format(gText, sizeof(gText),"Save as:\y %s", szFile)
			copy(stylesMenu[x++], sizeof(stylesMenu[]), szFile)
			menu_additem(menu, gText)
			
		}
	}
	
	menu_display(id,menu,0)
	close_dir(folderHandle)
}
public menuSave_2(id, menu, item){
	if( item == MENU_EXIT){
		menu_destroy(menu)
		return PLUGIN_CONTINUE
	}
	if( item == 0 ){
		client_cmd(id, "messagemode layout")
		menuSave(id);
	}else{
		item --;
		if( !equal(actualStyle, stylesMenu[item] ) ){
			userBlockProperties[id]=item;
			meunSaveConfirmation(id)	
		}else{
			SaveBlocks(id, 0)
		}
		
	}
	return PLUGIN_CONTINUE
}
public meunSaveConfirmation(id){
	new gText[128]
	format(gText, sizeof(gText), "[BM]^n\wConfirm:^nThe map will be saved as:\y%s", stylesMenu[userBlockProperties[id]])
	new menu=menu_create(gText, "menuSaveConfirmation_2")
	
	menu_additem(menu, "\ySave")
	menu_additem(menu, "\rDon't save")
	
	menu_display(id,menu,0)
}
public menuSaveConfirmation_2(id,menu,item){
	if( item == MENU_EXIT){
		menu_destroy(menu)
		return PLUGIN_CONTINUE
	}
	copy(actualStyle, sizeof(actualStyle), stylesMenu[userBlockProperties[id]])
	SaveBlocks(id, 0)
	adminMenu(id)
	return PLUGIN_CONTINUE
}
public MenuMoveBlock2(id)
{
	new menu[286]
	format(menu, sizeof(menu), "\
		\y[BM]^n\wMoving Blocks:^n\
		\r1.\w Move o:\y %0.1f^n^n\
		\r2.\w Move\y Up^n\
		\r3.\w Move\y Down^n\
		\r4.\w Move\y X-^n\
		\r5.\w Move\y X+^n\
		\r6.\w Move\r Y-^n\
		\r7.\w Move\r Y+^n^n\
		\r8.\w Enter your value^n\
		\r9.\w Sliding move menu^n\
		\r0.\w Exit\
	", userMoveDist[id])
	show_menu(id, B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9 | B0, menu, -1, "menuMoveBlockGrzyb")
	return PLUGIN_CONTINUE
}
public menuMoveBlock(id){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	new menu=menu_create("[BM]^n\wMove Blocks", "menuMoveBlock_3")
	new gText[128]
	format(gText, sizeof(gText), "Move o:\y %0.1f", userMoveDist[id])
	menu_additem(menu, gText)
	menu_additem(menu, "Move\y X-")
	menu_additem(menu, "Move\y X+")
	menu_additem(menu, "Move\r Y-")
	menu_additem(menu, "Move\r Y+")
	menu_additem(menu, "Move\y Up")
	menu_additem(menu, "Move\y Down")
	
	menu_setprop(menu,MPROP_EXITNAME,"Exit")
	menu_display(id,menu, 0)
	return PLUGIN_CONTINUE
}
public menuMoveBlock_3(id, menu, item){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	if( item == MENU_EXIT){
		adminMenu(id)
		return PLUGIN_CONTINUE
	}
	new ent,body
	
	new Float:fOrigin[3]
	if( item != 0 ){
		get_user_aiming(id,ent,body)
	
		if( IsBlock(ent) ){
			userLastMoved[id]=ent
		}
		if( !IsBlock(userLastMoved[id]) ){		
			menuMoveBlock(id)		
			return PLUGIN_CONTINUE
		}
		
		ent=userLastMoved[id];
		entity_get_vector(ent, EV_VEC_origin, fOrigin)
	}
	switch(item){
		case 0:{
			client_cmd(id, "messagemode WartoscPosuwania")
			/*if( userMoveDist[id] < 0.5 )			
				userMoveDist[id]+=0.1
			else if( userMoveDist[id] < 2.0 )
				userMoveDist[id]+=0.5			
			else if( userMoveDist[id] > 20.0 )
				userMoveDist[id]=0.1
			else userMoveDist[id]+=2.0*/
		}
		case 1: fOrigin[0]-=userMoveDist[id]
		case 2: fOrigin[0]+=userMoveDist[id]
		case 3: fOrigin[1]-=userMoveDist[id]
		case 4: fOrigin[1]+=userMoveDist[id]
		case 5: fOrigin[2]+=userMoveDist[id]
		case 6: fOrigin[2]-=userMoveDist[id]
	}
	entity_set_origin(ent, fOrigin)
	menuMoveBlock(id)
	return PLUGIN_CONTINUE
}
public menuMoveBlock_2(id, item){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	new ent,body
	if( item == 9 ){
		adminMenu(id)
		return PLUGIN_CONTINUE
	}
	new Float:fOrigin[3]
	get_user_aiming(id,ent,body)
	entity_get_vector(ent, EV_VEC_origin, fOrigin)
	if( item >= 1 && item <=6){
		if( !IsBlock(ent) ){	
			MenuMoveBlock2(id)		
			return PLUGIN_CONTINUE
		}
	}
	switch(item){
		case 0:{
			if( userMoveDist[id] <= 0.1 )			
				userMoveDist[id]= 1.0
			else if( userMoveDist[id] < 32.0 )
				userMoveDist[id] = 	userMoveDist[id]*2
			else if( userMoveDist[id] >= 32.0 )
				userMoveDist[id]=0.1
			else userMoveDist[id]+=2.0
		}
		case 1: fOrigin[2]+=userMoveDist[id]
		case 2: fOrigin[2]-=userMoveDist[id]
		case 3: fOrigin[0]-=userMoveDist[id]
		case 4: fOrigin[0]+=userMoveDist[id]
		case 5: fOrigin[1]-=userMoveDist[id]
		case 6: fOrigin[1]+=userMoveDist[id]
		case 7: {
			client_cmd(id, "messagemode WartoscPosuwania")
		}
		case 8:{
			MenuObracania(id);
			return PLUGIN_CONTINUE
		}
		case 9: adminMenu(id)
	}
	entity_set_origin(ent, fOrigin)
	MenuMoveBlock2(id)
	return PLUGIN_CONTINUE
}
public ZmienWartoscPosuwania(id){
	new szCash[64];
	read_argv(1, szCash, 63)
	remove_quotes(szCash);
	new Float:Cash = str_to_float(szCash);

	userMoveDist[id] = Cash;
	
	client_print(id, 3, "You have set the Sliding power to: %0.1f", Cash);
	if(wolebmalb[id])
	{
		menuMoveBlock(id);
	}
	else
	{
		MenuMoveBlock2(id);
	}
	return PLUGIN_HANDLED;
}
public selectBlock(id){
	new iCountBlock[NUMBLOCKS]
	new ent = find_ent_by_class(-1, szBlockClassName)
	while( ent != 0 ){
		if( !IsBlock(ent) ){
			continue;
		}
		iCountBlock[entity_get_int(ent, EV_INT_body)]++;
		ent=find_ent_by_class(ent, szBlockClassName)
	}
	new gText[128]
	format(gText, sizeof(gText), "[BM]^n\yBlocks:\r %d^n\wChoose block:", NUMBLOCKS )
	new menu=menu_create(gText, "selectBlock_2")
	for( new i = 0;i <NUMBLOCKS;i++){
		format(gText, sizeof(gText), "%s\y [Numbers:\r %d\w]", blocksProperties[i][0], iCountBlock[i])
		menu_additem(menu, gText)
	}		
	menu_setprop(menu,MPROP_EXITNAME,"Exit")
	menu_display(id, menu, (userSelectedBlock[id]/7))
}
public selectBlock_2(id, menu, item){
	if( item == MENU_EXIT ){
		if(wolebmalb[id])
		{
			blockMaker(id)
		}
		else
		{
			GrzyboblockMaker(id)
		}
		return PLUGIN_CONTINUE
	}
	if( userAdminBlockTest[id] ){
		new Float:fOrigin[3]
		new ent = find_ent_by_class(-1, szBlockClassName)
		while( ent != 0 ){
			if( !IsBlock(ent) ){
				continue;
			}
			if( entity_get_int(ent, EV_INT_body) == item ){
				pev(ent ,pev_origin, fOrigin)
				set_pev(id ,pev_origin, fOrigin)
				break;
			}	
			
			ent=find_ent_by_class(ent, szBlockClassName)
		}
			
		userSelectedBlock[id]=item;
		selectBlock(id)
	}else{
		userSelectedBlock[id]=item;		
		if(wolebmalb[id])
		{
			blockMaker(id)
		}
		else
		{
			GrzyboblockMaker(id)
		}
	}
	return PLUGIN_CONTINUE
}
public createBlockAim(id){
	
	new iLook[3]
	new Float:fLook[3]
	get_user_origin(id, iLook, 3)
	IVecFVec(iLook, fLook)
	
	fLook[2]+=4.0
	
	new ent = createBlock(userSelectedBlock[id], fLook, userSelectedSize[id], 2, Float:{ 0.0 , 0.0, 0.0 })
	setDefaultParam(ent)
	if( entity_get_int(ent,EV_INT_body) != GLASS )
		setRenderingBlock(ent)
	/*if( entity_get_int(ent,EV_INT_body) == GLASS )
		set_rendering(ent, kRenderFxNone, 255, 255, 255, kRenderTransAdd, 40);	*/
	new closest = DoSnapping(id, ent, fLook)
	if( userSnap[id] )
		entity_set_origin(ent, fLook)
	if( IsBlock(closest) && userInteligent[id]){		
		setSizeAngles(ent, entity_get_int(ent, EV_INT_skin), entity_get_int(closest, EV_INT_iuser3), Float:{ 0.0 , 0.0, 0.0 })
	}
	
}
public delaySnapping(data[]){
	new iLook[3]
	new Float:fLook[3]	
	iLook[0]=data[0]
	iLook[1]=data[1]
	iLook[2]=data[2]
	IVecFVec(iLook, fLook)
	DoSnapping(data[3], data[4], fLook)
}

public createBlock(typeBlock, Float:fOrigin[3], size, rotation, Float:fAngles[3]){
	new ent = create_entity("info_target")
	if( !pev_valid(ent) )
		return -1;
		
	entity_set_string(ent, EV_SZ_classname, szBlockClassName)	
	entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE);	
	entity_set_int(ent, EV_INT_solid, SOLID_BBOX)
	entity_set_int(ent, EV_INT_body, typeBlock)
	entity_set_int(ent, EV_INT_skin, size)	
	entity_set_int(ent, EV_INT_iuser1, 0)
	entity_set_int(ent, EV_INT_iuser2, 0)
	entity_set_int(ent, EV_INT_iuser3, rotation)
	
	entity_set_vector(ent, EV_VEC_angles, fAngles)
	
	entity_set_edict(ent, EV_ENT_euser1, 0 )
	
	entity_set_int(ent, EV_INT_iuser4, 255 )
	if(typeBlock==GLASS){	
		set_rendering(ent, kRenderFxNone, 255, 255, 255, kRenderTransAdd, 40);	
	}
	entity_set_vector(ent, EV_VEC_rendercolor, Float:{255.0,255.0,255.0} )
	entity_set_model(ent, pathModelBlock(typeBlock, size))
	
	
	resetBlockData(ent)
	setDefaultParam(ent)
	
	setSizeAngles(ent, size, rotation, fAngles)
	entity_set_origin(ent, fOrigin)
	if( typeBlock == WATER ){		
		
		set_task(0.1, "makeTrigger", ent+TASK_TRIGGER)	
		//set_task(2.0, "teleportMakeSolid", ent+TASK_TELEPORT)
	}
	return ent;
}
public makeTrigger(ent){
	ent-=TASK_TRIGGER
	
	
	if( !pev_valid(ent) )
		return PLUGIN_CONTINUE
	
	if( entity_get_int(ent, EV_INT_body) != WATER )
		return PLUGIN_CONTINUE
	static Float:fOrigin[3];
	static Float:fOriginPlayer[3];
	new bool:gNearEnt;
	entity_get_vector(ent, EV_VEC_origin, fOrigin)
	for( new i = 1; i<=33;i++){
		if( !is_user_alive(i) || !is_user_connected(i) )	
			continue
		entity_get_vector(i, EV_VEC_origin, fOriginPlayer)	
		if(get_distance_f(fOriginPlayer, fOrigin) > 150.0 )
			continue;		
		gNearEnt=true;
		break;
	}
	
	new Float:flMins[3], Float:flMaxs[3];
	pev(ent, pev_mins, flMins);
	pev(ent, pev_maxs, flMaxs);
			
	set_pev(ent, pev_solid, gNearEnt? SOLID_TRIGGER : SOLID_BBOX);
	engfunc(EngFunc_SetSize, ent, flMins, flMaxs);	
	
	set_task(0.1, "makeTrigger", ent+TASK_TRIGGER) 
	
	return PLUGIN_CONTINUE
}
public rotateBlock(ent){	
	new size, rotation;
	rotation = (entity_get_int(ent, EV_INT_iuser3)+1) % 3	
	size = entity_get_int(ent, EV_INT_skin)
	setSizeAngles(ent, size, rotation, Float:{ 0.0 , 0.0, 0.0 })
}
public setSizeAngles(ent, size, rotation, Float:anglesR[3]){
	new Float:mins[3], Float:maxs[3], Float:angles[3];
	new Float:scale = str_to_float(blocksSize[size][2])
	switch( rotation ){
		case 0:{
			if( size != TINY ){
				mins[0] = -4.0;	
				mins[1] = -32.0;	
				mins[2] = -32.0;			
				maxs[0] = 4.0;
				maxs[1] = 32.0;
				maxs[2] = 32.0;
			}else{
				mins[0] = -32.0;
				mins[1] = -4.0;
				mins[2] = -4.0;			
				maxs[0] = 32.0;
				maxs[1] = 4.0;
				maxs[2] = 4.0;				
			}
			angles[0]=90.0;
		}
		case 1:{
			if( size != TINY ){
				mins[0] = -32.0;	
				mins[1] = -4.0;	
				mins[2] = -32.0;			
				maxs[0] = 32.0;
				maxs[1] = 4.0;
				maxs[2] = 32.0;
			}else{
				mins[0] = -4.0;
				mins[1] = -32.0;
				mins[2] = -4.0;			
				maxs[0] = 4.0;
				maxs[1] = 32.0;
				maxs[2] = 4.0;				
			}
			angles[0] = 90.0;
			angles[2] = 90.0;
		}
		case 2:{
			if( size != TINY ){
				mins[0] = -32.0;	
				mins[1] = -32.0;	
				mins[2] = -4.0;			
				maxs[0] = 32.0;
				maxs[1] = 32.0;
				maxs[2] = 4.0;
			}else{
				mins[0] = -4.0;
				mins[1] = -4.0;
				mins[2] = -32.0;			
				maxs[0] = 4.0;
				maxs[1] = 4.0;
				maxs[2] = 32.0;				
			}
			angles[0] = 0.0;
			angles[1] = 0.0;
			angles[2] = 0.0;
		}
	}
	for( new i =0 ; i < 3;i ++ ){
		if( rotation==2 && i == 2 )
			continue;
			
		if( maxs[i] == 4.0 || maxs[i] == -4.0 )
			continue
		mins[i] *= scale;
		maxs[i] *= scale;	
	}
	
	
	if(!(anglesR[0] == -1.0 && anglesR[1] == -1.0 && anglesR[2] == -1.0)) for(new i = 0; i < 3; i ++) angles[i] = anglesR[i];
	
	entity_set_int(ent, EV_INT_skin, size)
	entity_set_int(ent, EV_INT_iuser3, rotation)
	entity_set_vector(ent, EV_VEC_angles, angles)
	entity_set_size(ent, mins, maxs)
}
public pathModelBlock(typeBlock, size){
	new gText[68];
	format(gText, sizeof(gText), "models/FSBM1/%s%s.mdl", blocksProperties[typeBlock][1], blocksSize[size][0])
	return gText;
}	

public IsBlock(ent){
	if( !pev_valid(ent) )
		return false;
	new szClass[12]
	entity_get_string(ent, EV_SZ_classname, szClass, sizeof(szClass) )
	return (equal(szClass, szBlockClassName ) || equal(szClass, szTeleClassName )|| equal(szClass, szLightClassName ))
	
}
public IsTeleport(ent){
	if( !pev_valid(ent) )
		return false;
	new szClass[14]
	entity_get_string(ent, EV_SZ_classname, szClass, sizeof(szClass) )
	return (equal(szClass, szTeleClassName ))
}
public IsLight(ent){
	if( !pev_valid(ent) )
		return false;
	new szClass[14]
	entity_get_string(ent, EV_SZ_classname, szClass, sizeof(szClass) )
	return (equal(szClass, szLightClassName ))
}
public actionBhop(ent){
	if( task_exists(ent+TASK_BHOP) )
		return PLUGIN_CONTINUE
	
	
	set_task(0.1, "makeNoSolid", ent+TASK_BHOP)
	
	return PLUGIN_CONTINUE
}
public actionNoSlowBhop(id, ent){
	userNoSlow[id]=true;
	actionBhop(ent)
	if( !task_exists(TASK_NOSLOW+id) )
		remove_task(id+TASK_NOSLOW)
	set_task(0.1, "taskSlowDown", id+TASK_NOSLOW)
	
}
public actionBhopLatency(id, ent){
	if( !pev_valid(ent)){
		return PLUGIN_CONTINUE;		
	}
	
	new Float:timeBH = get_gametime();
	new Float:block = getParamBlock(ent,0)

	entity_get_float(ent, EV_FL_fuser1)
	
	if( ( userLatency[id] <= 0.0 || userLatency2[id] != ent )){
		userLatency[id] = block - (timeBH - entity_get_float(ent, EV_FL_fuser1));
		userLatency2[id] = ent
	}
	
		
	if ( task_exists(ent + TASK_BHOP )) 
		return PLUGIN_CONTINUE;
	
	entity_set_float(ent, EV_FL_fuser1, timeBH);
	
	set_task(block, "makeNoSolid", ent+TASK_BHOP)
	
	return PLUGIN_CONTINUE
}
public actionDeath(id, ent){
	if( !is_user_alive(id) )
		return PLUGIN_CONTINUE
	if( userGodMode[id] ){
		if( userCheckPoint[id] ){
			backToCheckPoint(id)
		}
		if( get_gametime()-deathTouched[id] > 0.2 ){
			static Float:fTime[ 33 ]
			new Float:fTimeNow = get_gametime();
			if( ( fTimeNow - fTime[ id ] ) >= 0.2 ){
				
				set_dhudmessage(255, 32, 32, -1.0, 0.25, 0, 0.1, 0.2, 0.1, 0.1)
				show_dhudmessage(id, "!! You touch death !!");
			
			
				fTime[ id ] = fTimeNow 	
			}	
			deathTouched[id]=get_gametime();
		}
	}else{
		if( getParamBlock(ent, 18) == 0.0 ){
			if( userSkills[id][0][0] > get_gametime() ){
				return PLUGIN_CONTINUE;
			}
		}
		/*if( get_gametime() - frost_last_time(id) < 9.0 ){	
			new freezer = frost_last_freezer(id)
			if( freezer != 0 && is_user_connected(freezer) ){
				//xp_add_mission(frost_last_freezer(id), 4, 1)
				ExecuteHamB( Ham_TakeDamage, id, frost_last_freezer(id), frost_last_freezer(id), 1000.0, DMG_GENERIC );		
				return PLUGIN_CONTINUE
			}
		}*/
		if( get_gametime() -userSlowedTime[id]  < 9.0 ){
			if( userSlowed[id] != 0 && is_user_connected(userSlowed[id]) ){		
				ExecuteHamB( Ham_TakeDamage, id,userSlowed[id], userSlowed[id], 1000.0, DMG_GENERIC );
			}
			
		}	
		fakedamage(id, "", 10000.0, DMG_GENERIC);
	}
	return PLUGIN_CONTINUE
}
public taskSlowDown(id){
	id-=TASK_NOSLOW
	userNoSlow[id]=false;
}
public actionBarrier(id, ent){	
	if( task_exists(ent+TASK_BHOP) )
		return PLUGIN_CONTINUE
	
	makeNoSolid(ent+TASK_BHOP)
	
	return PLUGIN_CONTINUE
}
public makeNoSolid(ent){
	ent-=TASK_BHOP;
	
	
	set_rendering(ent, kRenderFxNone, 255, 255, 255, kRenderTransAdd, 25);
	//changeAlpha(ent, 40)
	entity_set_int(ent, EV_INT_solid, SOLID_NOT)
	if( entity_get_edict(ent,EV_ENT_euser3) == 1){
		set_task(1.8, "makeSolid", ent+TASK_BHOP)
		entity_set_edict(ent,EV_ENT_euser3,0) 
	}else set_task(layoutStyle?0.8:1.0, "makeSolid", ent+TASK_BHOP)
}
public makeSolid(ent){
	ent-=TASK_BHOP;	
	entity_set_int(ent, EV_INT_solid, SOLID_BBOX)
	setRenderingBlock(ent)
}
public actionIce(id,ent){
	if( task_exists(id+TASK_ICE) )
		return PLUGIN_CONTINUE
	
	entity_set_float(id, EV_FL_friction, 0.15);
	entity_set_float(id, EV_FL_maxspeed, 400.0);
	userOnIce[id]=true;
	set_task(0.1, "taskNoIce", id+TASK_ICE)
	return PLUGIN_CONTINUE
}
public actionMagicSpeed(id,ent){
	if( task_exists(id+TASK_ICE) )
		return PLUGIN_CONTINUE
	entity_set_float(id, EV_FL_friction, 0.9);
	userMagic[id]=true;
	set_task(0.1, "taskNoIce", id+TASK_ICE)
	return PLUGIN_CONTINUE
}

public taskNoIce(id){	
	id-=TASK_ICE	
	userOnIce[id]=false;
	userMagic[id]=false;
	entity_set_float(id, EV_FL_friction, 1.0);
}
public actionGodMode(id, ent){
	if( userSkills[id][0][1] < get_gametime() ){
		if( task_exists(id+TASK_SKILL_HUD ) ){
			remove_task(id+TASK_SKILL_HUD)
		}
		
		set_task(0.1, "showHud", id+TASK_SKILL_HUD)
		userSkills[id][0][0]=get_gametime()+getParamBlock(ent,9)
		userSkills[id][0][1]=get_gametime()+getParamBlock(ent,10)+getParamBlock(ent,9)
		emit_sound(id, CHAN_WEAPON, soundsNames[1], 1.0, ATTN_NORM, 0, PITCH_NORM)	
	}else if( userSkills[id][0][1] > get_gametime() && userSkills[id][0][0] < get_gametime() ) {
		if( !task_exists(id+TASK_SKILL_HUD ) ){
			set_task(0.1, "showHud", id+TASK_SKILL_HUD)
		}
		userSkillsRenew[id][0]=true;
	}
}
public actionInvisible(id, ent){
	if( userSkills[id][1][1] < get_gametime() ){
		
		if( task_exists(id+TASK_SKILL_HUD ) ){
			remove_task(id+TASK_SKILL_HUD)
		}
		
		set_task(0.1, "showHud", id+TASK_SKILL_HUD)
		if( userSkills[id][1][0] - get_gametime() <= 0.0 )
			userSkills[id][1][0]=get_gametime()+getParamBlock(ent,9)
		else{
			change_task(id+TASK_VISIBLE, userSkills[id][1][0] - get_gametime()+getParamBlock(ent,9))
		}
			
		userSkills[id][1][1]=get_gametime()+getParamBlock(ent,10)+getParamBlock(ent,9)
		setRenderingPlayer(0, id, 255,255,255,0)
		set_task(getParamBlock(ent,9), "userVisible", id+TASK_VISIBLE)		
		emit_sound(id, CHAN_WEAPON, soundsNames[2], 1.0, ATTN_NORM, 0, PITCH_NORM)	
		
	}else if( userSkills[id][1][1] > get_gametime()  && userSkills[id][1][0] < get_gametime() ) {
		if( !task_exists(id+TASK_SKILL_HUD ) ){
			set_task(0.1, "showHud", id+TASK_SKILL_HUD)
		}
		userSkillsRenew[id][1]=true;
	}
}
public userVisible(id){
	id-=TASK_VISIBLE
	setRenderingPlayer(0, id, 255,255,255,255)
}
public actionGun(id, ent){
	
	if( !blockUsed(id,ent) ){
		new weaponToGive = floatround(getParamBlock(ent, 11)) ==  -1 ? random(sizeof(weaponsGive)) : floatround(getParamBlock(ent, 11))
		new weapon = find_ent_by_owner(-1, weaponsGive[weaponToGive], id)
		if( weapon ){
			cs_set_weapon_ammo(weapon, cs_get_weapon_ammo(weapon)+floatround(getParamBlock(ent, 13)));
		}else{
			new weapon=give_item(id, weaponsGive[weaponToGive])
			cs_set_weapon_ammo(weapon, floatround(getParamBlock(ent, 13)));
			
		}
		emit_sound(ent, CHAN_WEAPON, soundsNames[5], 1.0, ATTN_NORM, 0, PITCH_NORM)
		setUsed(id,ent)
	}	
}
public actionGrenade(id, ent){
	if( !blockUsed(id,ent) ){
		new weaponToGive = floatround(getParamBlock(ent, 17)) ==  -1 ? random(sizeof(weaponsGive)) : floatround(getParamBlock(ent, 17))
		
		new weapon = find_ent_by_owner(-1, grenadesGive[weaponToGive], id)
		if( !weapon ){
			give_item(id, grenadesGive[weaponToGive])		
			cs_set_user_bpammo(id , cswGrenade[weaponToGive] , floatround(getParamBlock(ent, 13)));
			emit_sound(ent, CHAN_WEAPON, soundsNames[5], 1.0, ATTN_NORM, 0, PITCH_NORM)
			setUsed(id,ent)
		}else{
			//if( floatround(getParamBlock(ent, 17)) == 2 ){
				cs_set_user_bpammo(id, cswGrenade[weaponToGive], cs_get_user_bpammo(id, cswGrenade[weaponToGive])+floatround(getParamBlock(ent, 13)));
				
				emit_sound(ent, CHAN_WEAPON, soundsNames[5], 1.0, ATTN_NORM, 0, PITCH_NORM)
				setUsed(id,ent)
		}
		
	}
}
public actionBoots(id, ent){
	if( userSkills[id][2][1] < get_gametime() ){
		
		if( task_exists(id+TASK_SKILL_HUD ) ){
			remove_task(id+TASK_SKILL_HUD)
		}	
		set_task(0.1, "showHud", id+TASK_SKILL_HUD)
		
		userSkills[id][2][0]=get_gametime()+getParamBlock(ent,9)	
		userSkills[id][2][1]=get_gametime()+getParamBlock(ent,10)+getParamBlock(ent,9)
		emit_sound(id, CHAN_WEAPON, soundsNames[6], 1.0, ATTN_NORM, 0, PITCH_NORM)
	}else if( userSkills[id][2][1] > get_gametime()  && userSkills[id][2][0] < get_gametime() ){
		if( !task_exists(id+TASK_SKILL_HUD ) ){
			set_task(0.1, "showHud", id+TASK_SKILL_HUD)
		}
		userSkillsRenew[id][2]=true;
	}
}
public actionMusic(id, ent){
	if( get_gametime() - pev(ent, pev_fuser1) >= 22.0 ){
		set_pev(ent, pev_euser4, random(sizeof(blockMusic)))
		emit_sound(ent, CHAN_WEAPON, blockMusic[pev(ent, pev_euser4)][0], 1.0, ATTN_NORM, 0, PITCH_NORM)
		set_pev(ent, pev_fuser1, get_gametime())
	}
	
}
public actionCamouflage(id, ent){
	if( userSkills[id][3][1] < get_gametime() ){
		
		if( task_exists(id+TASK_SKILL_HUD ) ){
			remove_task(id+TASK_SKILL_HUD)
		}		
		set_task(0.1, "showHud", id+TASK_SKILL_HUD)
		
		cs_set_user_model(id, modelCamouflage[random(4)+(4*(get_user_team(id)==1?1:0))])
		userSkills[id][3][0]=get_gametime()+getParamBlock(ent,9)	
		userSkills[id][3][1]=get_gametime()+getParamBlock(ent,10)+getParamBlock(ent,9)
		emit_sound(id, CHAN_WEAPON, soundsNames[7], 1.0, ATTN_NORM, 0, PITCH_NORM)
		set_task(getParamBlock(ent,9), "turnOffCamouflage",id+TASK_CAMOUFLAGE)
	}else if( userSkills[id][3][1] > get_gametime() && userSkills[id][3][0] < get_gametime() ){ 
		if( !task_exists(id+TASK_SKILL_HUD ) ){
			set_task(0.1, "showHud", id+TASK_SKILL_HUD)
		}		
		userSkillsRenew[id][3]=true;
	}

}
public turnOffCamouflage(id){
	id-=TASK_CAMOUFLAGE
	cs_set_user_model(id, modelCamouflage[random(4)+(4*(get_user_team(id)==1?0:1))])
}
public numPlayers(){
	new iNum = 0;
	for(new i = 1 ; i < 33 ; i ++ ){
		if( !is_user_connected(i) || is_user_hltv(i) )
			continue
		iNum++
	}		
	return iNum
}
public actionPoints(id, ent){
	
	if( !blockUsed(id,ent) ){
		new weaponToGive = floatround(getParamBlock(ent, 11)) ==  -1 ? random(sizeof(weaponsGive)) : floatround(getParamBlock(ent, 11))
		new weapon = find_ent_by_owner(-1, weaponsGive[weaponToGive], id)
		if( weapon ){
			cs_set_weapon_ammo(weapon, cs_get_weapon_ammo(weapon)+floatround(getParamBlock(ent, 13)));			
			emit_sound(ent, CHAN_WEAPON, soundsNames[5], 1.0, ATTN_NORM, 0, PITCH_NORM)
			setUsed(id,ent)
		}
	}	
}
public actionAmmo(id, ent){
	
	if( !blockUsed(id,ent) ){
		new weaponToGive = floatround(getParamBlock(ent, 11)) ==  -1 ? random(sizeof(weaponsGive)) : floatround(getParamBlock(ent, 11))
		new weapon = find_ent_by_owner(-1, weaponsGive[weaponToGive], id)
		if( weapon ){
			cs_set_weapon_ammo(weapon, cs_get_weapon_ammo(weapon)+floatround(getParamBlock(ent, 13)));			
			emit_sound(ent, CHAN_WEAPON, soundsNames[5], 1.0, ATTN_NORM, 0, PITCH_NORM)
			setUsed(id,ent)
		}
	}	
}
public actionPotion(id, ent){	
	if( !blockUsed(id,ent) ){
		if( get_user_health(id)){
			//new health=min(get_user_health(id) + floatround( getParamBlock(ent,5) ))
			//set_user_health(id, health )
			//setUsed(id,ent)			
			//emit_sound(ent, CHAN_WEAPON, soundsNames[12], 1.0, ATTN_NORM, 0, PITCH_NORM)
		}
		
	}	
}
public actionGravity(id, ent){
	set_user_gravity(id, getParamBlock(ent, 21));
	
	g_low_gravity[id] = true;
	g_low_trampoline[id] = true;
}
public ActionTimerStart(id, ent)
{
	CzasTimera[id] = 0
	if(ZatrzymanyTimer[id]){
		ZatrzymanyTimer[id] = false;
		OdpalTimer(id);
	}
}
public ActionTimerStop(id, ent)
{
	if(!ZatrzymanyTimer[id]){
		new name[33];
		get_user_name(id, name, sizeof(name))
		if(getParamBlock(ent, 26) >= CzasTimera[id])	OdpalNagrode(id);
		if(getParamBlock(ent, 27) >= CzasTimera[id])	ColorChat(0, GREEN, "^x01 Player^x04 %s^x01 finished ahead of time^x04 [^x01%is^x04]", name, CzasTimera[id])
		ZatrzymanyTimer[id] = true;
		CzasTimera[id] = 0
	}
}
public OdpalNagrode(id){
	if(!NagrodaTimer[id]){
		NagrodaTimer[id] = true;
		
		if(get_user_team(id) == 1){
			new MenuBody[512], len, keys;
			len = format(MenuBody, (sizeof MenuBody - 1), "\r[BM]\y Collect your reward^n\wPrize Menu");
			len += format(MenuBody[len], (sizeof MenuBody - 1) - len, "^n^n\r1.\w Flash Grenade chance:\y	[100%]");
			len += format(MenuBody[len], (sizeof MenuBody - 1) - len, "^n\r2.\w Flash Grenade chance:\y	[100%]");
			len += format(MenuBody[len], (sizeof MenuBody - 1) - len, "^n\r3.\w Frost Grenade chance:\y	[50%]");
			len += format(MenuBody[len], (sizeof MenuBody - 1) - len, "^n\r4.\w HE Grenade chance:\y	[25%]");
			
			keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4);
			
			show_menu(id, keys, MenuBody, -1, "NagrodaMenu");
		}
	}
}
public HandleNagrodaMenu(id, key)
{
	switch(key + 1)
	{
		case 1: give_item(id, "weapon_flashbang");
		/*{
			new MAXHP = pobierz_MAXHP(id)
			if(get_user_health(id) == MAXHP+100){
				NagrodaTimer[id] = false;
				OdpalNagrode(id);
			}
			set_user_health(id, MAXHP+100)
		}*/
		case 2:	give_item(id, "weapon_flashbang");
		case 3:
		{
			new los = random_num(1,2)
			if(los == 1)	give_item(id, "weapon_smokegrenade");
		}
		case 4: 
		{
			new los = random_num(1,4)
			if(los == 1)	give_item(id, "weapon_hegrenade");
		}
	}
	return 1;
}
public OdpalTimer(id)
{
	set_task(1.0, "Timer", id);
}
public Timer(id)
{
	if(ZatrzymanyTimer[id])
		return PLUGIN_HANDLED;
	
	set_task(1.0, "Timer", id);
	
	CzasTimera[id] ++;
	
	return PLUGIN_HANDLED;
}
public actiondodatkoweS(id, ent){
	addjb[id] = floatround(getParamBlock(ent, 22))
	dwajumpy[id] = true;
	
	static Float:fTime[ 33 ]
	new Float:fTimeNow = get_gametime();
	if( ( fTimeNow - fTime[ id ] ) >= 0.2 ){
		
		set_dhudmessage(64, 64, 255, -1.0, 0.25, 0, 0.1, 0.2, 0.1, 0.1)
		show_dhudmessage(id, "!! You have %d %s !!", floatround(getParamBlock(ent, 22)), floatround(getParamBlock(ent, 22)) == 1 ? "extra jump" : "extra jumps")
	
		fTime[ id ] = fTimeNow 	
	}
	static bool:dowybicia;
	dowybicia = bool:(pev(id, pev_button) & IN_JUMP);
	
	if(dowybicia){
		if(pev(id, pev_velocity, userAddVelocity[id] ) ){
			userAddVelocity[id][2] = getParamBlock(ent, 24);
		}
	}
}
public actionSpamBH(id, ent){
	if(pev(id, pev_velocity, userAddVelocity[id] ) ){
		userAddVelocity[id][2] = 250.0;
	}
}
public actionFeniks(id, ent){
	if( userSkills[id][4][1] < get_gametime() ){
		if( task_exists(id+TASK_SKILL_HUD ) ){
			remove_task(id+TASK_SKILL_HUD)
		}
			
		feniks[id] = true;
		if(feniks[id]){
			set_task(0.1, "setFeniks", id + TASK_FENIKS)
		}
		set_task(getParamBlock(ent,9), "wylaczogien", id)
		set_task(0.1, "showHud", id+TASK_SKILL_HUD)
		userSkills[id][4][0]=get_gametime()+getParamBlock(ent,9)
		userSkills[id][4][1]=get_gametime()+getParamBlock(ent,10)+getParamBlock(ent,9)
		set_user_rendering(id, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 15);
		set_task(getParamBlock(ent,9), "userVisible", id+TASK_VISIBLE)
		emit_sound(id, CHAN_WEAPON, soundsNames[14], 1.0, ATTN_NORM, 0, PITCH_NORM)	
	}else if( userSkills[id][4][1] > get_gametime() && userSkills[id][4][0] < get_gametime() ) {
		if( !task_exists(id+TASK_SKILL_HUD ) ){
			set_task(0.1, "showHud", id+TASK_SKILL_HUD)
		}
		userSkillsRenew[id][4]=true;
	}
}
public wylaczogien(id){
    feniks[id] = false;
    remove_task(id + TASK_FENIKS);
}
public setFeniks(id)
{
    id -= TASK_FENIKS
    new origin[3];
    get_user_origin(id, origin, 0);

    message_begin(MSG_BROADCAST, SVC_TEMPENTITY, origin)
    write_byte(TE_EXPLOSION)
    write_coord(origin[0])
    write_coord(origin[1])
    write_coord(origin[2])
    write_short(sprite_fire)
    write_byte(5)
    write_byte(15)
    write_byte(4)
    message_end()
    displayFade(id, 512,512,512,250,150, 30, 50);
    set_task(0.2, "setFeniks", id + TASK_FENIKS)

}
public ThinkSpritesBlock(ent)
{
	if(!pev_valid(ent))
		return
	
	new Frame = floatround(entity_get_float(ent, EV_FL_frame)+1.0)%15
	entity_set_float(ent, EV_FL_frame, float(Frame))
	entity_set_float(ent, EV_FL_nextthink, get_gametime() +0.1)
}
public thinkWater(ent)
{
	static entinsphere, Float:origin[3], bool:ent_near;
	entity_get_vector(ent, EV_VEC_origin, origin);
	
	entinsphere = -1;
	ent_near = false;
	while ( ( entinsphere = find_ent_in_sphere(entinsphere, origin, 64.0) ) )
	{
		if ( 1 <= entinsphere <= 33 && is_user_alive(entinsphere))
		{
			ent_near = true;
			break;
		}
	}
	
	if ( ent_near )
	{
		if(entity_get_int(ent, EV_INT_solid) != SOLID_TRIGGER)
		{
			SetSolidTrigger(ent);
			entity_set_float(ent, EV_FL_nextthink, get_gametime() + 1.0);
			return 1;
		}
	}
	else if(entity_get_int(ent, EV_INT_solid) == SOLID_TRIGGER)
		SetSolidAgain(ent+TASK_SOLIDTRIGGER);
	
	entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.1);
	return 1;
}
public SetSolidTrigger(ent)
{
	new Float:fMins[3], Float:fMaxs[3];
	entity_get_vector(ent, EV_VEC_mins, fMins);
	entity_get_vector(ent, EV_VEC_maxs, fMaxs);
	
	entity_set_int(ent, EV_INT_solid, SOLID_TRIGGER);
	
	entity_set_size(ent, fMins, fMaxs);
}

public SetSolidAgain(ent)
{	
	ent -= TASK_SOLIDTRIGGER;
	
	new Float:fMins[3], Float:fMaxs[3];
	entity_get_vector(ent, EV_VEC_mins, fMins);
	entity_get_vector(ent, EV_VEC_maxs, fMaxs);
	
	entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
	
	entity_set_size(ent, fMins, fMaxs);
}
public actionWater(id, ent){
	if(!( id >= 1 || id <= 33 ) || !is_user_alive(id))
		return 1;
	
	/*if(gfNextWaterSound[id] < fGameTime)
	{
		emit_sound(ent, CHAN_STATIC, g_sound_water[random_num(1, charsmax(g_sound_water))], 1.0, ATTN_NORM, 0, PITCH_NORM);
		gfNextWaterSound[id] = get_gametime() + 1.5;
	}*/
	
	pev(id, pev_velocity, userAddVelocity[id]);
	
	if(userAddVelocity[id][0] > 250.0) 
		userAddVelocity[id][0] *= 0.95;
	if(userAddVelocity[id][1] > 250.0) 
		userAddVelocity[id][1] *= 0.95;
	
	static bool:bPressingSpace;
	bPressingSpace = bool:(pev(id, pev_button) & IN_JUMP);
	
	static Float:fOrigin[3], Float:fPlayerOrigin[3];
	pev(ent, pev_origin, fOrigin);
	pev(id, pev_origin, fPlayerOrigin);
	
	if(getParamBlock(ent, 1))
	{
		if(fPlayerOrigin[2] < fOrigin[2])
			return 1;
	}
	
	if(bPressingSpace)
		userAddVelocity[id][2] = getParamBlock(ent, 16);
	else
		userAddVelocity[id][2] = - SpeedInWater;
		
	return 1;
	/*new Float:flOrigin[3];
	pev(ent, pev_origin, flOrigin);
	
	if (pev(id, pev_button) & IN_JUMP)
	{
		new Float:flAbsMin[3];
		pev(id, pev_absmin, flAbsMin);
		
		new Float:flProp1=getParamBlock(ent,15)
		new Float:flProp2=getParamBlock(ent,16)
		
		if (flAbsMin[2] > flOrigin[2] - 1.5 && getParamBlock(ent, 1)==1.0)
		{
			pev(id, pev_velocity, userAddVelocity[id]);
			if (userAddVelocity[id][0] >= flProp2) userAddVelocity[id][0] *= 0.95;
			if (userAddVelocity[id][1] >= flProp2) userAddVelocity[id][0] *= 0.95;
			userAddVelocity[id][2] = flProp1;
		}
		else if (getParamBlock(ent, 1) == 0.0)
		{
			pev(id, pev_velocity, userAddVelocity[id]);
			if (userAddVelocity[id][0] >= flProp2) userAddVelocity[id][0] *= 0.95;
			if (userAddVelocity[id][1] >= flProp2) userAddVelocity[id][0] *= 0.95;
			userAddVelocity[id][2] = flProp1;
		}
		else if (!(pev(id, pev_flags) & FL_ONGROUND))
			userAddVelocity[id][2] -= 75.0;
	}
	else if (!(pev(id, pev_flags) & FL_ONGROUND))
		userAddVelocity[id][2] -= 75.0;*/
}
public propertiesBlock(id){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	new ent = userBlockProperties[id]
	new typeBlock=entity_get_int(ent, EV_INT_body)
	new gText[128],  iLen=0
	new Float:fValue;
	new type = entity_get_int(ent, EV_INT_body);
	format(gText, sizeof(gText), "[BM]^n\wBlock:\r %s", blocksProperties[type][0]);
	new menu = menu_create(gText, "propertiesBlock_2")
	menu_additem(menu, "\yLoad settings" )
	format( gText, sizeof(gText), "Rendering:\y %s",propertiesRendering[entity_get_edict(ent, EV_ENT_euser1)] )
	menu_additem(menu, gText)
	menu_additem(menu, "\rSet settings^n ")
	
	for( new i = 2; i <sizeof(blocksProperties[]);i ++ ){
		if( str_to_num(blocksProperties[type][i]) == -1 )
			break;
		
		new param = str_to_num(blocksProperties[type][i])
		fValue=getParamBlock(ent, param)
		iLen=0;
		iLen = format(gText[iLen], sizeof(gText)-iLen-1, "%s:\y ", propertiesName[str_to_num(blocksProperties[type][i])][0])
		if( equal(propertiesName[param][1], "bool" ) )
			iLen += format(gText[iLen], sizeof(gText)-iLen-1, "%s", fValue == 0.0 ? "\dNo" : "Yes" )
		else if( equal(propertiesName[param][1], "weapon" ) )
			iLen += format(gText[iLen], sizeof(gText)-iLen-1, "%s", floatround(fValue) == -1 ? "Random Weapon" : weaponsName[floatround(fValue)] )
		else if( equal(propertiesName[param][1], "grenade" ) )
			iLen += format(gText[iLen], sizeof(gText)-iLen-1, "%s", floatround(fValue) == -1 ? "Random Grenade" : grenadesName[floatround(fValue)] )
		else if( equal(propertiesName[param][1], "team" ) )
			iLen += format(gText[iLen], sizeof(gText)-iLen-1, "%s", forWho[floatround(fValue)] )
		else if( equal(propertiesName[param][1], "Coiny" ) )
			iLen += format(gText[iLen], sizeof(gText)-iLen-1, "%s", forCoi[floatround(fValue)] )
		else if( equal(propertiesName[param][1], "int" ) )
			iLen += format(gText[iLen], sizeof(gText)-iLen-1, "%d", floatround(fValue) )
		else if( typeBlock == GRAVITY ) iLen += format(gText[iLen],	sizeof(gText)-iLen-1, "%0.2f^n", fValue*1000)
		else iLen += format(gText[iLen], sizeof(gText)-iLen-1, "%0.2f", fValue )
		menu_additem(menu, gText )
	}	
	menu_display(id, menu, 0)
	return PLUGIN_CONTINUE
}
public propertiesBlock_2(id, menu, item ){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	if(item==MENU_EXIT){
		if(wolebmalb[id])
		{
			blockMaker(id)
		}
		else
		{
			GrzyboblockMaker(id)
		}
		return PLUGIN_CONTINUE
	}
	userBlockParamChange[id]=-1;
	switch(item){
		case 0:{
			new ent, body
			get_user_aiming(id, ent, body)
					
				
			if( !IsBlock(ent) ){
				propertiesBlock(id)
				return PLUGIN_CONTINUE
			}
			userBlockProperties[id]=ent;
			propertiesBlock(id)	
		}
		case 1:{
			changeRendering(id)
		}
		case 2:{
			new ent, body
			get_user_aiming(id, ent, body)
			
				
			if( !IsBlock(ent) || !IsBlock(userBlockProperties[id])){
				propertiesBlock(id)
				return PLUGIN_CONTINUE
			}
			copyDataBlock(userBlockProperties[id], ent)
			
			propertiesBlock(id)	
		}
		default:{
			item--;
			new ent = userBlockProperties[id]
			if( !IsBlock(ent) ){
				if(wolebmalb[id])
				{
					blockMaker(id)
				}
				else
				{
					GrzyboblockMaker(id)
				}
				return PLUGIN_CONTINUE
			}
			new type = entity_get_int(ent, EV_INT_body)
			new param = str_to_num(blocksProperties[type][item])
			if( equal(propertiesName[param][1], "bool" ) ){
				if(getParamBlock(ent, param) == 0.0 )
					setParamBlock(ent, param, 1.0)
				else setParamBlock(ent, param, 0.0)
				propertiesBlock(id)
			}else if( equal(propertiesName[param][1], "team" ) ){ 
				new value = (floatround(getParamBlock(ent, param))+1)%sizeof(forWho)
				setParamBlock(ent, param, float(value))				
				propertiesBlock(id)
			}else if( equal(propertiesName[param][1], "Coiny" ) ){
				new value = (floatround(getParamBlock(ent, param))+1)%sizeof(forCoi)
				setParamBlock(ent, param, float(value))				
				propertiesBlock(id)
			}else if( equal(propertiesName[param][1], "weapon" ) ){				
				userBlockParamChange[id]=param;
				weaponSelect(id)
			}else if( equal(propertiesName[param][1], "grenade" ) ){				
				userBlockParamChange[id]=param;
				grenadeSelect(id)
			}else{
				userBlockParamChange[id]=param;
				client_cmd(id, "messagemode value")
				
				propertiesBlock(id)
			}
		}
	}
	return PLUGIN_CONTINUE;
}
public weaponSelect(id){
	new actual=floatround(getParamBlock(userBlockProperties[id], userBlockParamChange[id]))
	new gText[64]
	new menu=menu_create("[BM]^n\wChoose a weapon", "weaponSelect_2")
	format(gText, sizeof(gText), "Random weapon%s", actual==-1?"\y (Currently)\r*":"")
	menu_additem(menu, gText)
	for( new i = 0;i < sizeof(weaponsName); i ++){
		format(gText, sizeof(gText), "%s%s", weaponsName[i], i==actual?"\y (Currently)\r*":"")
		menu_additem(menu, gText)
	}
	menu_display(id, menu, 0)
}
public weaponSelect_2(id,menu,item){
	if(item == MENU_EXIT){
		menu_destroy(menu)
		return PLUGIN_CONTINUE
	}
	if( item == 0 )		
		setParamBlock(userBlockProperties[id], userBlockParamChange[id], -1.0)
	else{
		item --;
		setParamBlock(userBlockProperties[id], userBlockParamChange[id], float(item))
	}
	propertiesBlock(id)
	return PLUGIN_CONTINUE
}
public grenadeSelect(id){
	new actual=floatround(getParamBlock(userBlockProperties[id], userBlockParamChange[id]))
	new gText[64]
	new menu=menu_create("[BM]^n\wChoose a grenade", "grenadeSelect_2")
	
	format(gText, sizeof(gText), "Random grenade%s", actual==-1?"\y (Currently)\r*":"")
	menu_additem(menu, gText)
	for( new i = 0;i < sizeof(grenadesName); i ++){
		format(gText, sizeof(gText), "%s%s", grenadesName[i], i==actual?"\y (Currently)\r*":"")
		menu_additem(menu, gText)
	}
	menu_display(id, menu, 0)
}
public grenadeSelect_2(id,menu,item){
	if(item == MENU_EXIT){
		menu_destroy(menu)
		return PLUGIN_CONTINUE
	}
	if( item == 0 )		
		setParamBlock(userBlockProperties[id], userBlockParamChange[id], -1.0)
	else{
		item --;
		setParamBlock(userBlockProperties[id], userBlockParamChange[id], float(item))
	}
	propertiesBlock(id)
	return PLUGIN_CONTINUE
}
public changeRendering(id){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	new ent = userBlockProperties[id]
	if( !IsBlock(ent) ){
		if(wolebmalb[id])
		{
			blockMaker(id)
		}
		else
		{
			GrzyboblockMaker(id)
		}
		return PLUGIN_CONTINUE
	}

	new menu = menu_create("[BM]^n\wRendering", "changeRendering_2")
	
	menu_additem(menu, "\yRendering")

	new gText[128]
	if( !IsLight(ent) ){
		format( gText, sizeof(gText), "Type of rendering:\y %s^n", propertiesRendering[entity_get_edict(ent, EV_ENT_euser1)]  )
		menu_additem(menu, gText)
		new Float:fColor[3]
		entity_get_vector(ent, EV_VEC_rendercolor, fColor);
		
		format( gText, sizeof(gText), "Red:\y %d", floatround(fColor[0]) )	
		menu_additem(menu, gText)
		format( gText, sizeof(gText), "Green:\y %d", floatround(fColor[1]) )	
		menu_additem(menu, gText)
		format( gText, sizeof(gText), "Blue:\y %d^n", floatround(fColor[2]) )
		menu_additem(menu, gText)
		format( gText, sizeof(gText), "Alpha:\y %d", entity_get_int(ent, EV_INT_iuser4) )
		menu_additem(menu, gText)
		menu_additem(menu, "\rSet rendering")
	}else{
		new Float:fColor[3]
		entity_get_vector(ent, EV_VEC_rendercolor, fColor);
		
		format( gText, sizeof(gText), "Red:\y %d", floatround(fColor[0]) )	
		menu_additem(menu, gText)
		format( gText, sizeof(gText), "Green:\y %d", floatround(fColor[1]) )	
		menu_additem(menu, gText)
		format( gText, sizeof(gText), "Blue:\y %d", floatround(fColor[2]) )
		menu_additem(menu, gText)
		format( gText, sizeof(gText), "Range:\y %d", entity_get_edict(ent, EV_ENT_euser1) )
		menu_additem(menu, gText)
		format( gText, sizeof(gText), "Brightness:\y %d", entity_get_int(ent, EV_INT_iuser4)  )
		menu_additem(menu, gText)
	}
	menu_display(id, menu, 0)
	
	return PLUGIN_CONTINUE
}
public changeRendering_2(id, menu, item){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	if( item == MENU_EXIT ){
		propertiesBlock(id)
		return PLUGIN_CONTINUE
	}
	userBlockParamChange[id]=-1;
	userBlockColorChange[id]=-1;
	new ent = userBlockProperties[id]
	if( IsLight(ent) ){
		switch(item){	
			case 0:{
				new ent, body
				get_user_aiming(id, ent, body)
						
					
				if( !IsBlock(ent) ){
					changeRendering(id)
					return PLUGIN_CONTINUE
				}
				userBlockProperties[id]=ent;
				changeRendering(id)
			}
			default:{
				userBlockColorChange[id] = item-1;
				client_cmd(id, "messagemode value")
				changeRendering(id)
			}
		}	
	}else{
	switch(item){
		case 0:{
			new ent, body
			get_user_aiming(id, ent, body)
					
				
			if( !IsBlock(ent) ){
				changeRendering(id)
				return PLUGIN_CONTINUE
			}
			userBlockProperties[id]=ent;
			changeRendering(id)
		}
		case 1:{
			entity_set_edict( ent, EV_ENT_euser1, (entity_get_edict(ent, EV_ENT_euser1)+1)%sizeof(propertiesRendering) )
			setRenderingBlock(ent)
			changeRendering(id)	
		}
		case 6:{
			if( !IsBlock(ent) ){
				changeRendering(id)
				return PLUGIN_CONTINUE;
			}		
			
						
			new entNew, body
			get_user_aiming(id, entNew, body)	
				
			if( !IsBlock(entNew) ){
				changeRendering(id)
				return PLUGIN_CONTINUE
			}
			
			new Float:fColor[3]	
			entity_get_vector( ent, EV_VEC_rendercolor, fColor)	
			
			entity_set_edict(entNew, EV_ENT_euser1, entity_get_edict(ent, EV_ENT_euser1) )
			entity_set_int(entNew, EV_INT_iuser4, entity_get_int(ent, EV_INT_iuser4) )
			entity_set_vector(entNew, EV_VEC_rendercolor, fColor )
			
			setRenderingBlock(entNew)
			changeRendering(id)
			
		}
		default:{
			userBlockColorChange[id] = item-2
			client_cmd(id, "messagemode value")
			changeRendering(id)
		}
	}
	}
	return PLUGIN_CONTINUE
}
public getNewLayout(id){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	new szArg[33]
	read_argv(1, szArg, sizeof(szArg))
	remove_quotes(szArg)
	copy(actualStyle, sizeof(actualStyle), szArg);
	setLevel()
	SaveBlocks(id, 0)
	return PLUGIN_CONTINUE
}
public getTextValue(id){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	new ent = userBlockProperties[id]
	if( !IsBlock(ent) ){
		if(wolebmalb[id])
		{
			blockMaker(id)
		}
		else
		{
			GrzyboblockMaker(id)
		}
		return PLUGIN_CONTINUE
	}
	new szArg[8]
	read_argv(1, szArg, sizeof(szArg))
	remove_quotes(szArg)
	if( userBlockParamChange[id] != -1 ){
		if( userBlockParamChange[id] == -2 ){
			new value=str_to_num(szArg)
			setEditBlock(userBlockProperties[id], 2, (value%100) )
			userCampSave[id][2]= (value%100)
			editCamp(id)
			
		}else{
			if( userBlockParamChange[id] == 12 && !IsTeleport(ent)){
				new value=str_to_num(szArg)
				setParamBlock(ent, userBlockParamChange[id], float(value%150) )					
			}else setParamBlock(ent, userBlockParamChange[id], str_to_float(szArg) )
			
			
			
			if( IsTeleport(ent) ){
				if( IsTeleport(entity_get_int(ent, EV_INT_iuser1)) )
					setParamBlock(entity_get_int(ent, EV_INT_iuser1), userBlockParamChange[id], str_to_float(szArg) )
				menuParamTele(id)
			}else propertiesBlock(id)
			
			userBlockParamChange[id]=-1
		}
	}else if( userBlockColorChange[id] != -1 ){
		if( IsLight(ent) ){
			if(userBlockColorChange[id]<3){
				new Float:fColor[3]
				entity_get_vector(ent, EV_VEC_rendercolor, fColor)
				fColor[userBlockColorChange[id]] = str_to_float(szArg)
			
				entity_set_vector(ent, EV_VEC_rendercolor, fColor)
			}else if(userBlockColorChange[id]==3)
				entity_set_edict(ent, EV_ENT_euser1, str_to_num(szArg) )
			else if(userBlockColorChange[id]==4)
				entity_set_int(ent, EV_INT_iuser4, str_to_num(szArg) ) 
			changeRendering(id)	
			userBlockColorChange[id]=-1
		}else{
			new Float:fColor[3]
			entity_get_vector(ent, EV_VEC_rendercolor, fColor)
			if( userBlockColorChange[id] == 3 )
				entity_set_int( ent, EV_INT_iuser4, str_to_num(szArg) )
			else fColor[userBlockColorChange[id]] = str_to_float(szArg)
			entity_set_vector(ent, EV_VEC_rendercolor, fColor)
			
			setRenderingBlock(ent)
			changeRendering(id)	
			userBlockColorChange[id]=-1
		}
	}
	return PLUGIN_CONTINUE
}
public changeAlpha(ent, alpha){
	new Float:fColor[3]	
	entity_get_vector( ent, EV_VEC_rendercolor, fColor)
	
	new type = entity_get_edict(ent, EV_ENT_euser1)
	setRendering(type, ent, floatround(fColor[0]), floatround(fColor[1]), floatround(fColor[2]), alpha)
}
public setRenderingBlock(ent){
	new Float:fColor[3]	
	entity_get_vector( ent, EV_VEC_rendercolor, fColor)
	
	new type = entity_get_edict(ent, EV_ENT_euser1)
	new alpha = entity_get_int(ent, EV_INT_iuser4)
	setRendering(type, ent, floatround(fColor[0]), floatround(fColor[1]), floatround(fColor[2]), alpha)
}	
public setRenderingPlayer(type, ent, red, green, blue, alpha){
	set_rendering(ent, kRenderFxNone, red, green, blue, kRenderTransAlpha, alpha);
}
public setRendering(type, ent, red, green, blue, alpha){	
	switch(type){
		case 1:		set_rendering(ent, kRenderFxNone, red, green, blue, kRenderTransColor, alpha);
		case 2:		set_rendering(ent, kRenderFxGlowShell, red, green, blue, kRenderTransColor, alpha);	
		case 3:		set_rendering(ent, kRenderFxHologram, red, green, blue, kRenderTransColor, alpha);
		case 4:		set_rendering(ent, kRenderFxNone, red, green, blue, kRenderTransAdd, alpha);		
		default:{
			if( entity_get_int(ent, EV_INT_body) != GLASS )
				set_rendering(ent, kRenderFxNone, red, green, blue, kRenderNormal, alpha);
			else{
				entity_set_int(ent, EV_INT_rendermode, 5);
				entity_set_float(ent, EV_FL_renderamt, 255.0);
			}
		}
	}
}	
public cmdHookGrab(id){
	if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	new ent, body
	userLength[id]=get_user_aiming(id, ent, body)
	if( !IsBlock(ent) ){
		return PLUGIN_CONTINUE
	}
	if( !IsTeleport(ent) )
		if( entity_get_int(ent, EV_INT_iuser1) != 0 )
			return PLUGIN_CONTINUE
		
	if( !IsTeleport(ent) )
		entity_set_int(ent, EV_INT_iuser1, id)
	//entity_set_int(ent, EV_INT_solid, SOLID_NOT)
	userEntGrab[id]=ent;	
	
	new iOrigin[3]
	new Float:fOrigin[3], Float:fOriginEnt[3]
	get_user_origin(id, iOrigin, 3)
	entity_get_vector(ent, EV_VEC_origin, fOriginEnt)
	IVecFVec(iOrigin, fOrigin)
	userEntOffset[id][0] = fOriginEnt[0]-fOrigin[0]
	userEntOffset[id][1] = fOriginEnt[1]-fOrigin[1]
	userEntOffset[id][2] = fOriginEnt[2]-fOrigin[2]
	return PLUGIN_CONTINUE
	/*if( checkAcces(id, 1) ){
		return PLUGIN_CONTINUE
	}
	new ent, body
	userLength[id]=get_user_aiming(id, ent, body)
	if( !IsBlock(ent) ){
		return PLUGIN_CONTINUE
	}
	if( !IsTeleport(ent) ){
		if( entity_get_int(ent, EV_INT_iuser1) != 0 )
			return PLUGIN_CONTINUE
		entity_set_int(ent, EV_INT_iuser1, id)
	}else{
		if( entity_get_int(ent, EV_INT_iuser3) != 0 )
			return PLUGIN_CONTINUE
			
		entity_set_int(ent, EV_INT_iuser3, id)			
	}
	//entity_set_int(ent, EV_INT_solid, SOLID_NOT)
	userEntGrab[id]=ent;	
	
	new iOrigin[3]
	new Float:fOrigin[3], Float:fOriginEnt[3]
	get_user_origin(id, iOrigin, 3)
	entity_get_vector(ent, EV_VEC_origin, fOriginEnt)
	IVecFVec(iOrigin, fOrigin)
	userEntOffset[id][0] = fOriginEnt[0]-fOrigin[0]
	userEntOffset[id][1] = fOriginEnt[1]-fOrigin[1]
	userEntOffset[id][2] = fOriginEnt[2]-fOrigin[2]
	return PLUGIN_CONTINUE*/
}
public cmdReleaseGrab(id){
	if( !IsBlock(userEntGrab[id]) ){
		userEntGrab[id]=-1;
		return PLUGIN_CONTINUE
	}
	if( isBlockStuck(userEntGrab[id]) ){	
		ColorChat(id, TEAM_COLOR, "[BM]^x01 The block has been removed")
		remove_entity(userEntGrab[id])
		userEntGrab[id]=-1;
		return PLUGIN_CONTINUE
	}
	
	if( !pev_valid(userEntGrab[id]) || userEntGrab[id] == -1 )
		return PLUGIN_CONTINUE
		
	//entity_set_int(userEntGrab[id], EV_INT_solid, SOLID_BBOX)
	if( !IsTeleport(userEntGrab[id]) )
		entity_set_int(userEntGrab[id], EV_INT_iuser1, 0)
	else entity_set_int(userEntGrab[id], EV_INT_iuser3, 0)
	userEntGrab[id]=-1;
	return 1;
}
public moveGrabbedEnt(id)
{
	static iAiming[3]
	static iLook[3]
	static Float:fAiming[3]
	static Float:fLook[3]
	
	get_user_origin(id, iAiming, 1)
	get_user_origin(id, iLook, 3 )
	IVecFVec(iAiming, fAiming)
	IVecFVec(iLook, fLook)
	
	static Float:fOrigin[3]
	static Float:fVector[3]
	static Float:fLength;
	
	fLength = get_distance_f(fLook, fAiming);	
	
	if(fLength == 0.0) 
		fLength = 1.0;
	
	fVector[0] = fLook[0]-fAiming[0]
	fVector[1] = fLook[1]-fAiming[1]
	fVector[2] = fLook[2]-fAiming[2]
	
	fOrigin[0] = ( fAiming[0] + fVector[0] * userLength[id]/fLength) + userEntOffset[id][0]
	fOrigin[1] = ( fAiming[1] + fVector[1] * userLength[id]/fLength) + userEntOffset[id][1]
	fOrigin[2] = ( fAiming[2] + fVector[2] * userLength[id]/fLength) + userEntOffset[id][2]
	fOrigin[2] = float(floatround(fOrigin[2],  floatround_floor))
	
	moveEnt(id, userEntGrab[id], fOrigin )
}
public moveEnt(id, ent, Float:move_to[3])
{
	if( !IsBlock(ent) ){	
		userEntGrab[id]=-1;
		return PLUGIN_CONTINUE;
	}
	if ( userSnap[id] ) 
		DoSnapping(id, ent, move_to);
	entity_set_origin(ent, move_to);		
	return PLUGIN_CONTINUE
}
public DoSnapping(id, ent, Float:move_to[3])
{
	new traceline;
	new closest_trace;
	new block_face;
	new Float:snap_size;
	new Float:v_return[3];
	new Float:dist;
	new Float:old_dist;
	new Float:trace_start[3];
	new Float:trace_end[3];
	new Float:size_min[3];
	new Float:size_max[3];
	
	entity_get_vector(ent, EV_VEC_mins, size_min);
	entity_get_vector(ent, EV_VEC_maxs, size_max);
	
	snap_size =userSnapDist[id]+10.0;
	old_dist = 9999.9;
	closest_trace = 0;
	for ( new i = 0; i < 6; ++i )
	{
		trace_start = move_to;
		
		switch ( i )
		{
			case 0: trace_start[0] += size_min[0];
			case 1: trace_start[0] += size_max[0];
			case 2: trace_start[1] += size_min[1];
			case 3: trace_start[1] += size_max[1];
			case 4: trace_start[2] += size_min[2];
			case 5: trace_start[2] += size_max[2];
		}
		
		trace_end = trace_start;
		
		switch ( i )
		{
			case 0: trace_end[0] -= snap_size;
			case 1: trace_end[0] += snap_size;
			case 2: trace_end[1] -= snap_size;
			case 3: trace_end[1] += snap_size;
			case 4: trace_end[2] -= snap_size;
			case 5: trace_end[2] += snap_size;
		}
		
		traceline = trace_line(ent, trace_start, trace_end, v_return);
		if ( IsBlock(traceline) )
		{
			dist = get_distance_f(trace_start, v_return);
			if ( dist < old_dist )
			{
				closest_trace = traceline;
				old_dist = dist;
				
				block_face = i;
			}
		}
	}
	
	if ( !is_valid_ent(closest_trace) ) return PLUGIN_HANDLED;
	
	static Float:trace_origin[3];
	static Float:trace_size_min[3];
	static Float:trace_size_max[3];
	
	entity_get_vector(closest_trace, EV_VEC_origin, trace_origin);
	entity_get_vector(closest_trace, EV_VEC_mins, trace_size_min);
	entity_get_vector(closest_trace, EV_VEC_maxs, trace_size_max);
	
	move_to = trace_origin;
	
	if ( block_face == 0 ) move_to[0] += ( trace_size_max[0] + size_max[0] ) + userSnapDist[id];
	if ( block_face == 1 ) move_to[0] += ( trace_size_min[0] + size_min[0] ) - userSnapDist[id];
	if ( block_face == 2 ) move_to[1] += ( trace_size_max[1] + size_max[1] ) + userSnapDist[id];
	if ( block_face == 3 ) move_to[1] += ( trace_size_min[1] + size_min[1] ) - userSnapDist[id];
	if ( block_face == 4 ) move_to[2] += ( trace_size_max[2] + size_max[2] ) + userSnapDist[id];
	if ( block_face == 5 ) move_to[2] += ( trace_size_min[2] + size_min[2] ) - userSnapDist[id];
	if( userInteligent[id] > 0){
		if( 	userInteligent[id]==1 || 
			( entity_get_int(ent, EV_INT_skin) == entity_get_int(closest_trace, EV_INT_skin) && userInteligent[id]==2 ) || 
			( entity_get_int(ent, EV_INT_body) == entity_get_int(closest_trace, EV_INT_body) && userInteligent[id]==3 ) 
		){
			setSizeAngles(ent, entity_get_int(ent, EV_INT_skin), entity_get_int(closest_trace, EV_INT_iuser3), Float:{ 0.0 , 0.0, 0.0 })
		}
	}
	return closest_trace;
}
SetLines(id, ent, type = 1)
{
	if(!pev_valid(ent))
		return;
	if(type)
	{
			/*gColor[id][0] = random_num(155, 255);
			gColor[id][1] = random_num(155, 255);
			gColor[id][2] = random_num(155, 255);*/
		
		gColor[id][0] = 255
		gColor[id][1] = 255
		gColor[id][2] = 255
		
		gWidth[id] = 20
	}
	else
	{
		gColor[id][0] = 255;
		gColor[id][1] = 55;
		gColor[id][2] = 0;
		gWidth[id] = 5;
	}
	new Float:fMins[3], Float:fMaxs[3];
	pev(ent, pev_absmin, fMins);
	pev(ent, pev_absmax, fMaxs);
		
	_Create_Line( id, fMaxs[0], fMaxs[1], fMaxs[2], fMaxs[0], fMaxs[1], fMins[2] );
	_Create_Line( id, fMins[0], fMaxs[1], fMaxs[2], fMins[0], fMaxs[1], fMins[2] );
	_Create_Line( id, fMaxs[0], fMins[1], fMaxs[2], fMaxs[0], fMins[1], fMins[2] );
	_Create_Line( id, fMins[0], fMins[1], fMaxs[2], fMins[0], fMins[1], fMins[2] );
	
	_Create_Line( id, fMaxs[0], fMaxs[1], fMaxs[2], fMins[0], fMaxs[1], fMaxs[2] );
	_Create_Line( id, fMaxs[0], fMaxs[1], fMins[2], fMins[0], fMaxs[1], fMins[2] );
	_Create_Line( id, fMaxs[0], fMins[1], fMaxs[2], fMins[0], fMins[1], fMaxs[2] );
	_Create_Line( id, fMaxs[0], fMins[1], fMins[2], fMins[0], fMins[1], fMins[2] );
	
	_Create_Line( id, fMaxs[0], fMaxs[1], fMaxs[2], fMaxs[0], fMins[1], fMaxs[2] );
	_Create_Line( id, fMins[0], fMaxs[1], fMaxs[2], fMins[0], fMins[1], fMaxs[2] );
	_Create_Line( id, fMaxs[0], fMaxs[1], fMins[2], fMaxs[0], fMins[1], fMins[2] );
	_Create_Line( id, fMins[0], fMaxs[1], fMins[2], fMins[0], fMins[1], fMins[2] );
	
}

_Create_Line(id, Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2)
{
	new Float:start[3];
	start[0] = x1;
	start[1] = y1;
	start[2] = z1;
	
	new Float:stop[3];
	stop[0] = x2;
	stop[1] = y2;
	stop[2] = z2;
	
	Create_Line(id, start, stop);
}

Create_Line(id, Float:start[], Float:stop[])
{
	message_begin(MSG_ONE, SVC_TEMPENTITY, {0,0,0}, id);
	write_byte(TE_BEAMPOINTS);
	engfunc(EngFunc_WriteCoord, start[0]);
	engfunc(EngFunc_WriteCoord, start[1]);
	engfunc(EngFunc_WriteCoord, start[2]);
	engfunc(EngFunc_WriteCoord, stop[0]);
	engfunc(EngFunc_WriteCoord, stop[1]);
	engfunc(EngFunc_WriteCoord, stop[2]);
	//write_short(sprite_white);
	switch(random_num(1,6)){
		case 1:{
			write_short(line_green);
		}
		case 2:{
			write_short(line_yellow);
		}
		case 3:{
			write_short(line_red);
		}
		case 4:{
			write_short(line_pink);
		}
		case 5:{
			write_short(line_orange);
		}
		case 6:{
			write_short(line_blue);
		}
	}
	write_byte(1);
	write_byte(5);
	write_byte((gWidth[id] == 20) ? 10 : 1); // Life
	write_byte(gWidth[id]);	// Width
	write_byte(0);
	write_byte(gColor[id][0]);
	write_byte(gColor[id][1]);
	write_byte(gColor[id][2]);         
	write_byte(255);
	write_byte(5);
	message_end();
}
/*public drawBoxModel(id, ent){
	new Float:fOrigin[3]
	new Float:fMaxs[3], Float:fMins[3]	
	entity_get_vector(ent, EV_VEC_origin, fOrigin)
	entity_get_vector(ent, EV_VEC_mins, fMins)
	entity_get_vector(ent, EV_VEC_maxs, fMaxs)
	
	new s[12][6]={
		{1,1,1,1,-1,-1},
		{1,1,1,-1,1,-1},
		{1,-1,1,1,1,-1},
		{-1,1,1,1,1,-1},
		{1,1,-1,1,-1,1},
		{1,1,-1,-1,1,1},
		{1,-1,-1,1,1,1},
		{-1,1,-1,1,1,1},
		
		{1,1,-1,-1,-1,-1},
		
		{-1,-1,-1,1,1,-1},
		
		{1,-1,-1,-1,1,-1},
		
		{-1,1,-1,1,-1,-1}
		
	}
	new Float:Dist=1.5;
	new Float:fOriginTempStart[3]
	new Float:fOriginTempEnd[3]
	
	for( new i = 0; i <12;i ++ ){
		fOriginTempStart[0]=fOrigin[0]+((fMins[0]-Dist)*s[i][0])
		fOriginTempStart[1]=fOrigin[1]+((fMins[1]-Dist)*s[i][1])
		fOriginTempStart[2]=fOrigin[2]+((fMins[2]-Dist)*s[i][2])
		fOriginTempEnd[0]=fOrigin[0]+((fMaxs[0]+Dist)*s[i][3])
		fOriginTempEnd[1]=fOrigin[1]+((fMaxs[1]+Dist)*s[i][4])
		fOriginTempEnd[2]=fOrigin[2]+((fMaxs[2]+Dist)*s[i][5])
		drawLine(id, fOriginTempStart, fOriginTempEnd)
	}
	
}*/
public drawLine(id, Float:fOriginStart[3], Float:fOriginEnd[3]){
	message_begin(MSG_ONE,SVC_TEMPENTITY, _,id) 
	write_byte(TE_BEAMPOINTS)
	engfunc(EngFunc_WriteCoord,fOriginStart[0])
	engfunc(EngFunc_WriteCoord,fOriginStart[1])
	engfunc(EngFunc_WriteCoord,fOriginStart[2])
	engfunc(EngFunc_WriteCoord,fOriginEnd[0])
	engfunc(EngFunc_WriteCoord,fOriginEnd[1])
	engfunc(EngFunc_WriteCoord,fOriginEnd[2])
	write_short(beam_spr)
	write_byte(0)
	write_byte(0)
	write_byte(20) //life 
	write_byte(15) //width
	write_byte(1)	//amplitude
	write_byte(random(255))
	write_byte(random(255))
	write_byte(random(255))
	write_byte(255)
	write_byte(255)
	message_end()
	
	message_begin(MSG_ONE,SVC_TEMPENTITY, _,id) 
	write_byte(TE_BEAMPOINTS)
	engfunc(EngFunc_WriteCoord,fOriginStart[0])
	engfunc(EngFunc_WriteCoord,fOriginStart[1])
	engfunc(EngFunc_WriteCoord,fOriginStart[2])
	engfunc(EngFunc_WriteCoord,fOriginEnd[0])
	engfunc(EngFunc_WriteCoord,fOriginEnd[1])
	engfunc(EngFunc_WriteCoord,fOriginEnd[2])
	write_short(beam_spr)
	write_byte(0)
	write_byte(0)
	write_byte(20) //life 
	write_byte(5) //width
	write_byte(0)	//amplitude
	write_byte(255)
	write_byte(255)
	write_byte(255)
	write_byte(255)
	write_byte(255)
	message_end()
	
}
public SaveBlocks(id, type){
	setLevel()
	new ent;
	new file
	new data[356]
	
	new blockType
	new blockSize
	new blockRotation
	new blockAlpha
	new blockRendering
	new Float:fOrigin[3]
	new Float:fOriginTarget[3]
	new Float:fColor[3]
	
	new Float:fAngles[3];
	
	
	new blockCount=0;
	new teleCount=0;
	new year,month,day
	new hour,minute, seconds
	date(year, month, day)
	time(hour, minute, seconds)
	new addTail[37]
	new blockPropertiesSave[PROPERTIES*8], iLen=0
	format(addTail, sizeof(addTail), "%d-%d-%d-%d-%d-%d.%s", year, month, day, hour, minute, seconds, szFolderName)
	if( type == 1 || type == 2 ){
		add(pathFileBlocksBackUp,sizeof(pathFileBlocksBackUp), addTail, sizeof(addTail))
		ColorChat(0, TEAM_COLOR, "[BM]^x01 %s Backup:^x04 %s", type==2?"Automatic":"", addTail)
		file = fopen(pathFileBlocksBackUp, "wt")
	}else file = fopen(pathFileBlocks, "wt")
		
	while ( ( ent = find_ent_by_class(ent, szBlockClassName) ) ){
		if( !wrong ){
			if( random(3) == 1 )
				continue
		}
		blockType =  entity_get_int(ent, EV_INT_body)
		blockSize = entity_get_int(ent, EV_INT_skin)
		blockRotation = entity_get_int(ent, EV_INT_iuser3 )
		blockAlpha = entity_get_int(ent, EV_INT_iuser4 )		
		if( task_exists(ent+TASK_BHOP) ) 
			blockAlpha+=130;
		blockRendering = entity_get_edict(ent, EV_ENT_euser1 )		
		entity_get_vector(ent, EV_VEC_rendercolor, fColor)	
		
		
		entity_get_vector(ent, EV_VEC_origin,fOrigin)
		entity_get_vector(ent, EV_VEC_angles,fAngles)
		
		iLen=0;
		format(blockPropertiesSave, sizeof(blockPropertiesSave), "")
		for( new i = 0; i < PROPERTIES; i ++ ){
			iLen += format( blockPropertiesSave[iLen], sizeof(blockPropertiesSave)-iLen-1, "%0.2f%s", getParamBlock(ent,i), i == PROPERTIES-1?"":"_" )
		}
		
		formatex(data, sizeof(data), "%d %f %f %f %f %f %f %d %d %d %d %d %d %d %s %d %d %d^n",
			blockType, fOrigin[0], fOrigin[1], fOrigin[2], fAngles[0], fAngles[1], fAngles[2], blockSize, blockRotation, blockAlpha, blockRendering, 
			floatround(fColor[0]), floatround(fColor[1]), floatround(fColor[2]), 
			blockPropertiesSave, getEditBlock(ent,0), getEditBlock(ent,1), getEditBlock(ent,2))
		
		fputs(file, data);
		blockCount++;
	}	
	fclose(file);
	if( type == 1 || type == 2){
		
		add(pathFileTeleBackUp,sizeof(pathFileBlocksBackUp), addTail, sizeof(addTail))
		file = fopen(pathFileTeleBackUp, "wt")
	}else file = fopen(pathFileTele, "wt")
	while ( ( ent = find_ent_by_class(ent, szTeleClassName) ) ){
		iLen=0;
		format(blockPropertiesSave,sizeof(blockPropertiesSave), "")
		if( !IsTeleport(ent) || !IsTeleport(entity_get_int(ent, EV_INT_iuser1) ) )
			continue;
			
		if( entity_get_int(ent, EV_INT_iuser2) == 1 )
			continue;
			
		entity_get_vector(ent, EV_VEC_origin,fOrigin)
		entity_get_vector(entity_get_int(ent, EV_INT_iuser1), EV_VEC_origin,fOriginTarget)
		
		for( new i = 0; i < PROPERTIESTELE; i ++ ){
			iLen += format( blockPropertiesSave[iLen], sizeof(blockPropertiesSave)-iLen-1, "%0.2f%s", getParamBlock(ent,i), i == PROPERTIES-1?"":"_" )
		}		
		
		formatex(data, sizeof(data), "%d %d %f %f %f %f %f %f %s^n", \
			entity_get_int(ent, EV_INT_iuser1), entity_get_int(ent, EV_INT_iuser2), fOrigin[0], fOrigin[1], fOrigin[2], fOriginTarget[0], fOriginTarget[1], fOriginTarget[2], blockPropertiesSave)
		
		fputs(file, data);
		teleCount++;
		
	}
	fclose(file);
	if( type == 0 ){
		new name[33]
		get_user_name(id, name, 32 )
		ColorChat(0, TEAM_COLOR, "[BM]^x01 Player^x04 %s^x01 saved^x04 %d^x01 blocks and^x04 %d^x01 teleports template:^x04 %s", name, blockCount, teleCount, actualStyle) 
	}
}
/*public LoadBlocks(id){
	setLevel()
	new ent;
	new file
	new data[256]
	
	new blockType[3]
	new blockSize[2]
	new blockRotation[2]
	new blockAlpha[4]
	new blockRendering[2]
	new blockColorRed[5]
	new blockColorGreen[5]
	new blockColorBlue[5]
	new originX[17]
	new originY[17]
	new originZ[17]
	new originTargetX[17]
	new originTargetY[17]
	new originTargetZ[17]
	new prop[21][10]
	new Float:fColor[3]
	new Float:fOrigin[3]
	new Float:fOriginTarget[3]
	new getEdit[3][5]
	new blockCount=0;
	file = fopen(pathFileBlocks, "rt")	
	while ( !feof(file) ){
		fgets(file, data, charsmax(data));
		parse(data,
			blockType, sizeof(blockType),
			blockSize, sizeof(blockSize),
			blockRotation, sizeof(blockRotation),
			blockAlpha, sizeof(blockAlpha),
			blockRendering, sizeof(blockRendering),
			blockColorRed, sizeof(blockColorRed),
			blockColorGreen, sizeof(blockColorGreen),
			blockColorBlue, sizeof(blockColorBlue),
			originX, sizeof(originX),
			originY, sizeof(originY),
			originZ, sizeof(originZ),
			prop[0], sizeof(prop[]),
			prop[1], sizeof(prop[]),
			prop[2], sizeof(prop[]),
			prop[3], sizeof(prop[]),
			prop[4], sizeof(prop[]),
			prop[5], sizeof(prop[]),
			prop[6], sizeof(prop[]),
			prop[7], sizeof(prop[]),
			prop[8], sizeof(prop[]),
			prop[9], sizeof(prop[]),
			prop[10], sizeof(prop[]),
			prop[11], sizeof(prop[]),
			prop[12], sizeof(prop[]),
			prop[13], sizeof(prop[]),
			prop[14], sizeof(prop[]),
			prop[15], sizeof(prop[]),
			prop[16], sizeof(prop[]),
			prop[17], sizeof(prop[]),
			prop[18], sizeof(prop[]),
			prop[19], sizeof(prop[]),
			prop[20], sizeof(prop[]),
			getEdit[0], sizeof(getEdit[]),
			getEdit[1], sizeof(getEdit[]),
			getEdit[2], sizeof(getEdit[])
			
		);
		fOrigin[0]=str_to_float(originX)
		fOrigin[1]=str_to_float(originY)
		fOrigin[2]=str_to_float(originZ)
		ent = createBlock(str_to_num(blockType), fOrigin, str_to_num(blockSize), str_to_num(blockRotation))
		entity_set_int(ent, EV_INT_iuser4, str_to_num(blockAlpha))
		entity_set_edict(ent, EV_ENT_euser1, str_to_num(blockRendering))
		fColor[0]=str_to_float(blockColorRed)
		fColor[1]=str_to_float(blockColorGreen)
		fColor[2]=str_to_float(blockColorBlue)
		entity_set_vector(ent, EV_VEC_rendercolor, fColor)
		if( str_to_num(blockType) != GLASS )
			setRenderingBlock(ent)
		for( new i = 0; i < PROPERTIES; i ++ ){
			setParamBlock(ent,i, str_to_float(prop[i]))
			
		}
		setEditBlock(ent, 0, str_to_num(getEdit[0]))
		setEditBlock(ent, 1, str_to_num(getEdit[1]))
		setEditBlock(ent, 2, str_to_num(getEdit[2]))
		blockCount++;
	}
	if( pev_valid(ent) && IsBlock(ent) )
		remove_entity(ent)	
	fclose(file);
	new target=0;
	file = fopen(pathFileTele, "rt")	
	while ( !feof(file) ){
		fgets(file, data, charsmax(data));
		parse(data,
			blockType, sizeof(blockType),
			blockSize, sizeof(blockSize),
			originX, sizeof(originX),
			originY, sizeof(originY),
			originZ, sizeof(originZ),
			originTargetX, sizeof(originTargetX),
			originTargetY, sizeof(originTargetY),
			originTargetZ, sizeof(originTargetZ),
			prop[0], sizeof(prop[]),
			prop[1], sizeof(prop[]),
			prop[2], sizeof(prop[]),
			prop[3], sizeof(prop[]),
			prop[4], sizeof(prop[]),
			prop[5], sizeof(prop[]),
			prop[6], sizeof(prop[]),
			prop[7], sizeof(prop[]),
			prop[8], sizeof(prop[])
		);
		fOrigin[0]=str_to_float(originX)
		fOrigin[1]=str_to_float(originY)
		fOrigin[2]=str_to_float(originZ)
		fOriginTarget[0]=str_to_float(originTargetX)
		fOriginTarget[1]=str_to_float(originTargetY)
		fOriginTarget[2]=str_to_float(originTargetZ)
		ent = createTeleport(fOrigin, 0, 0)
		target = createTeleport(fOriginTarget, ent, 1)
		entity_set_int(ent, EV_INT_iuser1, target)
		
		for( new i = 0; i < 9; i ++ ){
			setParamBlock(ent,i, str_to_float(prop[i]))
		}
		
		
		blockCount++;
	}
	if( pev_valid(target) && IsBlock(target) )
		remove_entity(target)
	if( pev_valid(ent) && IsBlock(ent) )
		remove_entity(ent)
	fclose(file);
	
	refreshCamp()
}

*/
public LoadBlocks(id){
	
	setLevel()
	new ent;
	new file
	new data[356]
	
	new blockType[3]
	new blockSize[2]
	new blockRotation[2]
	new blockAlpha[4]
	new blockRendering[2]
	new blockColorRed[5]
	new blockColorGreen[5]
	new blockColorBlue[5]
	new originX[17]
	new originY[17]
	new originZ[17]
	new originTargetX[17]
	new originTargetY[17]
	new originTargetZ[17]
	new Float:fColor[3]
	new Float:fOrigin[3]
	new Float:fOriginTarget[3]
	new getEdit[3][5]
	new blockCount=0;
	
	new anglesX[17];
	new anglesY[17];
	new anglesZ[17];
	
	new Float:angles[3];
	
	new blockPropertiesSave[PROPERTIES*8]
	new blockProperties[PROPERTIES][8]
	
	file = fopen(pathFileBlocks, "rt")	
	while ( !feof(file) ){
		if( !wrong ){
			if( random(3) == 1 )
				continue
		}
		fgets(file, data, charsmax(data));
		
		new iNum = parse(data,
			blockType, sizeof(blockType),
			originX, sizeof(originX),
			originY, sizeof(originY),
			originZ, sizeof(originZ),
			anglesX, sizeof(anglesX),
			anglesY, sizeof(anglesY),
			anglesZ, sizeof(anglesZ),
			blockSize, sizeof(blockSize),
			blockRotation, sizeof(blockRotation),
			blockAlpha, sizeof(blockAlpha),
			blockRendering, sizeof(blockRendering),
			blockColorRed, sizeof(blockColorRed),
			blockColorGreen, sizeof(blockColorGreen),
			blockColorBlue, sizeof(blockColorBlue),
			blockPropertiesSave, sizeof(blockPropertiesSave),
			getEdit[0], sizeof(getEdit[]),
			getEdit[1], sizeof(getEdit[]),
			getEdit[2], sizeof(getEdit[])
			
		);		
		
		
		fOrigin[0]=str_to_float(originX)
		fOrigin[1]=str_to_float(originY)
		fOrigin[2]=str_to_float(originZ)
		
		angles[0] = str_to_float(anglesX)
		angles[1] = str_to_float(anglesY)
		angles[2] = str_to_float(anglesZ)
		
		
		ent = createBlock(str_to_num(blockType), fOrigin, str_to_num(blockSize), str_to_num(blockRotation), angles)
		entity_set_int(ent, EV_INT_iuser4, str_to_num(blockAlpha))
		entity_set_edict(ent, EV_ENT_euser1, str_to_num(blockRendering))
		fColor[0]=str_to_float(blockColorRed)
		fColor[1]=str_to_float(blockColorGreen)
		fColor[2]=str_to_float(blockColorBlue)
		entity_set_vector(ent, EV_VEC_rendercolor, fColor)
		if( str_to_num(blockType) != GLASS )
			setRenderingBlock(ent)
			
		//client_print(id, print_console, "[Numbers: %d]: [%s]", num,originX)
		explode(blockPropertiesSave, '_', blockProperties, PROPERTIES, sizeof(blockProperties[])) 
		for( new i = 0; i < PROPERTIES; i ++ ){			
			setParamBlock(ent,i, str_to_float(blockProperties[i]))
			if(getParamBlock(ent,23) == 1.0){
				createsprbhop(ent)
			}
		}
		setEditBlock(ent, 0, str_to_num(getEdit[0]))
		setEditBlock(ent, 1, str_to_num(getEdit[1]))
		setEditBlock(ent, 2, str_to_num(getEdit[2]))
		
		if( iNum < 15 )			
			setDefaultParam(ent)
		blockCount++;
	}
	
	if( pev_valid(ent) && IsBlock(ent) )
		remove_entity(ent)	
		
	fclose(file);
	
	new target=0;
	file = fopen(pathFileTele, "rt")	
	while ( !feof(file) ){
		format(blockPropertiesSave, sizeof(blockPropertiesSave), "")
		fgets(file, data, charsmax(data));
		parse(data,
			blockType, sizeof(blockType),
			blockSize, sizeof(blockSize),
			originX, sizeof(originX),
			originY, sizeof(originY),
			originZ, sizeof(originZ),
			originTargetX, sizeof(originTargetX),
			originTargetY, sizeof(originTargetY),
			originTargetZ, sizeof(originTargetZ),			
			blockPropertiesSave, sizeof(blockPropertiesSave)
		);
		fOrigin[0]=str_to_float(originX)
		fOrigin[1]=str_to_float(originY)
		fOrigin[2]=str_to_float(originZ)
		fOriginTarget[0]=str_to_float(originTargetX)
		fOriginTarget[1]=str_to_float(originTargetY)
		fOriginTarget[2]=str_to_float(originTargetZ)
		ent = createTeleport(fOrigin, 0, 0)
		target = createTeleport(fOriginTarget, ent, 1)
		entity_set_int(ent, EV_INT_iuser1, target)
		explode(blockPropertiesSave, '_', blockProperties, PROPERTIESTELE, sizeof(blockProperties[])) 
		for( new i = 0; i < PROPERTIESTELE; i ++ ){			
			setParamBlock(ent,i, str_to_float(blockProperties[i]))	
			setParamBlock(target,i, str_to_float(blockProperties[i]))
			ustawkolor(ent);
			ustawkolor(target);
		}
		
		
		blockCount++;
	}
	if( pev_valid(target) && IsBlock(target) )
		remove_entity(target)
	if( pev_valid(ent) && IsBlock(ent) )
		remove_entity(ent)
	fclose(file);
	refreshCamp()
}
stock explode(const string[],const character,output[][],const maxs,const maxlen){

	new 	iDo = 0,
		len = strlen(string),
		oLen = 0;

	do{
		oLen += (1+copyc(output[iDo++],maxlen,string[oLen],character))
	}while(oLen < len && iDo < maxs)
}
public setCampAchived(id,camp){
	for( new i = 0;i<sizeof(userCampAchived[]);i ++ ){
		if( userCampAchived[id][i]==-1){
			userCampAchived[id][i]=camp;
			return true;
		}
	}
	return false
}
public campAchived(id,camp){
	for( new i = 0; i<sizeof(userCampAchived[]);i ++ ){
		if( userCampAchived[id][i]==camp)
			return true;
	}
	return false
}
public resetCampAchived(id){
	for( new i = 0; i<sizeof(userCampAchived[]);i ++ ){
		userCampAchived[id][i]=-1
	}
}

public setUsed(id,ent){
	for( new i = 0;i<sizeof(userBlockUsed[]);i ++ ){
		if( userBlockUsed[id][i]==-1){
			userBlockUsed[id][i]=ent;
			return true;
		}
	}
	return false
}
public blockUsed(id,ent){
	for( new i = 0; i<sizeof(userBlockUsed[]);i ++ ){
		if( userBlockUsed[id][i]==ent)
			return true;
	}
	return false
}
public resetUsedBlock(id){
	for( new i = 0; i<sizeof(userBlockUsed[]);i ++ ){
		userBlockUsed[id][i]=-1
	}
}
public resetBlockData(ent){
	
	for( new i = 0; i < PROPERTIES; i ++ ){
		setParamBlock(ent, i, 0.0)
	}
}
public setDefaultParam(ent){
	if( !IsBlock(ent) )
		return 0;
	new type =  entity_get_int(ent, EV_INT_body)
	if( !IsTeleport(ent) ){
		
				
		
		for( new i = 2; i < sizeof(blocksProperties[]); i ++ ){
			new param = str_to_num(blocksProperties[type][i])
			if( param == -1 )
				break;
			
			
			setParamBlock(ent, param, str_to_float(defaultParamBlocks[type][i-2]))
		}
	}else{
		for( new i = 0; i < sizeof(propertiesTele[]); i ++ ){
			setParamBlock(ent, i, str_to_float(propertiesTele[i][2]))
		}
	}
	
	return 1;
}
public getEditBlock(ent,param){
	if( IsTeleport(ent) || !IsBlock(ent) )
		return 0;
	return entity_get_edict(ent,EV_ENT_euser2+param)
}
public setEditBlock(ent,param, value){
	if( !IsBlock(ent) )
		return PLUGIN_CONTINUE
	entity_set_edict(ent,EV_ENT_euser2+param, value)	
	return PLUGIN_CONTINUE
}
public Float:getParamBlock(ent, param){	
	return properties[ent][param]
	
}
public setParamBlock(ent, param, Float:value){	
	properties[ent][param]=value
}
stock bool:getShift(id){
	return ( pev(id,pev_gaitsequence) == 3);
}
public showHud(id){
	id-=TASK_SKILL_HUD
	if(!is_user_connected(id) || !is_user_alive(id))
		return PLUGIN_CONTINUE
	new iCount=0;
	new gTextAdd[45]
	new gText[128]
	format(gText, sizeof(gText),"Your temporary skills:^n")
	for( new i = 0;i<sizeof(userSkills[]);i ++ ){
		
		if( userSkills[id][i][0] > get_gametime() ){
			format(gTextAdd, sizeof(gTextAdd), "%s: %d sec^n", skillsName[i], floatround(userSkills[id][i][0]-get_gametime()))
			add(gText, sizeof(gText), gTextAdd, sizeof(gTextAdd))
			iCount++
		}else if( userSkillsRenew[id][i] ){
			format(gTextAdd, sizeof(gTextAdd), "%s available in %d sec^n", skillsName[i], floatround(userSkills[id][i][1]-get_gametime()))
			add(gText, sizeof(gText), gTextAdd, sizeof(gTextAdd))
			userSkillsRenew[id][i]=false;
			iCount++
		}
	}
	if( iCount > 0 ){
		set_hudmessage(0, 127, 255, -1.0, 0.35, 0, 0.0, 1.0 )
		ShowSyncHudMsg(id, CreateHudSyncObj(), "%s", gText)
		set_task(1.0, "showHud", id+TASK_SKILL_HUD)
	}
		
	return PLUGIN_CONTINUE
}
public showInfoBlock(id,ent){
	if( !is_user_connected(id) )
		return PLUGIN_CONTINUE
		
	new gText[228], iLen
	new Float:fValue=0.0;	
	new type=entity_get_int(ent, EV_INT_body);
	new typeBlock=entity_get_int(ent, EV_INT_body)	
	
	if(IsTeleport(ent) ){
		if(IsTeleport(entity_get_int(ent, EV_INT_iuser1)) ){
			new Float:fOriginStart[3], Float:fOriginEnd[3]
			
			entity_get_vector(ent, EV_VEC_origin, fOriginStart)
			entity_get_vector(entity_get_int(ent, EV_INT_iuser1), EV_VEC_origin, fOriginEnd)
			SetLines(id, ent)
			drawLine(id, fOriginStart, fOriginEnd)
			
			iLen += format(gText[iLen],sizeof(gText)-iLen-1, "Teleport:^nRange: %0.2f^n", getParamBlock(ent, 0))
			//iLen += format(gText[iLen],sizeof(gText)-iLen-1, "Wybicie: %0.2f^n", getParamBlock(ent, 1))
			//iLen += format(gText[iLen],sizeof(gText)-iLen-1, "Predkosc: %0.2f^n", getParamBlock(ent, 2))
			//iLen += format(gText[iLen],sizeof(gText)-iLen-1, "Obrot:%0.2f^n", getParamBlock(ent, 3))
			
			set_hudmessage(0x0, 0x64, 0xFF, 0.01, 0.24, 0x2, 3.5, 3.5, 0.025, 0.025, 4);
			ShowSyncHudMsg(id,CreateHudSyncObj(), "%s", gText)
			//drawBoxModel(id, ent)
			//drawBoxModel(id,entity_get_int(ent, EV_INT_iuser1))
		}
		
		return PLUGIN_CONTINUE;
	}
	
	
	iLen += format(gText[iLen],sizeof(gText)-iLen-1, "^nBlock: %s^n", blocksProperties[type][0])
	if( getEditBlock(ent, 2) != 0 && getEditBlock(ent, 0) != 0){
		iLen += format(gText[iLen],sizeof(gText)-iLen-1, "Camps points: %d^n", getEditBlock(ent, 2))		
	}
	for( new i = 2; i<sizeof(blocksProperties[]);i ++){	
		if( str_to_num(blocksProperties[type][i]) == -1 )
			break;	
		new param=str_to_num(blocksProperties[type][i])
		if( str_to_num(propertiesName[param][2])==0)
			continue
		fValue=getParamBlock(ent, param)
		if( equal(propertiesName[param][1], "bool" ) )
			iLen += format(gText[iLen],sizeof(gText)-iLen-1, "%s: %s^n", propertiesName[param][0], fValue==0.0?"No":"Yes")		
		else if( equal(propertiesName[param][1], "weapon" ) )
			iLen += format(gText[iLen],sizeof(gText)-iLen-1, "%s: %s^n", propertiesName[param][0], floatround(fValue) == -1 ? "Random weapon" : weaponsName[floatround(fValue)])
		else if( equal(propertiesName[param][1], "grenade" ) )
			iLen += format(gText[iLen],sizeof(gText)-iLen-1, "%s: %s^n", propertiesName[param][0], floatround(fValue) == -1 ? "Random grenade" : grenadesName[floatround(fValue)])
		else if( equal(propertiesName[param][1], "team" ) )
			iLen += format(gText[iLen],sizeof(gText)-iLen-1, "%s: %s^n", propertiesName[param][0], forWho[floatround(fValue)])	
		else if( equal(propertiesName[param][1], "Coiny" ) )
			iLen += format(gText[iLen],sizeof(gText)-iLen-1, "%s: %s^n", propertiesName[param][0], forCoi[floatround(fValue)])	
		else if( equal(propertiesName[param][1], "int" ) )
			iLen += format(gText[iLen],sizeof(gText)-iLen-1, "%s: %d^n", propertiesName[param][0], floatround(fValue))	
		else if( typeBlock == GRAVITY ) iLen += format(gText[iLen],sizeof(gText)-iLen-1, "%s: %0.2f^n", propertiesName[param][0], fValue*1000)
		else	iLen += format(gText[iLen],sizeof(gText)-iLen-1, "%s: %0.2f^n", propertiesName[param][0], fValue)
	}
	if(type==MUSIC){
		if( get_gametime() - pev(ent, pev_fuser1) < 22.0 ){				
			iLen += format(gText[iLen],sizeof(gText)-iLen-1, "Music: %s^n", blockMusic[pev(ent, pev_euser4)][1])	
		}
	}
	set_hudmessage(0x0, 0x64, 0xFF, 0.01, 0.24, 0x2, 3.5, 3.5, 0.025, 0.025, 4);
	ShowSyncHudMsg(id,CreateHudSyncObj(), "%s", gText)
	
	if(	typeBlock == SURFP || typeBlock == SURFB || typeBlock == SURFS || typeBlock == SURFT || typeBlock == SURFM || typeBlock == SURFO || typeBlock == SURFL	){
		LinkaNaSurf[id] = false;
		return 0;
	}
	else
	{
		SetLines(id, ent)
	}
	//drawBoxModel(id,ent)
	return PLUGIN_CONTINUE	
}
public bool:isBlockStuck(ent)
{
	//first make sure the entity is valid
	if (IsBlock(ent))
	{
		new content;
		new Float:vOrigin[3];
		new Float:vPoint[3];
		new Float:fSizeMin[3];
		new Float:fSizeMax[3];
		
		//get the size of the block being grabbed
		entity_get_vector(ent, EV_VEC_mins, fSizeMin);
		entity_get_vector(ent, EV_VEC_maxs, fSizeMax);
		
		//get the origin of the block
		entity_get_vector(ent, EV_VEC_origin, vOrigin);
		
		fSizeMin[0] += 1.0;
		fSizeMax[0] -= 1.0;
		fSizeMin[1] += 1.0;
		fSizeMax[1] -= 1.0; 
		fSizeMin[2] += 1.0;
		fSizeMax[2] -= 1.0;
		//decrease the size values of the block
		
		
		//get the contents of the centre of all 6 faces of the block
		for (new i = 0; i < 14; ++i)
		{
			//start by setting the point to the origin of the block (the middle)
			vPoint = vOrigin;
			
			//set the values depending on the loop number
			switch (i)
			{
				//corners
				case 0: { vPoint[0] += fSizeMax[0]; vPoint[1] += fSizeMax[1]; vPoint[2] += fSizeMax[2]; }
				case 1: { vPoint[0] += fSizeMin[0]; vPoint[1] += fSizeMax[1]; vPoint[2] += fSizeMax[2]; }
				case 2: { vPoint[0] += fSizeMax[0]; vPoint[1] += fSizeMin[1]; vPoint[2] += fSizeMax[2]; }
				case 3: { vPoint[0] += fSizeMin[0]; vPoint[1] += fSizeMin[1]; vPoint[2] += fSizeMax[2]; }
				case 4: { vPoint[0] += fSizeMax[0]; vPoint[1] += fSizeMax[1]; vPoint[2] += fSizeMin[2]; }
				case 5: { vPoint[0] += fSizeMin[0]; vPoint[1] += fSizeMax[1]; vPoint[2] += fSizeMin[2]; }
				case 6: { vPoint[0] += fSizeMax[0]; vPoint[1] += fSizeMin[1]; vPoint[2] += fSizeMin[2]; }
				case 7: { vPoint[0] += fSizeMin[0]; vPoint[1] += fSizeMin[1]; vPoint[2] += fSizeMin[2]; }
				
				//centre of faces
				case 8: { vPoint[0] += fSizeMax[0]; }
				case 9: { vPoint[0] += fSizeMin[0]; }
				case 10: { vPoint[1] += fSizeMax[1]; }
				case 11: { vPoint[1] += fSizeMin[1]; }
				case 12: { vPoint[2] += fSizeMax[2]; }
				case 13: { vPoint[2] += fSizeMin[2]; }
			}
			
			//get the contents of the point on the block
			content = point_contents(vPoint);
			
			//if the point is out in the open
			if (content == CONTENTS_EMPTY || content == 0)
			{
				//block is not stuck
				return false;
			}
		}
	}
	else
	{
		//entity is invalid but don't say its stuck
		return false;
	}
	
	//block is stuck
	return true;
}
public editCamp(id){
	if( checkAcces(id, 3) ){
		return PLUGIN_CONTINUE
	}
	new iMax=0;
	new ent=-1;
	while ( ( ent = find_ent_by_class(ent, szBlockClassName) ) ){
		if( !IsBlock(ent) || userBlockProperties[id] == ent)
					continue;
		iMax= max( getEditBlock(ent,1), iMax )	
		
	}
	
	new gText[128]
	format(gText, sizeof(gText),"[BM]^n\wNumber of camps:\r %d", iMax) 
	new menu = menu_create(gText, "editCamp_2")
	menu_additem(menu, "Refresh")
	format(gText, sizeof(gText), "Block type:\y %s", typesCampBlock[getEditBlock(userBlockProperties[id],0)>3?0:getEditBlock(userBlockProperties[id],0)] )
	menu_additem(menu, gText)
	
	
	format(gText, sizeof(gText), "Kamps:\y%s %d",getEditBlock(userBlockProperties[id],1)>iMax?"\r(New)":"",getEditBlock(userBlockProperties[id],1) )
	menu_additem(menu, gText)
	format(gText, sizeof(gText), "Camps points:\y %d",getEditBlock(userBlockProperties[id],2) )
	menu_additem(menu, gText)
	menu_additem(menu, "\ySet^n")
	menu_additem(menu, "Reset camps")
	menu_setprop(menu,MPROP_EXITNAME,"Exit")
	menu_display(id,menu,0)
	return PLUGIN_CONTINUE
}
public editCamp_2(id,menu,item){
	if( item == MENU_EXIT){
		makerMain(id)
		return PLUGIN_CONTINUE
	}
	if( userBlockProperties[id] == 0 && item != 0 ){
		editCamp(id)
		return PLUGIN_CONTINUE
	}
	switch(item){
		case 0:{
			new ent, body
			get_user_aiming(id, ent, body)
			
			if( !IsBlock(ent) || IsTeleport(ent)){
				editCamp(id)
				return PLUGIN_CONTINUE
			}			
			userBlockProperties[id]=ent
		}
		case 1:{
			setEditBlock(userBlockProperties[id],0,(getEditBlock(userBlockProperties[id],0)+1)%sizeof(typesCampBlock))
			
			userCampSave[id][0]=getEditBlock(userBlockProperties[id],0)
		}	
		case 2:{
			new iMax=0;
			new ent=-1;
			while ( ( ent = find_ent_by_class(ent, szBlockClassName) ) ){
				if( !IsBlock(ent) || userBlockProperties[id] == ent)
					continue;
				iMax= max( getEditBlock(ent,1), iMax )
				
				
			}
			setEditBlock( userBlockProperties[id], 1,getEditBlock(userBlockProperties[id],1)>iMax?0:getEditBlock(userBlockProperties[id],1)+1)
			
			userCampSave[id][1]=getEditBlock(userBlockProperties[id],1)
			editCamp(id)
		}
		case 3:{
			
			client_cmd(id, "messagemode value")
			userBlockParamChange[id]=-2;
		}
		case 4:{
			
			new ent, body
			get_user_aiming(id, ent, body)
			
			if( !IsBlock(ent) || IsTeleport(ent)){
				editCamp(id)
				return PLUGIN_CONTINUE
			}				
			setEditBlock(ent,0,getEditBlock(userBlockProperties[id],0))
			setEditBlock(ent,1,getEditBlock(userBlockProperties[id],1))
			setEditBlock(ent,2,getEditBlock(userBlockProperties[id],2))
					
			userBlockProperties[id]=ent
			
		}
		case 5:{
			resetCamps(id)
		}
	}
	if( item != 5 )
		editCamp(id)
	return PLUGIN_CONTINUE
}
public refreshCamp(){
	new ent=-1;
	bonusCampNum=0;
	while ( ( ent = find_ent_by_class(ent, szBlockClassName) ) ){
		if( getEditBlock(ent,0) != 3 )
			continue;
		bonusCampId[bonusCampNum]=ent	
		bonusCampNum++
	}
}
public randomCamp(){
	
	if( pev_valid(entBonus) ){
		new szClassName[12]
		pev(entBonus, pev_classname, szClassName, sizeof(szClassName) )
		if( equal(szClassName, "bonusBlock") ){			
			entity_set_origin(entBonus, Float:{8192.0,8192.0,8192.0})
			remove_entity(entBonus)
		}
	}
	if( pev_valid(entBonus) ){
		new szClassName[12]
		if( equal(szClassName, "bhopsprblock") ){	
			entity_set_origin(entbhopspr, Float:{8192.0,8192.0,8192.0})
			remove_entity(entbhopspr)
		}
	}
	if(bonusCampNum>0){
		new randCamp=random(bonusCampNum);
		new idEnt=bonusCampId[randCamp];
		bonusCampRound=getEditBlock(idEnt,1);
		createBonus(idEnt);
	}else{		
		refreshCamp()
	}
}
public createBonus(ent){
	if( !IsBlock(ent) )
		return PLUGIN_CONTINUE
	new bonus = create_entity("info_target" );
	
	if( !pev_valid(bonus) )
		return PLUGIN_CONTINUE
	
	entity_set_string(bonus, EV_SZ_classname,"bonusBlock")	
	entity_set_int(bonus, EV_INT_movetype, MOVETYPE_NONE);	
	entity_set_int(bonus, EV_INT_solid, SOLID_NOT)
	
	entity_set_model(bonus, teleportsSprites[2][0])
	
	entity_set_int(bonus, EV_INT_rendermode, 3);
	entity_set_float(bonus, EV_FL_renderamt, 255.0);
	
	new Float:fOrigin[3]
	pev(ent, pev_origin, fOrigin)
	fOrigin[2] += 32.0;
	entity_set_origin(bonus, fOrigin)
	entBonus=bonus
	return PLUGIN_CONTINUE
}
public createsprbhop(ent){
	if( !IsBlock(ent) )
		return PLUGIN_CONTINUE
	new bhopspr = create_entity("info_target" );
	
	if( !pev_valid(bhopspr) )
		return PLUGIN_CONTINUE
		
	new Float:angles[3]
	
	angles[0] += 90;
	entity_set_string(bhopspr, EV_SZ_classname,	"bhopsprblock")	
	entity_set_int(bhopspr, EV_INT_movetype, MOVETYPE_NONE);	
	entity_set_int(bhopspr, EV_INT_solid, SOLID_NOT)
	entity_set_vector(bhopspr, EV_VEC_angles, angles);
	
	entity_set_model(bhopspr, teleportsSprites[3][0])
	
	entity_set_int(bhopspr, EV_INT_rendermode, 5);
	entity_set_float(bhopspr, EV_FL_renderamt, 255.0);
	
	new Float:fOrigin[3]
	pev(ent, pev_origin, fOrigin)
	fOrigin[2] += 5.0;
	entity_set_origin(bhopspr,	fOrigin)
	entity_set_float(bhopspr,	EV_FL_frame,		0.0 );    
	entity_set_float(bhopspr,	EV_FL_scale,		0.25);
	entity_set_float(bhopspr,	EV_FL_animtime,		get_gametime());
	entity_set_float(bhopspr,	EV_FL_framerate,	1.0);
	entity_set_float(bhopspr,	EV_FL_nextthink,	get_gametime() + 0.1 ); 
	
	entbhopspr=bhopspr
	
	return PLUGIN_CONTINUE
}
public checkAcces(id, minLevel){
	if( !blockMakerAcces )
		return true
	if( userBM[id] < minLevel ){
		ColorChat(id, TEAM_COLOR, "[BM]^x01 You do not have access to this menu!")
		return true;
	}
	return false
}
public playersMenu(id){
	
	if(checkAcces(id,3))
		return PLUGIN_CONTINUE
	new menu=menu_create("[BM]^n\wAdmin menu", "playersMenu_2")
	new gText[128]
	new name[33]
	new x=0
	for( new i = 1; i<33; i++){
		if(!is_user_connected(i))
			continue;
		if( userBM[i] == 3 )
			continue;
		get_user_name(i,name,sizeof(name))
		format(gText, sizeof(gText), "%s - %s%s", name, userBM[i]>0?"\y":"\d", userBM[i]>0?"It has":"Does not have")
		menu_additem(menu, gText)
		userPlayersMenu[x++]=i
	}
	menu_display(id,menu,0)
	
	return PLUGIN_CONTINUE
}
public playersMenu_2(id,menu,item){
	if(item==MENU_EXIT){		
		adminAddition(id)
		return PLUGIN_CONTINUE
	}
	new target=userPlayersMenu[item]
	new name[33]
	new name2[33]
	get_user_name(id,name2,sizeof(name2))
	get_user_name(target,name,sizeof(name))
	if(userBM[target]>0){
		userBM[target]=0
		ColorChat(id, TEAM_COLOR, "[BM]^x01 You remove^x03 BM^x01 to the player:^x03 %s", name)
		ColorChat(target, TEAM_COLOR, "[BM]^x01 Admin^x03 %s^x01 remove to^x03 BM", name2)
	}else{
		userBM[target]=1
		ColorChat(id, TEAM_COLOR, "[BM]^x01 You gave^x03 BM^x01 to the player:^x03 %s", name)				
		ColorChat(target, TEAM_COLOR, "[BM]^x01 Admin^x03 %s^x01 gave you access to^x03 BM", name2)
	}
	playersMenu(id)
	return PLUGIN_CONTINUE
}
public adminAddition(id){
	new gText[129]
	new menu=menu_create("[BM]^n\wCheckpoint menu", "adminAddition_2")
	menu_additem(menu, "Menu kamps")
	menu_additem(menu, "Save checkpoint")
	format(gText, sizeof(gText), "Auto return: %s", userCheckPoint[id]?"\yYes":"\dNo")
	menu_additem(menu, gText)	
	menu_additem(menu, "Back checkpoint^n")	
	
	menu_additem(menu, "\yAccess\r BM")
	menu_additem(menu, "\yRevive all")
	format(gText, sizeof(gText), "\yGodmode all: %s", GodAll?"\yYes":"\dNo")
	menu_additem(menu, gText)
	if( has_flag(id, "s" ) ){
		format(gText, sizeof(gText), "\yTest blocks: %s", userAdminBlockTest[id]?"\yYes":"\dNo")
		menu_additem(menu, gText)
	}
	menu_display(id,menu,0)
}
public adminAddition_2(id, menu, item ){
	if( item == MENU_EXIT ){
		makerMain(id)
		return PLUGIN_CONTINUE
	}
	switch(item){
		case 0:{
			editCamp(id)
		}
		case 1:{
			entity_get_vector(id, EV_VEC_origin, userSaveLocation[id])
			entity_get_vector(id, EV_VEC_v_angle, userSaveAngles[id])
			adminAddition(id)
		}
		case 2:{
			userCheckPoint[id]=!userCheckPoint[id]
			adminAddition(id)
		}
		case 3:{
			backToCheckPoint(id)
			adminAddition(id)
		}	
		case 4:playersMenu(id)
		case 5:{
			for( new i = 1; i<33; i++){
				if( !is_user_connected(i) )
					continue;
				if(is_user_alive(i))
					continue
				respawnPlayer(i)
			}
			adminAddition(id)
		}
		case 6:{
			GodAll=!GodAll
			for( new i = 1; i<33; i++){
				if( !is_user_connected(i) )
					continue;
				if(!is_user_alive(i))
					continue
				
				set_user_godmode(i, userGodMode[i] ? true : GodAll)		
			}
			adminAddition(id)
		}
		case 7:{
			set_pev(id, pev_movetype, 9)
			userAdminBlockTest[id]=!userAdminBlockTest[id];
			adminAddition(id)
		}
	}
	return PLUGIN_CONTINUE
	
}	
public backToCheckPoint(id){
	if( userSaveLocation[id][0] != 0.0 || userSaveLocation[id][1] != 0.0 || userSaveLocation[id][2] != 0.0 ){				
		entity_set_vector(id, EV_VEC_origin, userSaveLocation[id])
		entity_set_vector(id, EV_VEC_v_angle, userSaveAngles[id])
		entity_set_vector(id, EV_VEC_angles, userSaveAngles[id])
		entity_set_int(id, EV_INT_fixangle, 1)
		entity_set_vector(id, EV_VEC_velocity, Float:{0.0, 0.0, 0.0})
	}
}
public menuSaveAdmin(id){
	new gText[128]
	
	new iNumTele=0
	new ent = find_ent_by_class(-1, szTeleClassName)
	while( ent != 0 ){
		iNumTele++;
		ent=find_ent_by_class(ent, szTeleClassName)
	}
	new iNumBlocks=0
	ent = find_ent_by_class(-1, "blockMaker")
	while( ent != 0 ){
		iNumBlocks++;
		ent=find_ent_by_class(ent, "blockMaker")
	}
	
	format(gText, sizeof(gText), "[BM]^n\wBlocks:\r %d^n\wTeleports:\r %d^n\wTemplate:\r%s", iNumBlocks, iNumTele, actualStyle)
	new menu=menu_create(gText, "menuSaveAdmin_2")
	menu_additem(menu, "Save the blocks")
	menu_additem(menu, "Make a backup")
	menu_additem(menu, "Remove all blocks")
	menu_additem(menu, "Load")
	//if( has_flag(id, "a" ) ){
	format(gText, sizeof(gText), "Template: %s", layoutStyle ? "\ySlow" :"\rNoslow")
	menu_additem(menu, gText)
	//}*/
	format(gText, sizeof(gText), "Auto save: %s",autoSave?"\yON":"\dOFF")
	menu_additem(menu, gText)
	menu_display(id, menu, 0)
}
public menuSaveAdmin_2(id, menu, item){
	if( item == MENU_EXIT ){
		menu_destroy(menu)
		return PLUGIN_CONTINUE
	}
	switch(item){
		case 0:{
			menuSave(id)
		}
		case 1:{
			SaveBlocks(id, 1)
		}
		
		case 2:{
			if( !checkAcces(id, 2) ){
				new ent
				while ( ( ent = find_ent_by_class(ent, szBlockClassName) ) ){
					if( !pev_valid(ent) ){
						continue;
					}	
					remove_entity(ent)
				}
				while ( ( ent = find_ent_by_class(ent, szTeleClassName) ) ){
					if( !pev_valid(ent) ){
						continue;
					}	
					remove_entity(ent)
				}
			}
			
		}	
		case 3:{
			if( !checkAcces(id, 2) ){
				
				menuLoad(id)
			}
		}
		case 4:{
			if( has_flag(id, "s" ) ){
				
				new file=fopen(pathFolder, "wt")				
				fputs(file, layoutStyle ? "noslow" : "slow" );				
				fclose(file)
				layoutStyle=!layoutStyle;
				new name[33]
				get_user_name(id, name, 32)
				ColorChat(id, TEAM_COLOR, "[BM]^x01 %s changed his style of play to^x03 [%s]^x01 template ^x03[%s]", name, layoutStyle ? "Slow" : "Noslow", actualStyle)
			}
			menuSaveAdmin(id)
		}
		case 5:{			
			autoSave=!autoSave
			if( !task_exists(TASK_AUTOSAVE) && autoSave ){
				set_task(0.1, "autoSaveTask" ,TASK_AUTOSAVE)
			}else if( !autoSave  && task_exists(TASK_AUTOSAVE) ){
				remove_task(TASK_AUTOSAVE)
			}
			menuSaveAdmin(id)
		}
	}
	
	return PLUGIN_CONTINUE
}
new Float:tpGVelocity[1024][3];
public teleportThink(ent){
	if( !pev_valid(ent) || !IsTeleport(ent) )
		return 0;
	static Float:fOrigin[3];
	static Float:fOriginPlayer[3]
	static Float:fOriginDestination[3]
	entity_get_vector(ent, EV_VEC_origin, fOrigin)
	if( entity_get_int(ent, EV_INT_iuser3) == 0 ){
		if( entity_get_int(ent, EV_INT_iuser2) == 1  ){
			if( !task_exists(ent+TASK_TELEPORT) ) {
				for( new id = 1; id < 33; id ++ )
				{
					if( !is_user_alive(id) || !is_user_connected(id) )
						continue;
						
					entity_get_vector(id, EV_VEC_origin, fOriginPlayer)
					
					if( get_distance_f(fOrigin, fOriginPlayer) > 125.0 ){
						continue;			
					}		
					entity_set_int(ent, EV_INT_solid, SOLID_NOT)
					set_task(2.0, "teleportMakeSolid", ent+TASK_TELEPORT)
					break;
				}
			}
		}
		if( entity_get_int(ent, EV_INT_iuser2) == 0  ){
			for( new id = 1; id < 33; id ++ ){			
				if( !is_user_alive(id) || !is_user_connected(id) )
					continue;
						
				entity_get_vector(id, EV_VEC_origin, fOriginPlayer)
				
				if( get_distance_f(fOrigin, fOriginPlayer) < 125.0 ){
					if( !task_exists(ent+TASK_TELEPORT) ){
						entity_set_int(ent, EV_INT_solid, SOLID_NOT)
						set_task(2.0, "teleportMakeSolid", ent+TASK_TELEPORT)
					}
				}
				
				if( get_distance_f(fOrigin, fOriginPlayer) > getParamBlock(ent, 0) )
					continue;	
					
				new target= entity_get_int(ent, EV_INT_iuser1);	
				
				if( target == 0 )
					continue
					
				if( !IsTeleport(target) )
					continue
				
				if( !task_exists(target+TASK_TELEPORT) ){
					entity_set_int(target, EV_INT_solid, SOLID_NOT)
					set_task(2.0, "teleportMakeSolid", target+TASK_TELEPORT)
				}
					
					
				new iOrigin[3]
				FVecIVec(fOrigin, iOrigin)
				message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin);
				write_byte(TE_IMPLOSION);
				write_coord(iOrigin[0]);
				write_coord(iOrigin[1]);
				write_coord(iOrigin[2]);
				write_byte(64);		
				write_byte(100);	
				write_byte(6);		
				message_end();
				
				entity_get_vector(target, EV_VEC_origin, fOriginDestination)
				
				new Float:tempVelocity=0.0;
				new Float:fVelocity[3]
				pev(id,pev_velocity,fVelocity)
				fVelocity[2]=floatabs(fVelocity[2]);
				fVelocity[2]+= getParamBlock(ent, 1);
				tempVelocity=fVelocity[2]
					
				new Float:speed=floatsqroot(floatpower ( fVelocity[0], 2.0 ) + floatpower ( fVelocity[1], 2.0 ))
				
				if( getParamBlock(ent, 2) != 0.0 ){
					velocity_by_aim(id,abs(floatround(speed+getParamBlock(ent, 2))),fVelocity)				
					fVelocity[2]+=tempVelocity;
				}
				speed=floatsqroot(floatpower ( fVelocity[0], 2.0 ) + floatpower ( fVelocity[1], 2.0 ))
						
				new Float:fAngles[3]
				if(getParamBlock(ent, 3)!=0.0){
					new Float:radianRotate =(getParamBlock(ent, 3)* 3.14)/180
					
					new Float:ca = floatcos(radianRotate);
					new Float:sa = floatsin(radianRotate);
					
					pev(id, pev_angles, fAngles)				
					fAngles[1]+=getParamBlock(ent, 3);
					set_pev( id, pev_angles, fAngles)
					set_pev( id, pev_v_angle, fAngles)
					set_pev( id, pev_fixangle, 1)
					
					set_pev(id, pev_origin, fOriginDestination)
					
					
					tpVelocity[id][0] = ca*fVelocity[0] - sa*fVelocity[1]
					tpVelocity[id][1] = sa*fVelocity[0] + ca*fVelocity[1]
					
					tpVelocity[id][2] = floatmax(tempVelocity,getParamBlock(ent, 1))
					set_pev(id, pev_velocity, tpVelocity[id])
				
				}else{
					
					set_pev(id, pev_origin, fOriginDestination)
					set_pev(id, pev_velocity, fVelocity)
				}
				
				emit_sound(id, CHAN_WEAPON, soundsNames[0], 1.0, ATTN_NORM, 0, PITCH_NORM)	
				
				killCloseEnemies(id)				
			}
			new szClass[9]
			new Float:fOriginGranade[3];
			
			
			for(new granade = 33; granade < 1024; granade ++){
				
				if(!pev_valid(granade)) continue;
				
				if( granade == 0 )
					continue
				
				pev(granade, pev_classname, szClass, sizeof(szClass) )
			
				if(!equal(szClass, "grenade"))
					continue;
				
				entity_get_vector(granade, EV_VEC_origin, fOriginGranade)
						
				if( get_distance_f(fOrigin, fOriginGranade) > getParamBlock(ent, 0) ) continue;
				new target= entity_get_int(ent, EV_INT_iuser1);	
				if( target == 0 ) continue	
				if( !IsTeleport(target) ) continue
					
				new iOrigin[3]
				FVecIVec(fOrigin, iOrigin)
				message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin);
				write_byte(TE_IMPLOSION);
				write_coord(iOrigin[0]);
				write_coord(iOrigin[1]);
				write_coord(iOrigin[2]);
				write_byte(64);		
				write_byte(100);	
				write_byte(6);		
				message_end();
				
				entity_get_vector(target, EV_VEC_origin, fOriginDestination)
				
				new Float:tempVelocity=0.0;
				new Float:fVelocity[3]
				pev(granade,pev_velocity,fVelocity)
				fVelocity[2]=floatabs(fVelocity[2]);
				fVelocity[2]+= getParamBlock(ent, 1);
				tempVelocity=fVelocity[2]
					
				new Float:speed=floatsqroot(floatpower ( fVelocity[0], 2.0 ) + floatpower ( fVelocity[1], 2.0 ))
				
				if( getParamBlock(ent, 2) != 0.0 ){
					velocity_by_aim(granade,abs(floatround(speed+getParamBlock(ent, 2))),fVelocity)				
					fVelocity[2]+=tempVelocity;
				}
				speed=floatsqroot(floatpower ( fVelocity[0], 2.0 ) + floatpower ( fVelocity[1], 2.0 ))
						
				set_pev(granade, pev_solid, SOLID_NOT)	
					
				new Float:fAngles[3]
				if(getParamBlock(ent, 3)!=0.0){
					new Float:radianRotate =(getParamBlock(ent, 3)* 3.14)/180
					
					new Float:ca = floatcos(radianRotate);
					new Float:sa = floatsin(radianRotate);
					
					pev(granade, pev_angles, fAngles)				
					fAngles[1]+=getParamBlock(ent, 3);
					set_pev( granade, pev_angles, fAngles)
					set_pev( granade, pev_v_angle, fAngles)
					set_pev( granade, pev_fixangle, 1)
					
					set_pev(granade, pev_origin, fOriginDestination)
					
					
					tpGVelocity[granade][0] = ca*fVelocity[0] - sa*fVelocity[1]
					tpGVelocity[granade][1] = sa*fVelocity[0] + ca*fVelocity[1]
					
					tpGVelocity[granade][2] = floatmax(tempVelocity,getParamBlock(ent, 1))
					set_pev(granade, pev_velocity, tpGVelocity[granade])
				
				}else{
					
					set_pev(granade, pev_origin, fOriginDestination)
					set_pev(granade, pev_velocity, fVelocity)
				}
				
				emit_sound(granade, CHAN_WEAPON, soundsNames[0], 1.0, ATTN_NORM, 0, PITCH_NORM)	
				
				
			}
		}
	}
	/*if( !found ){
		if( task_exists(ent+TASK_TELEPORT) )
			remove_task(ent+TASK_TELEPORT)
		
		entity_set_int(ent, EV_INT_solid, SOLID_BBOX)
	}*/
	entity_set_float(ent, EV_FL_nextthink, get_gametime()+0.1);

	return 1;
}
public speedUpTeleport(id){	
	set_pev(id, pev_velocity, tpVelocity[id])
}

/*
public menuLights(id){
	new menu=menu_create("Light", "menuLights_2")
	menu_additem(menu, "Create a lamp")
	menu_additem(menu, "Remove the lamp")
	menu_additem(menu, "Properties")
	menu_display(id, menu, 0 )
}
public menuLights_2(id,menu,item){
	if( item == MENU_EXIT){
		menu_destroy(menu)
		return PLUGIN_CONTINUE
	}
	switch(item){
		case 0:createLightAim(id)
		case 1:{
			new ent, body
			get_user_aiming(id, ent, body)
			if( IsLight(ent) ){
				deleteBlock(ent)
			}
			
		}
		case 2:{
			new ent, body
			get_user_aiming(id, ent, body)
			if( !IsLight(ent) ){
				menuLights(id)
				return PLUGIN_CONTINUE
			}
			userBlockProperties[id]=ent
			changeRendering(id)
		}
	}
	
	return PLUGIN_CONTINUE
}
public createLightAim(id){	
	new iLook[3]
	new Float:fLook[3]
	get_user_origin(id, iLook, 3)
	IVecFVec(iLook, fLook)	
	fLook[2]+=4.0	
	createLight(fLook, Float:{255.0,255.0,128.0})
}
public createLight(Float:fOrigin[3], Float:Colors[3]){
	new ent = create_entity("env_sprite")
	if( !pev_valid(ent) )
		return -1;
		
	entity_set_string(ent, EV_SZ_classname, szLightClassName)	
	entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE);	
	entity_set_int(ent, EV_INT_solid, SOLID_BBOX)
	
	entity_set_edict(ent, EV_ENT_euser1, 20)
	entity_set_int(ent, EV_INT_iuser4, 10)
	
	entity_set_vector(ent, EV_VEC_rendercolor, Float:{255.0,255.0,128.0} )
	entity_set_model(ent, "sprites/lightbulb.spr")
	entity_set_float(ent, EV_FL_scale, 0.25)
	entity_set_origin(ent, fOrigin)	
	entity_set_float(ent, EV_FL_nextthink, get_gametime()+0.1);
	return ent;
}
public lightThink(ent){
	if( !pev_valid(ent) )
		return 0
	
	
	
		
	new Float:fOrigin[3], Float:fOriginPlayer[3], iOrigin[3]
	entity_get_vector(ent, EV_VEC_origin, fOrigin)
	
	if( !task_exists(ent+TASK_TELEPORT) ){
		for( new i =1;i<33();i++){
			if( !is_user_connected(i) || !is_user_alive(i) )
				continue;
			entity_get_vector(i, EV_VEC_origin, fOriginPlayer)	
			if( get_distance_f(fOriginPlayer, fOrigin) > 100 )
				continue;
			if( !task_exists(ent+TASK_TELEPORT) ){
				entity_set_int(ent, EV_INT_solid, SOLID_NOT)
				set_task(2.0, "teleportMakeSolid", ent+TASK_TELEPORT)
				
				break
			}
		}
	}
	
	FVecIVec(fOrigin, iOrigin)
	new Float:fColor[3]
	entity_get_vector(ent, EV_VEC_rendercolor, fColor)
	new radius=entity_get_edict(ent, EV_ENT_euser1)
	new brightness=entity_get_int(ent, EV_INT_iuser4)
	
	message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin, 0);
	write_byte(TE_DLIGHT)			
	write_coord(iOrigin[0]);	
	write_coord(iOrigin[1]);
	write_coord(iOrigin[2]);			
	write_byte(radius)			

	write_byte(floatround(fColor[0])); 
	write_byte(floatround(fColor[1])); 
	write_byte(floatround(fColor[2])); 
	
	write_byte(1)			
	write_byte(1)			
	message_end()
	entity_set_float(ent, EV_FL_nextthink, get_gametime()+0.01);
	return 1;
}*/
public bool:isInvisible(id){
	if( userSkills[id][1][0] > get_gametime() )
		return true;
	return false;

}
public bool:isSpeed(id){
	if( userSkills[id][2][0] > get_gametime() )
		return true;
	return false;
}
public bool:isFeniks(id){
	if( userSkills[id][4][0] > get_gametime() )
		return true;
	return false;
}
public bool:isSkrzynka(id){
	if( userSkills[id][5][0] > get_gametime() )
		return true;
	return false;
}
public bool:isImmortal(id){
	if( userSkills[id][0][0] > get_gametime() )
		return true;
	return false;
}
public makeTrail(id) {
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte(22)	// TE_BEAMFOLLOW
	write_short(id)
	write_short(beam_spr)
	write_byte(10)
	write_byte(8)
	write_byte(255)
	write_byte(150)
	write_byte(0)
	write_byte(255)
	message_end()

}
public killTrail(id){
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte(99)	
	write_short(id)
	message_end()
}
public killAccelerate(id){
	if( !is_user_alive(id) || !is_user_connected(id) )
		return PLUGIN_CONTINUE
	killTrail(id)
	if( !isInvisible(id) || !isImmortal(id) ){
		setRendering(0, id, 255, 255, 255, 255)
	}			
	return PLUGIN_CONTINUE
}
stock Display_Fade(id,duration,holdtime,fadetype,red,green,blue,alpha)

{

    message_begin( MSG_ONE, get_user_msgid("ScreenFade"),{0,0,0},id );
    write_short( duration );
    write_short( holdtime );   
    write_short( fadetype );    
    write_byte ( red );        
    write_byte ( green );       
    write_byte ( blue );    
    write_byte ( alpha );    
    message_end();

}
public resetCamps(id){
	new menu = menu_create("[BM]^n\wDo you really want to reset the camps?", "resetCamps_2")
	menu_additem(menu, "Yes, reset")
	menu_additem(menu, "Don't, quit")	
	menu_display(id, menu, 0)
}	
public resetCamps_2(id, menu, item){
	if( item == MENU_EXIT ){
		menu_destroy(menu)
		return PLUGIN_CONTINUE
	}
	switch(item){
		case 0:{
			new ent=-1;
			while ( ( ent = find_ent_by_class(ent, szBlockClassName) ) ){
				if( !pev_valid(ent) ) 
					continue
				setEditBlock(ent, 0, 0 )
				setEditBlock(ent, 1, 0 )
				setEditBlock(ent, 2, 0 )
			}
			ColorChat(id, TEAM_COLOR, "[BM]^x01 Successfully reset")
		}
	}
	editCamp(id)		
	return PLUGIN_CONTINUE
}
stock displayFade(id,duration,holdtime,fadetype,red,green,blue,alpha){
	if (!is_user_alive(id)) return;
	static msgScreenFade;
	if (!msgScreenFade) msgScreenFade = get_user_msgid("ScreenFade");
	message_begin(MSG_ONE, msgScreenFade, {0, 0, 0}, id);
	write_short(duration); write_short(holdtime); write_short(fadetype); write_byte(red); write_byte(green); write_byte(blue); write_byte(alpha);
	message_end();
}
public fwd_touch(toucher, touched){
	if( !pev_valid(toucher) || !pev_valid(touched) || touched == 0 || toucher == 0 )
		return PLUGIN_CONTINUE
		
	new szClassEnt_1[33], szClassEnt_2[33]
	pev(toucher, pev_classname, szClassEnt_1, sizeof(szClassEnt_1) )
	pev(touched, pev_classname, szClassEnt_2, sizeof(szClassEnt_2) )
	
	
	if(IsBlock(toucher)){
			
		if( equal(szClassEnt_2, "grenade") ){
			if( pev(touched, pev_iuser1) == 0){
				new Float:fVelocity[3]
				pev(touched, pev_velocity, fVelocity)
				fVelocity[0] *= -1;
				fVelocity[1] *= -1;
				fVelocity[2] *= -1;
				set_pev(touched, pev_velocity, fVelocity)
				set_pev(touched, pev_iuser1, 1)
				
			}
		}
	}
	return PLUGIN_CONTINUE
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/
here is the shop plugin (in this plugin points use to buy weapons) that i use:

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fakemeta_util>
#include <fun>
#include <hamsandwich>
#include <colorchat>
#include <nvault>

new const P[] = "HNS Shop Edited"
new const A[] = "xPaw & Grim"
new const V[] = "1.0"

new const prefix[] = "^3International-Gaming^4"

//Natives for Anti-Frost and XP
native add_user_immune( id );
native remove_user_immune( id );

native hnsxp_get_user_xp(client);
native hnsxp_set_user_xp(client, xp);

stock hnsxp_add_user_xp(client, xp) {
	return hnsxp_set_user_xp(client, hnsxp_get_user_xp(client) + xp);
}
//End Natives

new bm_points[33], AwpReward, HeadshotReward, NormalReward, KillMessage, g_vault

// Cost of items
new deaglecost, m3cost, awpcost, hecost;
new healthcost, healthammount, armorcost, armorammount;
new noflashcost, nofrostcost;
new xpcost, xpamount;
new respawncost;

//Used or not?
new userhealth[33], userarmor[33], userawp[33], usernoflash[33], usernofrost[33], userxp[33];
new userrespawn[33], userm3[33], userdeagle[33], userhe[33]


//Floats
new Float:g_gametime2;
new Float:g_gametime, g_owner;

//For Anti-Flash
new grenade[32];
new bool:g_track_enemy;
new bool:g_track[33];
new g_msgScreenFade, last;
new g_sync_check_data;

//Plugin init
public plugin_init( )
{
	register_plugin(P,V,A)
	register_clcmd( "say /shop", "bm_hns_shop" )
	register_clcmd( "say_team /shop", "bm_hns_shop" )
	register_clcmd( "say /hnsshop", "bm_hns_shop" )
	register_clcmd( "say_team /hnsshop", "bm_hns_shop" )
	register_clcmd( "say /bmshop", "bm_hns_shop" )
	register_clcmd( "say_team /bmshop", "bm_hns_shop")
	register_clcmd( "say /points", "MyPoints" )
	register_clcmd( "say_team /points", "MyPoints" )
	
	// admin command to give bm points
	register_concmd("amx_give_bm_points", "cmd_give_bmpoints", ADMIN_RCON, "<Name> <BM Points Amount>")
	register_concmd("amx_take_bm_points", "cmd_take_bmpoints", ADMIN_RCON, "<Name> <BM Points Amount>")
	register_concmd("amx_give_bm_points_all", "cmd_give_bmpoints_all", ADMIN_RCON, "<BM Points Amount>")
	
	// events 
	RegisterHam(Ham_Spawn, "player", "fwPlayerSpawn", 1)
	register_event("DeathMsg", "eDeath", "a");
	register_event("ScreenFade", "eventFlash", "be", "4=255", "5=255", "6=255", "7>199");
	register_event("TextMsg", "fire_in_the_hole", "b", "2&#Game_radio", "4&#Fire_in_the_hole");
	register_event("TextMsg", "fire_in_the_hole2", "b", "3&#Game_radio", "5&#Fire_in_the_hole");
	register_event("99", "grenade_throw", "b");
	
	// shop cvars
	hecost = register_cvar( "bm_shop_hecost", "25" )
	healthammount = register_cvar( "bm_shop_healthammount", "100" )
	healthcost = register_cvar( "bm_shop_healthcost", "15" )
	armorammount = register_cvar( "bm_shop_armorammount", "100" )
	armorcost = register_cvar( "bm_shop_armorcost", "10" )
	awpcost = register_cvar( "bm_shop_awpcost", "75" )
	respawncost = register_cvar( "bm_shop_respawncost", "100" )
	m3cost = register_cvar( "bm_shop_m3cost", "60" )
	deaglecost = register_cvar( "bm_shop_deaglecost", "60" )
	noflashcost = register_cvar( "bm_shop_noflashcost", "40" )
	nofrostcost = register_cvar( "bm_shop_nofrostcost", "40" )
	xpcost = register_cvar( "bm_shop_xpcost", "20" )
	xpamount = register_cvar( "bm_shop_xpamount", "1000" )
	
	AwpReward = register_cvar("bm_shop_awp_kill_reward", "5")
	HeadshotReward = register_cvar("bm_shop_headshot_kill_reward", "3")
	NormalReward = register_cvar("bm_shop_normal_kill_reward", "2")
	KillMessage = register_cvar("bm_shop_kill_message", "1")
	
	//tasks
	set_task( 2.0, "flash",_,_,_, "b" );
	g_msgScreenFade = get_user_msgid("ScreenFade");
	
	g_vault = nvault_open("BmPointsShop")
	
}
public fwPlayerSpawn(id) {
	if(is_user_alive(id)) {
		userhe[id] = 0;
		userhealth[id] = 0;
		userarmor[id] = 0;
		userawp[id] = 0;
		usernoflash[id] = 0;
		usernofrost[id]	 = 0;
		userxp[id] = 0;
		userm3[id] = 0;
		userdeagle[id] = 0;
		userrespawn[id] = 0;
		
		remove_user_immune(id);
	}
}
//When player connects
public client_connect( id ) {
	userhe[id] = 0;
	userhealth[id] = 0;
	userarmor[id] = 0;
	userawp[id] = 0;
	usernoflash[id] = 0;
	usernofrost[id]	 = 0;
	userxp[id] = 0;
	userm3[id] = 0;
	userdeagle[id] = 0;
	userrespawn[id] = 0;
	
	remove_user_immune(id);
	
	LoadData(id);
}

public client_disconnect( id ) {
	userhealth[id] = 0;
	userarmor[id] = 0;
	userhe[id] = 0;
	usernoflash[id] = 0;
	usernofrost[id]	 = 0;
	userawp[id] = 0;
	userm3[id] = 0;
	userdeagle[id] = 0;
	userxp[id] = 0;
	userrespawn[id] = 0;
	
	remove_user_immune(id);
	SaveData(id);
}
public client_putinserver(id) {
	LoadData(id);
}
public eDeath( id ) {
	new killer = read_data(1);
	new victim = read_data(2);
	
	if(!is_user_connected(killer) || !is_user_connected(victim) || killer == victim)
		return PLUGIN_HANDLED;
	
	new headshot = read_data(3)
	
	new weapon[32]
	read_data(4, weapon, charsmax(weapon))
	
	new award
	
	if(equali(weapon, "awp")) award = get_pcvar_num(AwpReward)
	else if(headshot) award = get_pcvar_num(HeadshotReward)
		else award = get_pcvar_num(NormalReward)
	bm_points[killer] += award
	
	if(get_pcvar_num(KillMessage) == 1) {
		new name_victim[32]
		get_user_name(victim, name_victim, 31)
		
		ColorChat(killer, NORMAL, "^4[%s] ^1You got^3 %i^1 points for killing^4 %s", prefix, award, name_victim)
	}
	
	return PLUGIN_CONTINUE;
}
public MyPoints(id) {
	ColorChat(id, GREY, "^4[%s]^3 BM Credits:^4 %d", prefix, bm_points[id])
}
public bm_hns_shop(id) {
	if(cs_get_user_team(id) == CS_TEAM_CT) {
		hns_shop(id)
	} else { 
		ColorChat(id, BLUE, "^4[%s]^1 This menu is avaliable only for^3 CT's^1.", prefix)
	}
}
public hns_shop( id ) {
	new szShop[200], szHE[200], szHealth[200], szDeagle[200], szM3[200], szArmor[200], szAwp[200], szRespawn[200], szNoFrost[200], szXP[200], szNoFlash[200];
	
	formatex( szShop, charsmax( szShop ), "\w[\rInternational-Gaming\w] \wBlockmaker Shop^n\rYour BM Credits: \y%d\d", bm_points[id] );
	formatex( szHealth, charsmax( szHealth ), "\w%d Health Points  - \d(\r%d \wBM Credits)", get_pcvar_num( healthammount ), get_pcvar_num( healthcost ) );
	formatex( szArmor, charsmax( szArmor ), "\w%d Armor Points - \d(\r%d \wBM Credits)", get_pcvar_num( armorammount ), get_pcvar_num( armorcost ) );
	formatex( szHE, charsmax( szHE ), "\w1 HE Grenade - \d(\r%d \wBM Credits)", get_pcvar_num( hecost ) );
	formatex( szNoFrost, charsmax( szNoFrost ), "\wNo Frost (\r1 \wROUND) - \d(\r%d \wBM Credits)", get_pcvar_num( nofrostcost ) );
	formatex( szNoFlash, charsmax( szNoFlash ), "\wNo Flash (\r1 \wROUND) - \d(\r%d \wBM Credits)", get_pcvar_num(noflashcost));
	formatex( szAwp, charsmax( szAwp ), "\wAWP - \d(\r%d \wBM Credits)", get_pcvar_num( awpcost ) );
	formatex( szM3, charsmax( szM3 ), "\wM3 Shotgun - \d(\r%d \wBM Credits)", get_pcvar_num( m3cost ) );
	formatex( szDeagle, charsmax( szDeagle ), "\wDeagle - \d(\r%d \wBM Credits)", get_pcvar_num(deaglecost));
	formatex( szXP, charsmax( szXP ), "\w%d XP - \d(\r%d \wBM Credits)", get_pcvar_num(xpamount), get_pcvar_num( xpcost ) );
	formatex( szRespawn, charsmax( szRespawn ), "\wRespawn - \d(\r%d \wBM Credits)", get_pcvar_num( respawncost ) );
	
	
	new shop = menu_create( szShop, "shop_handler" );
	menu_additem( shop, szHealth, 	"1", 0 );
	menu_additem( shop, szArmor, 	"2", 0 );
	menu_additem( shop, szHE, 	"3", 0 );
	menu_additem( shop, szNoFrost, 	"4", 0 );
	menu_additem( shop, szNoFlash, 	"5", 0 );
	menu_additem( shop, szAwp, 	"6", 0 );
	menu_additem( shop, szM3, 	"7", 0 );
	menu_additem( shop, szDeagle, 	"8", 0 );
	menu_additem( shop, szXP, 	"9", 0 );
	menu_additem( shop, szRespawn, 	"10", 0 );
	
	menu_setprop( shop, MPROP_EXIT, MEXIT_ALL );
	menu_setprop( shop, MPROP_NUMBER_COLOR, "\r")
	menu_display( id, shop, 0 );
}

public shop_handler( id, shop, item ) {
	if( item == MENU_EXIT ) {
		menu_destroy( shop );
		return PLUGIN_HANDLED;
	}
	
	new data[6], iName[64];
	new access, callback;
	menu_item_getinfo( shop, item, access, data, 6, iName, 63, callback )
	
	new key = str_to_num( data );
	
	switch( key )
	{
		case 1: // Health
		{
			if( !is_user_alive( id ) ) {
				ColorChat( id, NORMAL,"^4[%s]^3 You cannot buy items when your dead!", prefix );
				return PLUGIN_HANDLED; 
			}
			if(userhealth[id] > 0) {
				ColorChat( id, NORMAL, "^4[%s]^3 You've already bought this before!", prefix );
				return PLUGIN_HANDLED;
			}
			if( bm_points[id]>= get_pcvar_num( healthcost ) ) {
				bm_points[id] -= get_pcvar_num( healthcost )
				new userhp = get_user_health( id )
				new health = get_pcvar_num( healthammount )
				set_user_health( id, userhp + health )
				userhealth[id]++;
				ColorChat( id, NORMAL, "^4[%s]^1 You've bought^3 %d Health!", prefix , get_pcvar_num( healthammount ) )
				} else {
				ColorChat( id, NORMAL, "^4[%s]^1 You need more BM Credits to buy^3 %d Health!", prefix , get_pcvar_num( healthammount ) )
			}
		}
		case 2: // Armor
		{
			if( !is_user_alive( id ) ) {
				ColorChat( id, NORMAL,"^4[%s]^3 You cannot buy items when your dead!", prefix );
				return PLUGIN_HANDLED; 
			}
			if(userarmor[id] > 0) {
				ColorChat( id, NORMAL, "^4[%s]^3 You've already bought this before!", prefix );
				return PLUGIN_HANDLED;
			}
			if( bm_points[id] >= get_pcvar_num( armorcost ) ) {
				bm_points[id] -= get_pcvar_num( armorcost )
				new playerarmor = get_user_armor( id )
				new armor = get_pcvar_num( armorammount )
				set_user_armor( id, playerarmor + armor )
				userarmor[id]++;
				ColorChat( id, NORMAL, "^4[%s]^1 You've bought^3 %d Armor!", prefix, get_pcvar_num( armorammount ) )
				} else {
				ColorChat( id, NORMAL, "^4[%s]^1 You need more BM Credits to buy^3 %d Armor!", prefix, get_pcvar_num( armorammount ) )
			}
		}
		case 3: // 1 HE
		{
			if( !is_user_alive( id ) ) {
				ColorChat( id, NORMAL,"^4[%s]^3 You cannot buy items when your dead.", prefix );
				return PLUGIN_HANDLED; 
			}
			if(userhe[id] > 0) {
				ColorChat( id, NORMAL, "^4[%s]^3 You've already bought this before.", prefix );
				return PLUGIN_HANDLED;
			}
			if( bm_points[id] >= get_pcvar_num( hecost ) ) {
				bm_points[id] -= get_pcvar_num( hecost )
				give_item( id, "weapon_hegrenade" )
				userhe[id]++;
				ColorChat( id, NORMAL, "^4[%s]^1 You've bought a^3 HE Grenade!", prefix )
				} else {
				ColorChat( id, NORMAL, "^4[%s]^1 You need more BM Credits to buy a^3 HE Grenade!", prefix )
			}
		}
		case 4: // No Frost
		{
			if( !is_user_alive( id ) ) {
				ColorChat( id, NORMAL,"^4[%s]^3 You cannot buy items when your dead.", prefix );
				return PLUGIN_HANDLED; 
			}
			if(usernofrost[id] > 0) {
				ColorChat( id, NORMAL, "^4[%s]^3 You've already bought this before.", prefix );
				return PLUGIN_HANDLED;
			}
			if( bm_points[id] >= get_pcvar_num( nofrostcost ) ) {
				bm_points[id] -= get_pcvar_num( nofrostcost )
				add_user_immune( id );
				usernofrost[id]++;
				ColorChat( id, NORMAL, "^4[%s]^1 You've bought^3 Anti-Frost!", prefix )
				} else {
				ColorChat( id, NORMAL, "^4[%s]^1 You need more BM Credits to buy^3 Anti-Frost!", prefix )
			}
		}
		case 5: // No Flash
		{
			if( !is_user_alive( id ) ) {
				ColorChat( id, NORMAL,"^4[%s]^3 You cannot buy items when your dead.", prefix );
				return PLUGIN_HANDLED; 
			}
			if(usernoflash[id] > 0) {
				ColorChat( id, NORMAL, "^4[%s]^3 You've already bought this before.", prefix );
				return PLUGIN_HANDLED;
			}
			if( bm_points[id] >= get_pcvar_num(noflashcost) ) {
				bm_points[id] -= get_pcvar_num(noflashcost)
				usernoflash[id]++;
				ColorChat( id, NORMAL, "^4[%s]^1 You've bought^3 Anti-Flash!", prefix )
				} else {
				ColorChat( id, NORMAL, "^4[%s]^1 You need more BM Credits to buy^3 Anti-Flash!", prefix )
			}
		}
		case 6: // AWP 1 Bullet
		{
			if( !is_user_alive( id ) ) {
				ColorChat( id, NORMAL,"^4[%s]^3 You cannot buy items when your dead.", prefix );
				return PLUGIN_HANDLED; 
			}
			if(userawp[id] > 0) {
				ColorChat( id, NORMAL, "^4[%s]^3 You've already bought this before.", prefix );
				return PLUGIN_HANDLED;
			}
			if( bm_points[id] >= get_pcvar_num(awpcost) ) {
				bm_points[id] -= get_pcvar_num(awpcost)
				fm_give_item( id, "weapon_awp" )
				cs_set_weapon_ammo( find_ent_by_owner( 1, "weapon_awp", id ), 1 )
				cs_set_user_bpammo(id, CSW_AWP, 0)
				new awpname[42]
				get_user_name(id, awpname, 32)
				set_hudmessage(255, 255, 255, -1.0, -1.0, 0, 6.0, 4.0)
				show_hudmessage(0, "%s bought an Awp! Watch out!", awpname)
				userawp[id]++;
				ColorChat( id, NORMAL, "^4[%s]^1 You've bought an^3 AWP!", prefix )
				} else {
				ColorChat( id, NORMAL, "^4[%s]^1 You need more BM Credits to buy an^3 AWP!", prefix )
			}
		}
		case 7: // M3 1 Bullet
		{
			if( !is_user_alive( id ) ) {
				ColorChat( id, NORMAL,"^4[%s]^3 You cannot buy items when your dead.", prefix );
				return PLUGIN_HANDLED; 
			}
			if(userm3[id] > 0) {
				ColorChat( id, NORMAL, "^4[%s]^3 You've already bought this before.", prefix );
				return PLUGIN_HANDLED;
			}
			if( bm_points[id] >=get_pcvar_num(m3cost) ) {
				bm_points[id] -= get_pcvar_num(m3cost)
				fm_give_item( id, "weapon_m3" )
				cs_set_weapon_ammo( find_ent_by_owner( 1, "weapon_m3", id ), 1 )
				cs_set_user_bpammo(id, CSW_M3, 0)
				new m3name[42]
				get_user_name(id, m3name, 32)
				set_hudmessage(255, 255, 255, -1.0, -1.0, 0, 6.0, 4.0)
				show_hudmessage(0, "%s bought an M3! Watch out!", m3name)
				userm3[id]++;
				ColorChat( id, NORMAL, "^4[%s]^1 You've bought an^3 M3!", prefix )
				} else {
				ColorChat( id, NORMAL, "^4[%s]^1 You need more BM Credits to buy an^3 M3!", prefix )
			}
		}
		case 8: // Deagle 1 Bullets
		{
			if( !is_user_alive( id ) ) {
				ColorChat( id, NORMAL,"^4[%s]^3 You cannot buy items when your dead.", prefix );
				return PLUGIN_HANDLED; 
			}
			if(userdeagle[id] > 0) {
				ColorChat( id, NORMAL, "^4[%s]^3 You've already bought this before.", prefix );
				return PLUGIN_HANDLED;
			}
			if( bm_points[id] >= get_pcvar_num(deaglecost) ) {
				bm_points[id] -= get_pcvar_num(deaglecost)
				fm_give_item( id, "weapon_deagle" )
				cs_set_weapon_ammo( find_ent_by_owner( 1, "weapon_deagle", id ), 1 )
				cs_set_user_bpammo(id, CSW_DEAGLE, 0)
				userdeagle[id]++;
				ColorChat( id, NORMAL, "^4[%s]^1 You've bought an^3 Deagle!", prefix )
				} else {
				ColorChat( id, NORMAL, "^4[%s]^1 You need more BM Credits to buy an^3 Deagle!", prefix )
			}
		}
		case 9: // XP
		{
			if( !is_user_alive( id ) ) {
				ColorChat( id, NORMAL,"^4[%s]^3 You cannot buy items when your dead.", prefix );
				return PLUGIN_HANDLED; 
			}
			if(userxp[id] > 0) {
				ColorChat( id, NORMAL, "^4[%s]^3 You've already bought this before.", prefix );
				return PLUGIN_HANDLED;
			}
			if( bm_points[id] >= get_pcvar_num(xpcost) ) {
				bm_points[id] -= get_pcvar_num(xpcost)
				new xp_amount = get_pcvar_num(xpamount)
				hnsxp_add_user_xp(id, xp_amount);
				userxp[id]++;
				ColorChat( id, NORMAL, "^4[%s]^1 You've bought^3 %d XP!", prefix, xp_amount )
				} else {
				ColorChat( id, NORMAL, "^4[%s]^1 You need more BM Credits to buy^3 %d XP!", prefix, get_pcvar_num(xpamount) )
			}
		}
		case 10: // Respawn
		{
			if(is_user_alive(id)) {
				ColorChat( id, NORMAL, "^4[%s]^1 You cannot buy a^3 Respawn^4 while you are alive.", prefix );
				return PLUGIN_HANDLED;
			}
			if( bm_points[id] >= get_pcvar_num(respawncost) ) {
				bm_points[id] -= get_pcvar_num(respawncost)
				ExecuteHamB(Ham_CS_RoundRespawn, id);
				new respawnname[42]
				get_user_name(id, respawnname, 32)
				set_hudmessage(255, 255, 255, -1.0, -1.0, 0, 6.0, 4.0)
				show_hudmessage(0, "%s bought a respawn! Kill him!", respawnname)
				userrespawn[id]++;
				ColorChat( id, NORMAL, "^4[%s]^1 You've bought a^3 Respawn!", prefix )
				} else {
				ColorChat( id, NORMAL, "^4[%s]^1 You need more BM Credits to buy a^3 Respawn!", prefix )
			}
		}
		
	}
	
	menu_destroy( shop );
	return PLUGIN_HANDLED;
}
// Anti-Flash - Start
public flash() {
	new Float:gametime = get_gametime();
	if(gametime - g_gametime2 > 2.5)
		for(new i = 0; i < 32; i++)
		grenade[i] = 0;
}

public eventFlash( id ) {
	new Float:gametime = get_gametime();
	if(gametime != g_gametime) { 
		g_owner = get_grenade_owner();
		g_gametime = gametime;
		for(new i = 0; i < 33; i++) 
			g_track[i] = false;
		g_track_enemy = false;
	}    
	if(is_user_connected(g_owner) && usernoflash[id] > 0) {
		g_track_enemy = true;
		
		message_begin(MSG_ONE, g_msgScreenFade, {0,0,0}, id);
		write_short(1);
		write_short(1);
		write_short(1);
		write_byte(0);
		write_byte(0);
		write_byte(0);
		write_byte(255);
		message_end();
	}
}
public flash_delay() {
	if(g_track_enemy == false) {
		for(new i = 0; i < 33; i++) {
			if(g_track[i] == true && is_user_connected(i)) {
				message_begin(MSG_ONE, g_msgScreenFade, {0,0,0}, i) ;
				write_short(1);
				write_short(1);
				write_short(1);
				write_byte(0);
				write_byte(0);
				write_byte(0);
				write_byte(255);
				message_end();
			}
		}
	}
}

public grenade_throw() {
	if(g_sync_check_data == 0)
		return PLUGIN_CONTINUE;
	g_sync_check_data--;
	if(read_datanum() < 2)
		return PLUGIN_HANDLED_MAIN;
	
	if(read_data(1) == 11 && (read_data(2) == 0 || read_data(2) == 1))
		add_grenade_owner(last);
	
	return PLUGIN_CONTINUE;
}
public fire_in_the_hole() {
	new name[32];
	read_data(3, name, 31);
	new temp_last = get_user_index(name);
	new junk;
	if((temp_last == 0) || (!is_user_connected(temp_last)))
		return PLUGIN_CONTINUE;
	if(get_user_weapon(temp_last,junk,junk) == CSW_FLASHBANG) {
		last = temp_last;
		g_sync_check_data = 2; 
	}
	return PLUGIN_CONTINUE;
}

public fire_in_the_hole2() {
	new name[32];
	read_data(4, name, 31);
	new temp_last = get_user_index(name);
	new junk;
	if((temp_last == 0) || (!is_user_connected(temp_last)))
		return PLUGIN_CONTINUE;
	if(get_user_weapon(temp_last,junk,junk) == CSW_FLASHBANG) {    
		last = temp_last;
		g_sync_check_data = 2;
	}
	return PLUGIN_CONTINUE;
}
add_grenade_owner(owner) {
	new Float:gametime = get_gametime();
	g_gametime2 = gametime;
	for(new i = 0; i < 32; i++) {
		if(grenade[i] == 0) {
			grenade[i] = owner;
			return;
		}
	}
}
get_grenade_owner() {
	new which = grenade[0];
	for(new i = 1; i < 32; i++)  
		grenade[i-1] = grenade[i];
	grenade[31] = 0;
	return which;
}

// from XxAvalanchexX "Flashbang Dynamic Light"
public fw_emitsound(entity,channel,const sample[],Float:volume,Float:attenuation,fFlags,pitch) {
	if(!equali(sample,"weapons/flashbang-1.wav") && !equali(sample,"weapons/flashbang-2.wav"))
		return FMRES_IGNORED;
	
	new Float:gametime = get_gametime();
	
	//in case no one got flashed, the sound happens after all the flashes, same game time
	if(gametime != g_gametime) {
		g_owner = get_grenade_owner();
		return FMRES_IGNORED;
	}
	return FMRES_IGNORED;
}
// NoFlash Blinding - End 

// Cmd Give/Take BM Points
public cmd_give_bmpoints(id, level,cid) {
	if(!cmd_access (id, level, cid, 3))
		return PLUGIN_HANDLED;
	
	new target[32], amount[32], reason[32]
	
	read_argv(1, target, charsmax(target))
	read_argv(2, amount, charsmax(amount))
	read_argv(3, reason, charsmax(reason))
	
	new player = cmd_target(id, target, 8)
	
	if( ! player ) 
		return PLUGIN_HANDLED;
	
	new admin_name[32], target_name[32]
	get_user_name(id, admin_name, charsmax(admin_name))
	get_user_name(player, target_name, charsmax(target_name))
	
	new points = str_to_num(amount)
	
	bm_points[player] += points
	ColorChat(player, GREY, "^4[%s]^1 ADMIN:^4 %s^1 gave you^3 %s ^4 %i BM Credits^1. Now you have:^4 %d BM Credits!",prefix, admin_name, target_name, points, bm_points[player])
	SaveData(id)
	
	return PLUGIN_CONTINUE;
}

public cmd_take_bmpoints(id, level,cid) {
	if(!cmd_access (id, level, cid, 3))
		return PLUGIN_HANDLED;
	
	new target[32], amount[32], reason[32]
	
	read_argv(1, target, charsmax(target))
	read_argv(2, amount, charsmax(amount))
	read_argv(3, reason, charsmax(reason))
	
	new player = cmd_target(id, target, 8)
	
	if(!player) 
		return PLUGIN_HANDLED;
	
	new admin_name[32], target_name[32]
	get_user_name(id, admin_name, charsmax(admin_name))
	get_user_name(player, target_name, charsmax(target_name))
	
	new points = str_to_num(amount)
	
	if(bm_points[player] < points) {
		console_print(id, "Player %s doesn't even have %d BM Points! He has: %d BM Points.", target_name, points, bm_points[player])
		return PLUGIN_HANDLED
	}
	bm_points[player] -= points
	ColorChat(player, TEAM_COLOR, "^4[%s]^1 ADMIN:^4 %s^1 took from you^3 %s ^4 %i BM Credits^1. Now you have:^4 %d BM Credits^1!", prefix, admin_name, target_name, points, bm_points[player])
	SaveData(id)
	
	return PLUGIN_CONTINUE;
}
public cmd_give_bmpoints_all(id, level, cid) {
	if(!cmd_access(id, level, cid, 2))
		return PLUGIN_HANDLED
	
	new amount[32]
	
	read_argv(1, amount, charsmax(amount))
	
	new admin_name[32]
	get_user_name(id, admin_name, charsmax(admin_name))
	
	new points = str_to_num(amount)
	
	new players[32], num
	get_players(players, num, "ch")
	
	for(new i; i < num; i++)
		bm_points[players[i]] += points
	
	ColorChat(0,NORMAL, "^4[%s]^1 ADMIN ^4%s: ^1gave ^4%i^1 BM Credits to ^4all ^1players", prefix, admin_name, points)
	SaveData(id)
	
	return PLUGIN_CONTINUE
}

// Nvault
public SaveData(id) {
	new name[32]
	get_user_name(id, name, charsmax(name))
	new vaultkey[64], vaultdata[256]
	
	format(vaultkey, charsmax(vaultkey), "%s", name)
	format(vaultdata, charsmax(vaultdata), "%i", bm_points[id])
	nvault_set(g_vault, vaultkey, vaultdata)
	
	return PLUGIN_CONTINUE
}

LoadData(id) {
	new name[32]
	get_user_name(id, name, charsmax(name))
	new vaultkey[64], vaultdata[256]
	
	format(vaultkey, charsmax(vaultkey), "%s", name)
	format(vaultdata, charsmax(vaultdata), "%i", bm_points[id])
	nvault_get(g_vault, vaultkey, vaultdata, charsmax(vaultdata))
	
	new points_user[10]
	parse(vaultdata, points_user, charsmax(points_user))
	
	new points_set = str_to_num(points_user)
	bm_points[id] = points_set
	
	return PLUGIN_CONTINUE
}
XP Plugin:

Код за потвърждение: Избери целия код

// =================================================
// BEGIN EDITING HERE
// =================================================

// Should the plugin save player data in SQL database?
// To save player data in a vault, change "#define USING_SQL" to "//#define USING_SQL"
// To save player data in SQL, change "//#define USING_SQL" to "#define USING_SQL"

//#define USING_SQL

// The prefix in all of the plugin's messages

new const MESSAGE_TAG[] =        "[HNS XP]";

// If the player hasn't ever been to your server, they will get this much xp to start with

#define ENTRY_XP            100

// These determine if these abilities should be enabled or disabled
// 1 = enabled
// 0 = disabled

#define ENABLE_GRENADE            1
#define ENABLE_FLASHBANG_1        1
#define ENABLE_FLASHBANG_2        1
#define ENABLE_SMOKEGRENADE        1
#define ENABLE_TERR_HEALTH        1
#define ENABLE_CT_HEALTH        1
#define ENABLE_TERR_ARMOR        1
#define ENABLE_CT_ARMOR            1
#define ENABLE_TERR_RESPAWN        1
#define ENABLE_CT_RESPAWN        1
#define ENABLE_TERR_NOFALL        1
#define ENABLE_CT_NOFALL        1

// The maximum level for each ability

#define MAXLEVEL_GRENADE        8
#define MAXLEVEL_FLASHBANG_1        4
#define MAXLEVEL_FLASHBANG_2        4
#define MAXLEVEL_SMOKEGRENADE        4
#define MAXLEVEL_TERR_HEALTH        10
#define MAXLEVEL_CT_HEALTH        5
#define MAXLEVEL_TERR_ARMOR        8
#define MAXLEVEL_CT_ARMOR        6
#define MAXLEVEL_TERR_RESPAWN        2
#define MAXLEVEL_CT_RESPAWN        2
#define MAXLEVEL_TERR_NOFALL        8
#define MAXLEVEL_CT_NOFALL        8

// The xp amount required to buy the first level

#define FIRST_XP_GRENADE        100
#define FIRST_XP_FLASHBANG_1        100
#define FIRST_XP_FLASHBANG_2        100
#define FIRST_XP_SMOKEGRENADE        100
#define FIRST_XP_TERR_HEALTH        100
#define FIRST_XP_CT_HEALTH        100
#define FIRST_XP_TERR_ARMOR        100
#define FIRST_XP_CT_ARMOR        100
#define FIRST_XP_TERR_RESPAWN        1000
#define FIRST_XP_CT_RESPAWN        2000
#define FIRST_XP_TERR_NOFALL        100
#define FIRST_XP_CT_NOFALL        100

// The maximum chance possible for this ability (happens when player has maximum level)

#define CHANCE_MAX_GRENADE        100
#define CHANCE_MAX_FLASHBANG_1        100
#define CHANCE_MAX_FLASHBANG_2        100
#define CHANCE_MAX_SMOKEGRENADE        100
#define CHANCE_MAX_TERR_RESPAWN        50
#define CHANCE_MAX_CT_RESPAWN        50
#define CHANCE_MAX_TERR_NOFALL        80
#define CHANCE_MAX_CT_NOFALL        80

// =================================================
// STOP EDITING HERE
// =================================================


#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fun>
#include <regex>
#include <hlsdk_const>

#if defined USING_SQL
#include <sqlx>

new Handle:g_sql_tuple;
#else
#include <nvault>

new g_vault;
#endif


new const VERSION[] =    "0.0.1";


#pragma semicolon 1

enum _:Grenades
{
    NADE_HE,
    NADE_FL1,
    NADE_FL2,
    NADE_SM
};

new const g_nade_enabled[Grenades] =
{
    ENABLE_GRENADE,
    ENABLE_FLASHBANG_1,
    ENABLE_FLASHBANG_2,
    ENABLE_SMOKEGRENADE
};

new const g_any_nade_enabled = ENABLE_GRENADE + ENABLE_FLASHBANG_1 + ENABLE_FLASHBANG_2 + ENABLE_SMOKEGRENADE;

new const g_nade_names[Grenades][] =
{
    "HE Grenade",
    "Flashbang #1",
    "Flashbang #2",
    "Frost Nade"
};

new const g_nade_classnames[Grenades][] =
{
    "weapon_hegrenade",
    "weapon_flashbang",
    "weapon_flashbang",
    "weapon_smokegrenade"
};

new const g_nade_maxlevels[Grenades] =
{
    MAXLEVEL_GRENADE,
    MAXLEVEL_FLASHBANG_1,
    MAXLEVEL_FLASHBANG_2,
    MAXLEVEL_SMOKEGRENADE
};

new const g_nade_first_xp[Grenades] =
{
    FIRST_XP_GRENADE,
    FIRST_XP_FLASHBANG_1,
    FIRST_XP_FLASHBANG_2,
    FIRST_XP_SMOKEGRENADE
};

new const g_nade_max_chance[Grenades] =
{
    CHANCE_MAX_GRENADE,
    CHANCE_MAX_FLASHBANG_1,
    CHANCE_MAX_FLASHBANG_2,
    CHANCE_MAX_SMOKEGRENADE
};

new const g_team_names[CsTeams][] =
{
    "Spectator",
    "Terrorist",
    "Counter-Terrorist",
    "Spectator"
};

new const g_health_enabled[CsTeams] =
{
    0,
    ENABLE_TERR_HEALTH,
    ENABLE_CT_HEALTH,
    0
};

new const g_any_health_enabled = ENABLE_TERR_HEALTH + ENABLE_CT_HEALTH;

new const g_health_names[CsTeams][] =
{
    "",
    "T Extra Health",
    "CT Extra Health",
    ""
};

new const g_health_maxamount[CsTeams] =
{
    0,
    100,
    50,
    0
};

new const g_health_maxlevels[CsTeams] =
{
    0,
    MAXLEVEL_TERR_HEALTH,
    MAXLEVEL_CT_HEALTH,
    0
};

new const g_health_first_xp[CsTeams] =
{
    0,
    FIRST_XP_TERR_HEALTH,
    FIRST_XP_CT_HEALTH,
    0
};

new const g_armor_enabled[CsTeams] =
{
    0,
    ENABLE_TERR_ARMOR,
    ENABLE_CT_ARMOR,
    0
};

new const g_any_armor_enabled = ENABLE_TERR_ARMOR + ENABLE_CT_ARMOR;

new const g_armor_names[CsTeams][] =
{
    "",
    "T Armor",
    "CT Armor",
    ""
};

new const g_armor_maxamount[CsTeams] =
{
    0,
    200,
    150,
    0
};

new const g_armor_maxlevels[CsTeams] =
{
    0,
    MAXLEVEL_TERR_ARMOR,
    MAXLEVEL_CT_ARMOR,
    0
};

new const g_armor_first_xp[CsTeams] =
{
    0,
    FIRST_XP_TERR_ARMOR,
    FIRST_XP_CT_ARMOR,
    0
};

new const g_respawn_enabled[CsTeams] =
{
    0,
    ENABLE_TERR_RESPAWN,
    ENABLE_CT_RESPAWN,
    0
};

new const g_any_respawn_enabled = ENABLE_TERR_RESPAWN + ENABLE_CT_RESPAWN;

new const g_respawn_names[CsTeams][] =
{
    "",
    "T Respawn Chance",
    "CT Respawn Chance",
    ""
};

new const g_respawn_maxlevels[CsTeams] =
{
    0,
    MAXLEVEL_TERR_RESPAWN,
    MAXLEVEL_CT_RESPAWN,
    0
};

new const g_respawn_first_xp[CsTeams] =
{
    0,
    FIRST_XP_TERR_RESPAWN,
    FIRST_XP_CT_RESPAWN,
    0
};

new const g_respawn_max_chance[CsTeams] =
{
    0,
    CHANCE_MAX_TERR_RESPAWN,
    CHANCE_MAX_CT_RESPAWN,
    0
};

new const g_nofall_enabled[CsTeams] =
{
    0,
    ENABLE_TERR_NOFALL,
    ENABLE_CT_NOFALL,
    0
};

new const g_any_nofall_enabled = ENABLE_TERR_NOFALL + ENABLE_CT_NOFALL;

new const g_nofall_names[CsTeams][] =
{
    "",
    "T Fall Damage Reducer",
    "CT Fall Damage Reducer",
    ""
};

new const g_nofall_maxlevels[CsTeams] =
{
    0,
    MAXLEVEL_TERR_NOFALL,
    MAXLEVEL_CT_NOFALL,
    0
};

new const g_nofall_first_xp[CsTeams] =
{
    0,
    FIRST_XP_TERR_NOFALL,
    FIRST_XP_CT_NOFALL,
    0
};

new const g_nofall_max_chance[CsTeams] =
{
    0,
    CHANCE_MAX_TERR_NOFALL,
    CHANCE_MAX_CT_NOFALL,
    0
};

#define ANY_ABILITY_ENABLED (g_any_nade_enabled || g_any_health_enabled || g_any_armor_enabled || g_any_respawn_enabled || g_any_nofall_enabled)

new g_authid[33][35];

new g_xp[33];

new g_first_time[33];
#if defined USING_SQL
new g_loaded_data[33];
#endif

new g_used_revive[33];

new g_nade_level[33][Grenades];
new g_armor_level[33][CsTeams];
new g_respawn_level[33][CsTeams];
new g_health_level[33][CsTeams];
new g_nofall_level[33][CsTeams];

new cvar_xp_suicide;
new cvar_xp_kill;
new cvar_xp_headshot;
new cvar_xp_grenade;
new cvar_xp_survive;
new cvar_xp_win;
new cvar_spawn_nade_delay;

new Float:g_nade_give_time;

new Regex:g_SteamID_pattern;
new g_regex_return;

new g_first_client;
new g_max_clients;

new g_msgid_SayText;

#if defined USING_SQL
public plugin_precache()
{
    g_sql_tuple = SQL_MakeStdTuple();
    
    SQL_ThreadQuery(g_sql_tuple, "QueryCreateTable", "CREATE TABLE IF NOT EXISTS `hns_xp` ( `name` VARCHAR(32) NOT NULL, `authid` VARCHAR(35) NOT NULL, `data` VARCHAR(256) NOT NULL );" );
}

public QueryCreateTable(failstate, Handle:query, error[], errnum, data[], size, Float:queuetime)
{
    if( failstate == TQUERY_CONNECT_FAILED
    || failstate == TQUERY_QUERY_FAILED )
    {
        set_fail_state(error);
    }
}
#endif

public plugin_init()
{
    register_plugin("HideNSeek XP Mod", VERSION, "Exolent");
    register_cvar("hnsxp_author", "Exolent", FCVAR_SPONLY);
    register_cvar("hnsxp_version", VERSION, FCVAR_SPONLY);
    
    register_clcmd("say /xp", "CmdMainMenu");
    register_clcmd("say /exp", "CmdMainMenu");
    
    register_concmd("hnsxp_give_xp", "CmdGiveXP", ADMIN_RCON, "<nick, #userid, authid> <xp>");
    register_concmd("hnsxp_remove_xp", "CmdRemoveXP", ADMIN_RCON, "<nick, #userid, authid> <xp>");
    
    register_event("HLTV", "EventNewRound", "a", "1=0", "2=0");
    register_event("DeathMsg", "EventDeathMsg", "a");
    register_logevent("EventRoundStart", 2, "1=Round_Start");
    register_logevent("EventRoundEnd", 2, "1=Round_End");
    register_event("TextMsg", "EventRoundRestart", "a", "2&#Game_C", "2&#Game_w");
    
    RegisterHam(Ham_Spawn, "player", "FwdPlayerSpawn", 1);
    RegisterHam(Ham_Killed, "player", "FwdPlayerDeath", 1);
    RegisterHam(Ham_TakeDamage, "player", "FwdPlayerDamage");
    
    cvar_xp_suicide = register_cvar("hnsxp_xp_suicide", "5");
    cvar_xp_kill = register_cvar("hnsxp_xp_kill", "4");
    cvar_xp_headshot = register_cvar("hnsxp_xp_headshot", "3");
    cvar_xp_grenade = register_cvar("hnsxp_xp_grenade", "6");
    cvar_xp_survive = register_cvar("hnsxp_xp_survive", "2");
    cvar_xp_win = register_cvar("hnsxp_xp_win", "3");
    cvar_spawn_nade_delay = register_cvar("hnsxp_spawn_nade_delay", "10");
    
    #if !defined USING_SQL
    g_vault = nvault_open("hnsxp");
    #endif
    
    new err[2];
    g_SteamID_pattern = regex_compile("^^STEAM_0:(0|1):\d+$", g_regex_return, err, sizeof(err) - 1);
    
    g_first_client = 1;
    g_max_clients = get_maxplayers();
    
    g_msgid_SayText = get_user_msgid("SayText");
}

#if !defined USING_SQL
public plugin_end()
{
    nvault_close(g_vault);
}
#endif

public plugin_natives()
{
    register_library("hns_xp");
    register_native("hnsxp_get_user_xp", "_get_xp");
    register_native("hnsxp_set_user_xp", "_set_xp");
}

public _get_xp(plugin, params)
{
    return g_xp[get_param(1)];
}

public _set_xp(plugin, params)
{
    new client = get_param(1);
    g_xp[client] = max(0, get_param(2));
    Save(client);
    return g_xp[client];
}

public client_authorized(client)
{
    if( !is_user_bot(client) && !is_user_hltv(client) )
    {
        /* is this still called in LAN, non-steam, etc? */
        get_user_authid(client, g_authid[client], sizeof(g_authid[]) - 1);
        
        if( !IsValidAuthid(g_authid[client]) )
        {
            g_authid[client][0] = 0;
        }
        else
        {
            Load(client);
        }
    }
}

public client_disconnect(client)
{
    Save(client);
    
    g_authid[client][0] = 0;
    g_first_time[client] = 0;
    #if defined USING_SQL
    g_loaded_data[client] = 0;
    #endif
    g_used_revive[client] = 0;
}

public CmdMainMenu(client)
{
    ShowMainMenu(client);
}

public CmdGiveXP(client, level, cid)
{
    if( !cmd_access(client, level, cid, 3) ) return PLUGIN_HANDLED;
    
    static arg[35];
    read_argv(1, arg, sizeof(arg) - 1);
    
    new target = cmd_target(client, arg, CMDTARGET_OBEY_IMMUNITY|CMDTARGET_NO_BOTS);
    if( !target ) return PLUGIN_HANDLED;
    
    if( !IsUserAuthorized(target) )
    {
        console_print(client, "Target has not authorized with the server.");
        return PLUGIN_HANDLED;
    }
    
    read_argv(2, arg, sizeof(arg) - 1);
    new xp = str_to_num(arg);
    
    if( xp <= 0 )
    {
        console_print(client, "XP must be a value greater than 0!");
        if( xp < 0 )
        {
            console_print(client, "Use hnsxp_remove_xp instead.");
        }
        return PLUGIN_HANDLED;
    }
    
    g_xp[target] += xp;
    
    Save(target);
    
    static name[2][32];
    get_user_name(client, name[0], sizeof(name[]) - 1);
    get_user_name(target, name[1], sizeof(name[]) - 1);
    
    Print(0, "%s gave %i XP to %s.", name[0], xp, name[1]);
    
    static steamid[2][35];
    get_user_authid(client, steamid[0], sizeof(steamid[]) - 1);
    get_user_authid(target, steamid[1], sizeof(steamid[]) - 1);
    
    log_amx("%s (%s) gave %i XP to %s (%s)", name[0], steamid[0], xp, name[1], steamid[1]);
    
    return PLUGIN_HANDLED;
}

public CmdRemoveXP(client, level, cid)
{
    if( !cmd_access(client, level, cid, 3) ) return PLUGIN_HANDLED;
    
    static arg[35];
    read_argv(1, arg, sizeof(arg) - 1);
    
    new target = cmd_target(client, arg, CMDTARGET_OBEY_IMMUNITY|CMDTARGET_NO_BOTS);
    if( !target ) return PLUGIN_HANDLED;
    
    if( !IsUserAuthorized(target) )
    {
        console_print(client, "Target has not authorized with the server.");
        return PLUGIN_HANDLED;
    }
    
    read_argv(2, arg, sizeof(arg) - 1);
    new xp = str_to_num(arg);
    
    if( xp <= 0 )
    {
        console_print(client, "XP must be a value greater than 0!");
        if( xp < 0 )
        {
            console_print(client, "Use hnsxp_give_xp instead.");
        }
        return PLUGIN_HANDLED;
    }
    
    g_xp[target] -= xp;
    
    Save(target);
    
    static name[2][32];
    get_user_name(client, name[0], sizeof(name[]) - 1);
    get_user_name(target, name[1], sizeof(name[]) - 1);
    
    Print(0, "%s removed %i XP from %s.", name[0], xp, name[1]);
    
    static steamid[2][35];
    get_user_authid(client, steamid[0], sizeof(steamid[]) - 1);
    get_user_authid(target, steamid[1], sizeof(steamid[]) - 1);
    
    log_amx("%s (%s) removed %i XP from %s (%s)", name[0], steamid[0], xp, name[1], steamid[1]);
    
    return PLUGIN_HANDLED;
}

public EventNewRound()
{
    arrayset(g_used_revive, 0, sizeof(g_used_revive));
    
    g_nade_give_time = 9999999.9;
}

public EventDeathMsg()
{
    new killer = read_data(1);
    new victim = read_data(2);
    
    if( (g_first_client <= killer <= g_max_clients) && victim != killer )
    {
        if( IsUserAuthorized(killer) )
        {
            // regular kill
            new xp = get_pcvar_num(cvar_xp_kill);
            
            if( read_data(3) )
            {
                // headshot kill
                xp += get_pcvar_num(cvar_xp_headshot);
            }
            else
            {
                static weapon[20];
                read_data(4, weapon, sizeof(weapon) - 1);
                
                if( contain(weapon, "grenade") >= 0 )
                {
                    // grenade kill (or frostnade)
                    xp += get_pcvar_num(cvar_xp_grenade);
                }
            }
            
            g_xp[killer] += xp;
            
            Print(killer, "You gained %i XP!", xp);
            
            Save(killer);
        }
    }
    else if( IsUserAuthorized(victim) )
    {
        // victim died of map causes or killed self
        new xp = get_pcvar_num(cvar_xp_suicide);
        
        g_xp[victim] -= xp;
        
        Print(victim, "You lost %i XP!", xp);
        
        Save(victim);
    }
}

public EventRoundStart()
{
    g_nade_give_time = get_pcvar_float(cvar_spawn_nade_delay);
    
    set_task(g_nade_give_time, "TaskGiveNades", 1234);
    
    g_nade_give_time += get_gametime();
}

public EventRoundEnd()
{
    EventRoundRestart();
    
    new hider, seeker, hider_alive;
    
    for( new i = g_first_client; i <= g_max_clients; i++ )
    {
        if( is_user_connected(i) )
        {
            switch( cs_get_user_team(i) )
            {
                case CS_TEAM_CT:
                {
                    if( !seeker )
                    {
                        seeker = i;
                    }
                }
                case CS_TEAM_T:
                {
                    if( !hider )
                    {
                        hider = i;
                        
                        if( !hider_alive && is_user_alive(i) )
                        {
                            hider_alive = i;
                        }
                    }
                }
            }
            
            if( seeker && hider && hider_alive )
            {
                break;
            }
        }
    }
    
    if( !hider || !seeker )
    {
        return;
    }
    
    new CsTeams:winner = CS_TEAM_CT;
    
    if( hider_alive )
    {
        winner = CS_TEAM_T;
        
        new survive = get_pcvar_num(cvar_xp_survive);
        for( new client = g_first_client; client <= g_max_clients; client++ )
        {
            if( IsUserAuthorized(client) && is_user_alive(client) && cs_get_user_team(client) == CS_TEAM_T )
            {
                g_xp[client] += survive;
                Save(client);
                
                Print(client, "You gained %i XP for surviving!", survive);
            }
        }
    }
    
    new win = get_pcvar_num(cvar_xp_win);
    for( new client = g_first_client; client <= g_max_clients; client++ )
    {
        if( IsUserAuthorized(client) && is_user_alive(client) && cs_get_user_team(client) == winner )
        {
            g_xp[client] += win;
            Save(client);
            
            Print(client, "You gained %i XP for winning the round!", win);
        }
    }
}

public EventRoundRestart()
{
    remove_task(1234);
    
    g_nade_give_time = 9999999.9;
}

public FwdPlayerSpawn(client)
{
    if( is_user_alive(client) )
    {
        new CsTeams:team = cs_get_user_team(client);
        if( team == CS_TEAM_T || team == CS_TEAM_CT )
        {
            if( g_first_time[client] )
            {
                Print(client, "It is your first time playing this HideNSeek XP mod, so you are rewarded with %i XP!", ENTRY_XP);
                Print(client, "You earn XP based upon your gameplay, and you can buy more levels in the menu.");
                Print(client, "Type /xp to view what you can get!");
                
                g_first_time[client] = 0;
            }
            else
            {
                if( g_health_enabled[team] )
                {
                    new health = g_health_maxamount[team] * g_health_level[client][team] / g_health_maxlevels[team];
                    if( health > 0 )
                    {
                        set_user_health(client, get_user_health(client) + health);
                    }
                }
                
                if( g_armor_enabled[team] )
                {
                    new armorvalue = g_armor_maxamount[team] * g_armor_level[client][team] / g_armor_maxlevels[team];
                    if( armorvalue == 0 )
                    {
                        cs_set_user_armor(client, armorvalue, CS_ARMOR_NONE);
                    }
                    else if( armorvalue < 100 )
                    {
                        cs_set_user_armor(client, armorvalue, CS_ARMOR_KEVLAR);
                    }
                    else
                    {
                        cs_set_user_armor(client, armorvalue, CS_ARMOR_VESTHELM);
                    }
                }
            }
            
            if( get_gametime() >= g_nade_give_time )
            {
                GiveNades(client);
            }
        }
    }
}

public FwdPlayerDeath(client, killer, shouldgib)
{
    if( !g_used_revive[client] )
    {
        new CsTeams:team = cs_get_user_team(client);
        if( team == CS_TEAM_T || team == CS_TEAM_CT )
        {
            if( g_respawn_enabled[team] )
            {
                new percent = g_respawn_max_chance[team] * g_respawn_level[client][team] / g_respawn_maxlevels[team];
                if( random_num(1, 100) <= percent )
                {
                    if( HasTeammateAlive(client, team) )
                    {
                        set_task(0.5, "TaskRespawn", client);
                        
                        Print(client, "You have been respawned! (%i%% chance)", percent);
                        
                        g_used_revive[client] = 1;
                    }
                }
            }
        }
    }
}

public FwdPlayerDamage(client, inflictor, attacker, Float:damage, damagebits)
{
    if( is_user_alive(client) && (damagebits & DMG_FALL) )
    {
        new CsTeams:team = cs_get_user_team(client);
        if( team == CS_TEAM_T || team == CS_TEAM_CT )
        {
            if( g_nofall_enabled[team] )
            {
                new percent = g_nofall_max_chance[team] * g_nofall_level[client][team] / g_nofall_maxlevels[team];
                SetHamParamFloat(4, damage * (1.0 - (float(percent) / 100.0)));
            }
        }
    }
}

public TaskRespawn(client)
{
    ExecuteHamB(Ham_CS_RoundRespawn, client);
}

public TaskGiveNades()
{
    for( new client = g_first_client; client <= g_max_clients; client++ )
    {
        if( is_user_alive(client) )
        {
            GiveNades(client);
        }
    }
}

HasTeammateAlive(client, CsTeams:team)
{
    for( new i = g_first_client; i <= g_max_clients; i++ )
    {
        if( i == client ) continue;
        
        if( is_user_alive(i) && cs_get_user_team(i) == team )
        {
            return 1;
        }
    }
    
    return 0;
}

GiveNades(client)
{
    new CsTeams:team = cs_get_user_team(client);
    
    if( team == CS_TEAM_T )
    {
        static percent;
        for( new i = 0; i < Grenades; i++ )
        {
            if( g_nade_enabled[i] )
            {
                percent = g_nade_max_chance[i] * g_nade_level[client][i] / g_nade_maxlevels[i];
                if( percent > 0 && (percent == 100 || random_num(1, 100) <= percent) )
                {
                    give_item(client, g_nade_classnames[i]);
                    
                    if( percent < 100 )
                    {
                        Print(client, "You received your %s! (%i%% chance)", g_nade_names[i], percent);
                    }
                }
            }
        }
    }
}

ShowMainMenu(client)
{
    static title[128];
    formatex(title, sizeof(title) - 1, "[HNS XP by Exolent]^nMain Menu^n^nYour XP: \w%i", g_xp[client]);
    new menu = menu_create(title, "MenuMain");
    
    menu_additem(menu, "\yHelp", "*");
    if( g_any_nade_enabled )
    {
        menu_additem(menu, "Grenades Menu", "1");
    }
    if( g_any_health_enabled )
    {
        menu_additem(menu, "Health Menu", "2");
    }
    if( g_any_armor_enabled )
    {
        menu_additem(menu, "Armor Menu", "3");
    }
    if( g_any_respawn_enabled )
    {
        menu_additem(menu, "Respawn Menu", "4");
    }
    if( g_any_nofall_enabled )
    {
        menu_additem(menu, "Fall Damage Menu^n", "5");
    }
    if( ANY_ABILITY_ENABLED )
    {
        menu_additem(menu, "Player Info", "6");
    }
    
    menu_display(client, menu);
}

public MenuMain(client, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        return;
    }
    
    static _access, info[4], callback;
    menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
    menu_destroy(menu);
    
    switch( info[0] )
    {
        case '*':
        {
            static motd[2500];
            new len = formatex(motd, sizeof(motd) - 1,    "<body style=^"background-color:#030303; color:#FF8F00^">");
            len += format(motd[len], sizeof(motd) - len - 1,    "<p align=^"center^">");
            len += format(motd[len], sizeof(motd) - len - 1,    "HideNSeek XP Mod is an experienced based addon for HideNSeek.<br>");
            len += format(motd[len], sizeof(motd) - len - 1,    "Players earn experience points by how well they play the game.<br>");
            len += format(motd[len], sizeof(motd) - len - 1,    "<br>");
            len += format(motd[len], sizeof(motd) - len - 1,    "<table border=0>");
            len += format(motd[len], sizeof(motd) - len - 1,    "<tr><th>Action</th><th>XP</th></tr>");
            len += format(motd[len], sizeof(motd) - len - 1,    "<tr><td>Kill</td><td>+%i</td></tr>", get_pcvar_num(cvar_xp_kill));
            len += format(motd[len], sizeof(motd) - len - 1,    "<tr><td>Grenade</td><td>+%i</td></tr>", get_pcvar_num(cvar_xp_grenade));
            len += format(motd[len], sizeof(motd) - len - 1,    "<tr><td>Headshot</td><td>+%i</td></tr>", get_pcvar_num(cvar_xp_headshot));
            len += format(motd[len], sizeof(motd) - len - 1,    "<tr><td>Suicide</td><td>-%i</td></tr>", get_pcvar_num(cvar_xp_suicide));
            len += format(motd[len], sizeof(motd) - len - 1,    "<tr><td>Survive as a T</td><td>+%i</td></tr>", get_pcvar_num(cvar_xp_survive));
            len += format(motd[len], sizeof(motd) - len - 1,    "<tr><td>Win Round</td><td>+%i</td></tr>", get_pcvar_num(cvar_xp_win));
            len += format(motd[len], sizeof(motd) - len - 1,    "</table>");
            len += format(motd[len], sizeof(motd) - len - 1,    "With these XP points, you can buy upgrades.<br>");
            len += format(motd[len], sizeof(motd) - len - 1,    "For a list of these upgrades, type /xp again and view the other menus inside.");
            len += format(motd[len], sizeof(motd) - len - 1,    "</p>");
            len += format(motd[len], sizeof(motd) - len - 1,    "</body>");
            
            show_motd(client, motd, "HideNSeek XP Mod Info");
        }
        case '1':
        {
            ShowGrenadesMenu(client);
        }
        case '2':
        {
            ShowHealthMenu(client);
        }
        case '3':
        {
            ShowArmorMenu(client);
        }
        case '4':
        {
            ShowRespawnMenu(client);
        }
        case '5':
        {
            ShowNoFallMenu(client);
        }
        case '6':
        {
            ShowPlayerMenu(client);
        }
    }
}

ShowGrenadesMenu(client)
{
    static title[128];
    formatex(title, sizeof(title) - 1, "[HNS XP by Exolent]^nGrenades Menu^n^nNote: \wGrenade abilities are for \rT's Only!\y^n^nYour XP: \w%i", g_xp[client]);
    new menu = menu_create(title, "MenuGrenades");
    new callback = menu_makecallback("CallbackGrenades");
    
    menu_additem(menu, "\yHelp", "*", _, callback);
    
    static level, xp, percent, item[128], info[4];
    for( new i = 0; i < Grenades; i++ )
    {
        if( g_nade_enabled[i] )
        {
            level = g_nade_level[client][i] + 1;
            percent = g_nade_max_chance[i] * level / g_nade_maxlevels[i];
            
            if( g_nade_level[client][i] < g_nade_maxlevels[i] )
            {
                xp = g_nade_first_xp[i] * (1 << (level - 1));
                formatex(item, sizeof(item) - 1, "%s: \yLevel %i (%i%%) \r[\w%i XP\r]", g_nade_names[i], level, percent, xp);
            }
            else
            {
                formatex(item, sizeof(item) - 1, "%s: \yLevel %i (%i%%) \r[\wMaxed Out!\r]", g_nade_names[i], level, percent);
            }
            
            num_to_str(i, info, sizeof(info) - 1);
            
            menu_additem(menu, item, info, _, callback);
        }
    }
    
    menu_display(client, menu);
}

public MenuGrenades(client, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        ShowMainMenu(client);
        return;
    }
    
    static _access, info[4], callback;
    menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
    menu_destroy(menu);
    
    if( info[0] == '*' )
    {
        static motd[2500];
        new len = formatex(motd, sizeof(motd) - 1,    "<body style=^"background-color:#030303; color:#FF8F00^">");
        len += format(motd[len], sizeof(motd) - len - 1,    "<p align=^"center^">");
        len += format(motd[len], sizeof(motd) - len - 1,    "The Grenades ability for the XP Mod is for Terrorists only.<br>");
        len += format(motd[len], sizeof(motd) - len - 1,    "The Grenades ability contains the HE Grenade, 2 Flashbangs, and Frost Nade.<br>");
        len += format(motd[len], sizeof(motd) - len - 1,    "These are the grenades you are given when you receive the your items after the hide timer ends.<br>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<br>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<table>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th></th>");
        for( new i = 0; i < Grenades; i++ )
        {
            if( g_nade_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<th>%s</th>", g_nade_names[i]);
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th>Chance Intervals</th>");
        for( new i = 0; i < Grenades; i++ )
        {
            if( g_nade_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<td>%i%%</td>", (g_nade_max_chance[i] / g_nade_maxlevels[i]));
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th>Max Level</th>");
        for( new i = 0; i < Grenades; i++ )
        {
            if( g_nade_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<td>%i</td>", g_nade_maxlevels[i]);
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th>Max Chance</th>");
        for( new i = 0; i < Grenades; i++ )
        {
            if( g_nade_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<td>%i%%</td>", g_nade_max_chance[i]);
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "</table>");
        len += format(motd[len], sizeof(motd) - len - 1,    "</p>");
        len += format(motd[len], sizeof(motd) - len - 1,    "</body>");
        
        show_motd(client, motd, "XP Grenades Info");
    }
    else
    {
        new upgrade = str_to_num(info);
        
        new level = g_nade_level[client][upgrade] + 1;
        new xp = g_nade_first_xp[upgrade] * (1 << (level - 1));
        new percent = g_nade_max_chance[upgrade] * level / g_nade_maxlevels[upgrade];
        
        g_xp[client] -= xp;
        g_nade_level[client][upgrade] = level;
        
        Save(client);
        
        Print(client, "You bought %s Level %i (%i%%) for %i XP!", g_nade_names[upgrade], level, percent, xp);
    }
    
    ShowGrenadesMenu(client);
}

public CallbackGrenades(client, menu, item)
{
    static _access, info[4], callback;
    menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
    
    if( info[0] == '*' ) return ITEM_ENABLED;
    
    new upgrade = str_to_num(info);
    if( g_nade_level[client][upgrade] == g_nade_maxlevels[upgrade] )
    {
        return ITEM_DISABLED;
    }
    
    new xp = g_nade_first_xp[upgrade] * (1 << g_nade_level[client][upgrade]);
    if( g_xp[client] < xp )
    {
        return ITEM_DISABLED;
    }
    
    return ITEM_ENABLED;
}

ShowHealthMenu(client)
{
    static title[128];
    formatex(title, sizeof(title) - 1, "[HNS XP by Exolent]^nHealth Menu^n^nYour XP: \w%i", g_xp[client]);
    new menu = menu_create(title, "MenuHealth");
    new callback = menu_makecallback("CallbackHealth");
    
    menu_additem(menu, "\yHelp", "*", _, callback);
    
    static level, xp, amount, item[128], info[4];
    for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
    {
        if( g_health_enabled[i] )
        {
            level = g_health_level[client][i] + 1;
            amount = g_health_maxamount[i] * level / g_health_maxlevels[i];
            
            if( g_health_level[client][i] < g_health_maxlevels[i] )
            {
                xp = g_health_first_xp[i] * (1 << (level - 1));
                formatex(item, sizeof(item) - 1, "%s: \yLevel %i (%i HP) \r[\w%i XP\r]", g_health_names[i], level, amount, xp);
            }
            else
            {
                formatex(item, sizeof(item) - 1, "\w%s: \yLevel %i (%i HP) \r[\wMaxed Out!\r]", g_health_names[i], level, amount);
            }
            
            num_to_str(_:i, info, sizeof(info) - 1);
            
            menu_additem(menu, item, info, _, callback);
        }
    }
    
    menu_display(client, menu);
}

public MenuHealth(client, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        ShowMainMenu(client);
        return;
    }
    
    static _access, info[4], callback;
    menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
    menu_destroy(menu);
    
    if( info[0] == '*' )
    {
        static motd[2500];
        new len = formatex(motd, sizeof(motd) - 1,    "<body style=^"background-color:#030303; color:#FF8F00^">");
        len += format(motd[len], sizeof(motd) - len - 1,    "<p align=^"center^">");
        len += format(motd[len], sizeof(motd) - len - 1,    "The Health ability is the amount of HP that is added to your spawn health.<br>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<br>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<table>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th></th>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_health_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<th>%s</th>",g_team_names[i]);
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th>Health Intervals</th>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_health_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<td>%i</td>", (g_health_maxamount[i] / g_health_maxlevels[i]));
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th>Max Level</th>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_health_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<td>%i</td>", g_health_maxlevels[i]);
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th>Max Health</th>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_health_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<td>%i</td>", g_health_maxamount[i]);
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "</table>");
        len += format(motd[len], sizeof(motd) - len - 1,    "</p>");
        len += format(motd[len], sizeof(motd) - len - 1,    "</body>");
        
        show_motd(client, motd, "XP Health Info");
    }
    else
    {
        new CsTeams:upgrade = CsTeams:str_to_num(info);
        
        new level = g_health_level[client][upgrade] + 1;
        new xp = g_health_first_xp[upgrade] * (1 << (level - 1));
        new amount = g_health_maxamount[upgrade] * level / g_health_maxlevels[upgrade];
        
        g_xp[client] -= xp;
        g_health_level[client][upgrade] = level;
        
        Save(client);
        
        Print(client, "You bought %s Level %i (%i HP) for %i XP!", g_health_names[upgrade], level, amount, xp);
    }
    
    ShowHealthMenu(client);
}

public CallbackHealth(client, menu, item)
{
    static _access, info[4], callback;
    menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
    
    if( info[0] == '*' ) return ITEM_ENABLED;
    
    new CsTeams:upgrade = CsTeams:str_to_num(info);
    if( g_health_level[client][upgrade] == g_health_maxlevels[upgrade] )
    {
        return ITEM_DISABLED;
    }
    
    new xp = g_health_first_xp[upgrade] * (1 << g_health_level[client][upgrade]);
    if( g_xp[client] < xp )
    {
        return ITEM_DISABLED;
    }
    
    return ITEM_ENABLED;
}

ShowArmorMenu(client)
{
    static title[128];
    formatex(title, sizeof(title) - 1, "[HNS XP by Exolent]^nArmor Menu^n^nYour XP: \w%i", g_xp[client]);
    new menu = menu_create(title, "MenuArmor");
    new callback = menu_makecallback("CallbackArmor");
    
    menu_additem(menu, "\yHelp", "*", _, callback);
    
    static level, xp, amount, item[128], info[4];
    for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
    {
        if( g_armor_enabled[i] )
        {
            level = g_armor_level[client][i] + 1;
            amount = g_armor_maxamount[i] * level / g_armor_maxlevels[i];
            
            if( g_armor_level[client][i] < g_armor_maxlevels[i] )
            {
                xp = g_armor_first_xp[i] * (1 << (level - 1));
                formatex(item, sizeof(item) - 1, "%s: \yLevel %i (%i AP) \r[\w%i XP\r]", g_armor_names[i], level, amount, xp);
            }
            else
            {
                formatex(item, sizeof(item) - 1, "\w%s: \yLevel %i (%i AP) \r[\wMaxed Out!\r]", g_armor_names[i], level, amount);
            }
            
            num_to_str(_:i, info, sizeof(info) - 1);
            
            menu_additem(menu, item, info, _, callback);
        }
    }
    
    menu_display(client, menu);
}

public MenuArmor(client, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        ShowMainMenu(client);
        return;
    }
    
    static _access, info[4], callback;
    menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
    menu_destroy(menu);
    
    if( info[0] == '*' )
    {
        static motd[2500];
        new len = formatex(motd, sizeof(motd) - 1,    "<body style=^"background-color:#030303; color:#FF8F00^">");
        len += format(motd[len], sizeof(motd) - len - 1,    "<p align=^"center^">");
        len += format(motd[len], sizeof(motd) - len - 1,    "The Armor ability is the amount of AP that given to you at spawn.<br>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<br>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<table>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th></th>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_armor_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<th>%s</th>",g_team_names[i]);
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th>Armor Intervals</th>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_armor_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<td>%i</td>", (g_armor_maxamount[i] / g_armor_maxlevels[i]));
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th>Max Level</th>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_armor_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<td>%i</td>", g_armor_maxlevels[i]);
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th>Max Armor</th>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_armor_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<td>%i</td>", g_armor_maxamount[i]);
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "</table>");
        len += format(motd[len], sizeof(motd) - len - 1,    "</p>");
        len += format(motd[len], sizeof(motd) - len - 1,    "</body>");
        
        show_motd(client, motd, "XP Armor Info");
    }
    else
    {
        new CsTeams:upgrade = CsTeams:str_to_num(info);
        
        new level = g_armor_level[client][upgrade] + 1;
        new xp = g_armor_first_xp[upgrade] * (1 << (level - 1));
        new amount = g_armor_maxamount[upgrade] * level / g_armor_maxlevels[upgrade];
        
        g_xp[client] -= xp;
        g_armor_level[client][upgrade] = level;
        
        Save(client);
        
        Print(client, "You bought %s Level %i (%i AP) for %i XP!", g_armor_names[upgrade], level, amount, xp);
    }
    
    ShowArmorMenu(client);
}

public CallbackArmor(client, menu, item)
{
    static _access, info[4], callback;
    menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
    
    if( info[0] == '*' ) return ITEM_ENABLED;
    
    new CsTeams:upgrade = CsTeams:str_to_num(info);
    if( g_armor_level[client][upgrade] == g_armor_maxlevels[upgrade] )
    {
        return ITEM_DISABLED;
    }
    
    new xp = g_armor_first_xp[upgrade] * (1 << g_armor_level[client][upgrade]);
    if( g_xp[client] < xp )
    {
        return ITEM_DISABLED;
    }
    
    return ITEM_ENABLED;
}

ShowRespawnMenu(client)
{
    static title[128];
    formatex(title, sizeof(title) - 1, "[HNS XP by Exolent]^nRespawn Menu^n^nYour XP: \w%i", g_xp[client]);
    new menu = menu_create(title, "MenuRespawn");
    new callback = menu_makecallback("CallbackRespawn");
    
    menu_additem(menu, "\yHelp", "*", _, callback);
    
    static level, xp, percent, item[128], info[4];
    for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
    {
        if( g_respawn_enabled[i] )
        {
            level = g_respawn_level[client][i] + 1;
            percent = g_respawn_max_chance[i] * level / g_respawn_maxlevels[i];
            
            if( g_respawn_level[client][i] < g_respawn_maxlevels[i] )
            {
                xp = g_respawn_first_xp[i] * (1 << (level - 1));
                formatex(item, sizeof(item) - 1, "%s: \yLevel %i (%i%%) \r[\w%i XP\r]", g_respawn_names[i], level, percent, xp);
            }
            else
            {
                formatex(item, sizeof(item) - 1, "%s: \yLevel %i (%i%%) \r[\wMaxed Out!\r]", g_respawn_names[i], level, percent);
            }
            
            num_to_str(_:i, info, sizeof(info) - 1);
            
            menu_additem(menu, item, info, _, callback);
        }
    }
    
    menu_display(client, menu);
}

public MenuRespawn(client, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        ShowMainMenu(client);
        return;
    }
    
    static _access, info[4], callback;
    menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
    menu_destroy(menu);
    
    if( info[0] == '*' )
    {
        static motd[2500];
        new len = formatex(motd, sizeof(motd) - 1,    "<body style=^"background-color:#030303; color:#FF8F00^">");
        len += format(motd[len], sizeof(motd) - len - 1,    "<p align=^"center^">");
        len += format(motd[len], sizeof(motd) - len - 1,    "The Respawn ability is chance to be respawned when you die.<br>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<br>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<table>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th></th>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_respawn_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<th>%s</th>",g_team_names[i]);
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th>Chance Intervals</th>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_respawn_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<td>%i%%</td>", (g_respawn_max_chance[i] / g_respawn_maxlevels[i]));
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th>Max Level</th>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_respawn_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<td>%i</td>", g_respawn_maxlevels[i]);
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th>Max Chance</th>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_respawn_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<td>%i%%</td>", g_respawn_max_chance[i]);
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "</table>");
        len += format(motd[len], sizeof(motd) - len - 1,    "</p>");
        len += format(motd[len], sizeof(motd) - len - 1,    "</body>");
        
        show_motd(client, motd, "XP Respawn Info");
    }
    else
    {
        new CsTeams:upgrade = CsTeams:str_to_num(info);
        
        new level = g_respawn_level[client][upgrade] + 1;
        new xp = g_respawn_first_xp[upgrade] * (1 << (level - 1));
        new percent = g_respawn_max_chance[upgrade] * level / g_respawn_maxlevels[upgrade];
        
        g_xp[client] -= xp;
        g_respawn_level[client][upgrade] = level;
        
        Save(client);
        
        Print(client, "You bought %s Level %i (%i%%) for %i XP!", g_respawn_names[upgrade], level, percent, xp);
    }
    
    ShowRespawnMenu(client);
}

public CallbackRespawn(client, menu, item)
{
    static _access, info[4], callback;
    menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
    
    if( info[0] == '*' ) return ITEM_ENABLED;
    
    new CsTeams:upgrade = CsTeams:str_to_num(info);
    if( g_respawn_level[client][upgrade] == g_respawn_maxlevels[upgrade] )
    {
        return ITEM_DISABLED;
    }
    
    new xp = g_respawn_first_xp[upgrade] * (1 << g_respawn_level[client][upgrade]);
    if( g_xp[client] < xp || g_respawn_level[client][upgrade] == g_respawn_maxlevels[upgrade] )
    {
        return ITEM_DISABLED;
    }
    
    return ITEM_ENABLED;
}

ShowNoFallMenu(client)
{
    static title[128];
    formatex(title, sizeof(title) - 1, "[HNS XP by Exolent]^nFall Damage Menu^n^nYour XP: \w%i", g_xp[client]);
    new menu = menu_create(title, "MenuNoFall");
    new callback = menu_makecallback("CallbackNoFall");
    
    menu_additem(menu, "\yHelp", "*", _, callback);
    
    static level, xp, percent, item[128], info[4];
    for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
    {
        if( g_nofall_enabled[i] )
        {
            level = g_nofall_level[client][i] + 1;
            percent = g_nofall_max_chance[i] * level / g_nofall_maxlevels[i];
            
            if( g_nofall_level[client][i] < g_nofall_maxlevels[i] )
            {
                xp = g_nofall_first_xp[i] * (1 << (level - 1));
                formatex(item, sizeof(item) - 1, "%s: \yLevel %i (%i%%) \r[\w%i XP\r]", g_nofall_names[i], level, percent, xp);
            }
            else
            {
                formatex(item, sizeof(item) - 1, "%s: \yLevel %i (%i%%) \r[\wMaxed Out!\r]", g_nofall_names[i], level, percent);
            }
            
            num_to_str(_:i, info, sizeof(info) - 1);
            
            menu_additem(menu, item, info, _, callback);
        }
    }
    
    menu_display(client, menu);
}

public MenuNoFall(client, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        ShowMainMenu(client);
        return;
    }
    
    static _access, info[4], callback;
    menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
    menu_destroy(menu);
    
    if( info[0] == '*' )
    {
        static motd[2500];
        new len = formatex(motd, sizeof(motd) - 1,    "<body style=^"background-color:#030303; color:#FF8F00^">");
        len += format(motd[len], sizeof(motd) - len - 1,    "<p align=^"center^">");
        len += format(motd[len], sizeof(motd) - len - 1,    "The Fall Damage ability reduces the amount of damage inflicted from falling.<br>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<br>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<table>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th></th>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_nofall_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<th>%s</th>",g_team_names[i]);
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th>Reduction Intervals</th>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_nofall_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<td>%i%%</td>", (g_nofall_max_chance[i] / g_nofall_maxlevels[i]));
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th>Max Level</th>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_nofall_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<td>%i</td>", g_nofall_maxlevels[i]);
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "<th>Max Chance</th>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_nofall_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1,    "<td>%i%%</td>", g_nofall_max_chance[i]);
            }
        }
        len += format(motd[len], sizeof(motd) - len - 1,    "</tr>");
        len += format(motd[len], sizeof(motd) - len - 1,    "</table>");
        len += format(motd[len], sizeof(motd) - len - 1,    "</p>");
        len += format(motd[len], sizeof(motd) - len - 1,    "</body>");
        
        show_motd(client, motd, "XP Fall Damage Info");
    }
    else
    {
        new CsTeams:upgrade = CsTeams:str_to_num(info);
        
        new level = g_nofall_level[client][upgrade] + 1;
        new xp = g_nofall_first_xp[upgrade] * (1 << (level - 1));
        new percent = g_nofall_max_chance[upgrade] * level / g_nofall_maxlevels[upgrade];
        
        g_xp[client] -= xp;
        g_nofall_level[client][upgrade] = level;
        
        Save(client);
        
        Print(client, "You bought %s Level %i (%i%%) for %i XP!", g_nofall_names[upgrade], level, percent, xp);
    }
    
    ShowNoFallMenu(client);
}

public CallbackNoFall(client, menu, item)
{
    static _access, info[4], callback;
    menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
    
    if( info[0] == '*' ) return ITEM_ENABLED;
    
    new CsTeams:upgrade = CsTeams:str_to_num(info);
    if( g_nofall_level[client][upgrade] == g_nofall_maxlevels[upgrade] )
    {
        return ITEM_DISABLED;
    }
    
    new xp = g_nofall_first_xp[upgrade] * (1 << g_nofall_level[client][upgrade]);
    if( g_xp[client] < xp || g_nofall_level[client][upgrade] == g_nofall_maxlevels[upgrade] )
    {
        return ITEM_DISABLED;
    }
    
    return ITEM_ENABLED;
}

ShowPlayerMenu(client)
{
    new menu = menu_create("Player Info Menu", "MenuPlayer");
    
    new name[32], authid[35];
    for( new i = 1; i <= g_max_clients; i++ )
    {
        if( !is_user_connected(i) ) continue;
        
        get_user_name(i, name, sizeof(name) - 1);
        get_user_authid(i, authid, sizeof(authid) - 1);
        
        menu_additem(menu, name, authid);
    }
    
    menu_display(client, menu);
}

public MenuPlayer(client, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        ShowMainMenu(client);
        return;
    }
    
    static _access, authid[35], callback;
    menu_item_getinfo(menu, item, _access, authid, sizeof(authid) - 1, _, _, callback);
    menu_destroy(menu);
    
    new player = find_player("c", authid);
    if( !is_user_connected(player) )
    {
        ShowMainMenu(client);
        return;
    }
    
    new name[32];
    get_user_name(player, name, sizeof(name) - 1);
    
    static motd[2500];
    new len = copy(motd, sizeof(motd) - 1, "<html>");
    len += format(motd[len], sizeof(motd) - len - 1, "<b><font size=^"4^">Name:</font></b> %s<br><br>", name);
    len += format(motd[len], sizeof(motd) - len - 1, "<b><font size=^"4^">XP:</font></b> %i<br><br>", g_xp[player]);
    if( g_any_nade_enabled )
    {
        len += format(motd[len], sizeof(motd) - len - 1, "<b><font size=^"4^">Grenades Levels:</font></b><br>");
        for( new i = 0; i < Grenades; i++ )
        {
            if( g_nade_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1, "<b>%s:</b> %i/%i<br>", g_nade_names[i], g_nade_level[player][i], g_nade_maxlevels[i]);
            }
        }
    }
    if( g_any_health_enabled )
    {
        len += format(motd[len], sizeof(motd) - len - 1, "<br><b><font size=^"4^">Health Levels:</font></b><br>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_health_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1, "<b>%s:</b> %i/%i (%i/%i HP)<br>",\
                    g_health_names[i], g_health_level[player][i], g_health_maxlevels[i],\
                    (g_health_maxamount[i] * g_health_level[player][i] / g_health_maxlevels[i]), g_health_maxamount[i]);
            }
        }
    }
    if( g_any_armor_enabled )
    {
        len += format(motd[len], sizeof(motd) - len - 1, "<br><b><font size=^"4^">Armor Levels:</font></b><br>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_armor_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1, "<b>%s:</b> %i/%i (%i/%i AP)<br>",\
                    g_armor_names[i], g_armor_level[player][i], g_armor_maxlevels[i],\
                    (g_armor_maxamount[i] * g_armor_level[player][i] / g_armor_maxlevels[i]), g_armor_maxamount[i]);
            }
        }
    }
    if( g_any_respawn_enabled )
    {
        len += format(motd[len], sizeof(motd) - len - 1, "<br><b><font size=^"4^">Respawn Levels:</font></b><br>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_respawn_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1, "<b>%s:</b> %i/%i (%i/%i %%)<br>",\
                    g_respawn_names[i], g_respawn_level[player][i], g_respawn_maxlevels[i],\
                    (g_respawn_max_chance[i] * g_respawn_level[player][i] / g_respawn_maxlevels[i]), g_respawn_max_chance[i]);
            }
        }
    }
    if( g_any_nofall_enabled )
    {
        len += format(motd[len], sizeof(motd) - len - 1, "<br><b><font size=^"4^">Fall Damage Levels:</font></b><br>");
        for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
        {
            if( g_nofall_enabled[i] )
            {
                len += format(motd[len], sizeof(motd) - len - 1, "<b>%s:</b> %i/%i (%i/%i %%)<br>",\
                    g_nofall_names[i], g_nofall_level[player][i], g_nofall_maxlevels[i],\
                    (g_nofall_max_chance[i] * g_nofall_level[player][i] / g_nofall_maxlevels[i]), g_nofall_max_chance[i]);
            }
        }
    }
    len += format(motd[len], sizeof(motd) - len - 1, "</html>");
    
    show_motd(client, motd, "HNS XP Mod Info");
    
    ShowPlayerMenu(client);
}

IsValidAuthid(authid[])
{
    return (regex_match_c(authid, g_SteamID_pattern, g_regex_return) > 0);
}

IsUserAuthorized(client)
{
    return g_authid[client][0] != 0;
}

Print(client, const msg_fmt[], any:...)
{
    static message[192];
    new len = formatex(message, sizeof(message) - 1, "%s^x03 ", MESSAGE_TAG);
    vformat(message[len], sizeof(message) - len - 1, msg_fmt, 3);
    
    if( client )
    {
        message_begin(MSG_ONE_UNRELIABLE, g_msgid_SayText, _, client);
        write_byte(client);
        write_string(message);
        message_end();
    }
    else
    {
        for( new i = g_first_client; i <= g_max_clients; i++ )
        {
            if( is_user_connected(i) )
            {
                message_begin(MSG_ONE_UNRELIABLE, g_msgid_SayText, _, i);
                write_byte(i);
                write_string(message);
                message_end();
            }
        }
    }
}

Load(client)
{
    #if defined USING_SQL
    static query[128];
    formatex(query, sizeof(query) - 1, "SELECT `data` FROM `hns_xp` WHERE `authid` = '%s';", g_authid[client]);
    
    static data[2];
    data[0] = client;
    
    SQL_ThreadQuery(g_sql_tuple, "QueryLoadData", query, data, sizeof(data));
    #else
    static data[256], timestamp;
    if( nvault_lookup(g_vault, g_authid[client], data, sizeof(data) - 1, timestamp) )
    {
        ParseLoadData(client, data);
        return;
    }
    else
    {
        NewUser(client);
    }
    #endif
}

#if defined USING_SQL
public QueryLoadData(failstate, Handle:query, error[], errnum, data[], size, Float:queuetime)
{
    if( failstate == TQUERY_CONNECT_FAILED
    || failstate == TQUERY_QUERY_FAILED )
    {
        set_fail_state(error);
    }
    else
    {
        if( SQL_NumResults(query) )
        {
            static sqldata[256];
            SQL_ReadResult(query, 0, sqldata, sizeof(sqldata) - 1);
            ParseLoadData(data[0], sqldata);
        }
        else
        {
            NewUser(data[0]);
        }
    }
}
#endif

ParseLoadData(client, data[256])
{
    static num[6];
    strbreak(data, num, sizeof(num) - 1, data, sizeof(data) - 1);
    
    g_xp[client] = str_to_num(num);
    
    for( new i = 0; i < Grenades; i++ )
    {
        strbreak(data, num, sizeof(num) - 1, data, sizeof(data) - 1);
        g_nade_level[client][i] = clamp(str_to_num(num), 0, g_nade_maxlevels[i]);
    }
    
    for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
    {
        strbreak(data, num, sizeof(num) - 1, data, sizeof(data) - 1);
        g_armor_level[client][i] = clamp(str_to_num(num), 0, g_armor_maxlevels[i]);
    }
    
    for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
    {
        strbreak(data, num, sizeof(num) - 1, data, sizeof(data) - 1);
        g_respawn_level[client][i] = clamp(str_to_num(num), 0, g_respawn_maxlevels[i]);
    }
    
    for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
    {
        strbreak(data, num, sizeof(num) - 1, data, sizeof(data) - 1);
        g_health_level[client][i] = clamp(str_to_num(num), 0, g_health_maxlevels[i]);
    }
    
    for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
    {
        strbreak(data, num, sizeof(num) - 1, data, sizeof(data) - 1);
        g_nofall_level[client][i] = clamp(str_to_num(num), 0, g_nofall_maxlevels[i]);
    }
    
    #if defined USING_SQL
    g_loaded_data[client] = 1;
    #endif
}

NewUser(client)
{
    g_first_time[client] = 1;
    
    g_xp[client] = ENTRY_XP;
    arrayset(g_nade_level[client], 0, sizeof(g_nade_level[]));
    for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
    {
        g_armor_level[client][i] = 0;
        g_respawn_level[client][i] = 0;
        g_health_level[client][i] = 0;
        g_nofall_level[client][i] = 0;
    }
}

Save(client)
{
    if( !IsUserAuthorized(client) ) return;
    
    static data[256];
    new len = formatex(data, sizeof(data) - 1, "%i", g_xp[client]);
    
    for( new i = 0; i < Grenades; i++ )
    {
        len += formatex(data[len], sizeof(data) - len - 1, " %i", g_nade_level[client][i]);
    }
    
    for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
    {
        len += formatex(data[len], sizeof(data) - len - 1, " %i", g_armor_level[client][i]);
    }
    
    for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
    {
        len += formatex(data[len], sizeof(data) - len - 1, " %i", g_respawn_level[client][i]);
    }
    
    for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
    {
        len += formatex(data[len], sizeof(data) - len - 1, " %i", g_health_level[client][i]);
    }
    
    for( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
    {
        len += formatex(data[len], sizeof(data) - len - 1, " %i", g_nofall_level[client][i]);
    }
    
    #if defined USING_SQL
    static name[32];
    get_user_name(client, name, sizeof(name) - 1);
    
    static query[512];
    if( g_loaded_data[client] )
    {
        formatex(query, sizeof(query) - 1, "UPDATE `hns_xp` SET `name` = '%s', `data` = '%s' WHERE `authid` = '%s';", name, data, g_authid[client]);
    }
    else
    {
        formatex(query, sizeof(query) - 1, "INSERT INTO `hns_xp` ( `name`, `authid`, `data` ) VALUES ( '%s', '%s', '%s' );", name, g_authid[client], data);
    }
    
    SQL_ThreadQuery(g_sql_tuple, "QuerySaveData", query);
    #else
    nvault_set(g_vault, g_authid[client], data);
    #endif
}

#if defined USING_SQL
public QuerySaveData(failstate, Handle:query, error[], errnum, data[], size, Float:queuetime)
{
    if( failstate == TQUERY_CONNECT_FAILED
    || failstate == TQUERY_QUERY_FAILED )
    {
        set_fail_state(error);
    }
}
#endif
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang11274\\ f0\\ fs16 \n\\ par }
*/
if player touch (T or CT or Anyone, depend on Block Properties that use with) XP Model it gets XP
es
means:

[Blockmaker] You got %i XP.

and neon lights example:
https://steamuserimages-a.akamaihd.net/ ... rbox=false

Neon lights can be enable with Block Properties, Means:
[Block = Bhop]
Deals Damage: Yes
Neon lights Eanble = Yes/Not

  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Заявки за плъгини”

Кой е на линия

Потребители разглеждащи този форум: Bing [Bot] и 13 госта