corectare plugin nc

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori

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

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Post Reply
vasiumihai
Membru, skill 0
Membru, skill 0
Posts: 31
Joined: 11 Jan 2014, 23:15
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
SteamID: STEAM_0:1:83849775
Contact:

13 Aug 2019, 13:30

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

#define PLUGIN_NAME	"[NightCrawler] PLUGIN"
#define PLUGIN_AUTHORS	"YONTU"
#define PLUGIN_VERSION	"1.0"

new g_HostName[64];
new menu, text_menu[128], text_items[4][128], menu_callback, money;
new bool:HavePrimaryWeapon[33], PrimaryWeapon[33];
new g_JumpNum[33] = 0, bool:g_bJump[33] = false, t_gravity[33];
new g_msg_ItemPickUp;
new cvar_hostname;

#define M4A1_KEY		100
#define AK47_KEY		101
#define M3_KEY		102
#define FAMAS_KEY	104
#define MP5_KEY		105
#define AWP_KEY		106

enum
{
	COST_HEALTH = 0,
	HEALTH,
	MAX_HEALTH,

	COST_ARMOR,
	ARMOR,
	MAX_ARMOR,

	T_HP,
	T_JUMPS,
	T_GRAVITY,
	CT_HP,
	CT_JUMPS
}

new const ITEM[] = 
{
	6000,		// COSTUL VIETII	
	100,		// VIATA
	250,		// VIATA MAXIMA PE CARE O POTI AVEA DACA TOT CUMPERI DIN SHOP

	5000,		// COSTUL ARMURII
	100,		// ARMURA
	250,		// ARMURA MAXIMA PE CARE O POTI AVEA DACA TOT CUMPERI DIN SHOP

	150,		// VIATA TERORISTILOR LA FIECARE SPAWN
	2,		// NUMARUL DE SARITURI ALE TERORISTILOR (daca pui 3, va sari de 4 ori | orice valoare pui va fi +1)
	400,		// GRAVITATEA TERORISTILOR (valoarea trebuie sa fie inclusa in intervalul 100.0 - 800.0)
	200,		// VIATA CONTRA-TERORISTILOR LA FIECARE SPAWN
	2		// NUMARUL DE SARITURI ALE CONTRA-TERORISTILOR (daca pui 3, va sari de 4 ori | orice valoare pui va fi +1)
}

new const KnifeModels[][] = 
{
	"models/Nightcrawler/v_knife_nc.mdl",
	"models/Nightcrawler/p_knife_nc.mdl"
}

new const TAG[] = "[Nightcrawler]";

public plugin_init() 
{
	register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHORS);

	register_event("CurWeapon", "event_CurWeapon", "be", "1=1");
	RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn", 1);

	register_clcmd("say /shop", "ShowShopMenu");
	register_clcmd("say_team /shop", "ShowShopMenu");
	register_clcmd("say shop", "ShowShopMenu");
	register_clcmd("say_team shop", "ShowShopMenu");

	register_clcmd("say guns", "CmdWeaponsMenu");
	register_clcmd("say /guns", "CmdWeaponsMenu");

	cvar_hostname = get_cvar_pointer("hostname");

	g_msg_ItemPickUp = get_user_msgid("ItemPickup");
}

public plugin_precache()
{
	new i;
	for(i = 0; i < sizeof KnifeModels; i++)
		precache_model(KnifeModels);
}

public plugin_cfg()
{
	get_pcvar_string(cvar_hostname, g_HostName, charsmax(g_HostName));
}

public client_putinserver(id)
{
	g_JumpNum[id] = 0;
	t_gravity[id] = 0;
	g_bJump[id] = false;
}

public client_PreThink(id)
{
	if(!is_user_alive(id))
		return PLUGIN_CONTINUE;
		
	new nbut = get_user_button(id);
	new obut = get_user_oldbutton(id);
	new jump_num;

	switch(_:cs_get_user_team(id))
	{
		case CS_TEAM_T: jump_num = ITEM[T_JUMPS];
		case CS_TEAM_CT: jump_num = ITEM[CT_JUMPS];
	}
	
	if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))
	{
		if(g_JumpNum[id] < jump_num)
		{
			g_bJump[id] = true;
			g_JumpNum[id]++;
			return PLUGIN_CONTINUE;
		}
	}
	
	if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
	{
		g_JumpNum[id] = 0;
		return PLUGIN_CONTINUE;
	}
	
	return PLUGIN_CONTINUE;
}

public client_PostThink(id)
{
	if(!is_user_alive(id))
		return PLUGIN_CONTINUE;

	if(g_bJump[id])
	{
		new Float:fVelocity[3];
		entity_get_vector(id, EV_VEC_velocity, fVelocity);
		fVelocity[2] = random_float(265.0, 285.0);
		entity_set_vector(id, EV_VEC_velocity, fVelocity);
		
		g_bJump[id] = false;
		return PLUGIN_CONTINUE;
	}
	
	return PLUGIN_CONTINUE;
}

public fw_PlayerSpawn(id)
{
	if(!is_user_alive(id))
		return HAM_IGNORED;

	HavePrimaryWeapon[id] = false;

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

	switch(cs_get_user_team(id))
	{
		case CS_TEAM_CT:
		{
			set_user_health(id, ITEM[CT_HP]);
			set_user_gravity(id, 1.0);
			give_item(id, "weapon_hegrenade");
			give_item(id, "weapon_flashbang");
			cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
			give_item(id, "weapon_smokegrenade");
			set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 0);
			Equipment(id);
		}
		case CS_TEAM_T:
		{
			t_gravity[id] = 1;
			set_user_health(id, ITEM[T_HP]);
			set_user_footsteps(id, 1);
			set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 0);
		}
	}

	cs_set_user_armor(id, 0, CS_ARMOR_NONE);

	return HAM_IGNORED;
}

public event_CurWeapon(id)
{
	if(!is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_T)
		return PLUGIN_HANDLED;
	if(t_gravity[id] == 1)
		set_user_gravity(id, floatclamp(ITEM[T_GRAVITY] * 0.00125, 100.0, 800.0));

	if(get_user_weapon(id) == CSW_KNIFE)
	{
		set_pev(id, pev_viewmodel2, KnifeModels[0]);
		set_pev(id, pev_weaponmodel2, KnifeModels[1]);
	}

	return PLUGIN_CONTINUE;
}

public ShowShopMenu(id)
{
	if(!is_user_alive(id))
	{
		return PLUGIN_HANDLED;
	}

	Shop(id);
	return PLUGIN_CONTINUE;
}

public Shop(id)
{
	formatex(text_menu, charsmax(text_menu), "\wMoney:\r %d^n\y%s", cs_get_user_money(id), g_HostName);
	menu = menu_create(text_menu, "SHandler");
	menu_callback = menu_makecallback("CallBackMenu");
	
	formatex(text_items[0], charsmax(text_items[]), "\y%d HP -\r  %d $", ITEM[HEALTH], ITEM[COST_HEALTH]);
	menu_additem(menu, text_items[0], "1", 0, menu_callback);

	formatex(text_items[1], charsmax(text_items[]), "\y%d AP -\r %d $", ITEM[ARMOR], ITEM[COST_ARMOR]);
	menu_additem(menu, text_items[1], "2", 0, menu_callback);

	menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
	menu_display(id, menu, 0);
	
	return PLUGIN_CONTINUE;
}

public CallBackMenu(id, menu, item)
{
	new data[6], name[64], access, CallBack;
	menu_item_getinfo(menu, item, access, data, charsmax(data), name, charsmax(name), CallBack);
	
	switch(data[0])
	{
		case '1':
		{
			if(ITEM[COST_HEALTH] > cs_get_user_money(id) || get_user_health(id) >= ITEM[MAX_HEALTH] || !is_user_alive(id))
				return ITEM_DISABLED;
		}
		case '2':
		{
			if(ITEM[COST_ARMOR] > cs_get_user_money(id) || get_user_armor(id) >= ITEM[MAX_ARMOR] || !is_user_alive(id))
				return ITEM_DISABLED;
		}
	}
	
	return ITEM_ENABLED;
}

public SHandler(id, menu, item)
{
	money = cs_get_user_money(id);
	new effect[16];

	new data[6], name[64], access, CallBack;
	menu_item_getinfo(menu, item, access, data, charsmax(data), name, charsmax(name), CallBack);
	new iKey = str_to_num(data);

	switch(iKey)
	{
		case 1:
		{
			effect = "cross";
			set_user_health(id,  clamp(get_user_health(id) + ITEM[HEALTH],  0,  ITEM[MAX_HEALTH]));
			cs_set_user_money(id, money - ITEM[COST_HEALTH]);
			ColorChat(id, "!4%s!1 You bought!3 %d!1 health with!3 %d!1 money.", TAG, ITEM[HEALTH], ITEM[COST_HEALTH]);
		}

		case 2:
		{
			effect = "suithelmet_full";
			new CsArmorType:ArmorType = CS_ARMOR_VESTHELM;
			cs_set_user_armor(id, clamp(cs_get_user_armor(id, ArmorType) + ITEM[ARMOR], 0, ITEM[MAX_ARMOR]), ArmorType);
				
			cs_set_user_money(id, money - ITEM[COST_ARMOR]);
			ColorChat(id, "!4%s!1 You bought!3 %d!1 armor with!3 %d!1 money.", TAG, ITEM[ARMOR], ITEM[COST_ARMOR]);
		}
	}

	message_begin(MSG_ONE, g_msg_ItemPickUp, _, id);
	write_string(effect);
	write_byte(255);
	write_byte(0);
	write_byte(0);
	message_end();

	emit_sound(id, CHAN_VOICE, "items/tr_kevlar.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);

	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

public CmdWeaponsMenu(id)
{
	if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
	{
		if(!HavePrimaryWeapon[id])
			Equipment(id);
	}

	return PLUGIN_CONTINUE;
}

public Equipment(id)
{
	if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
	{
		menu = menu_create("\yWeapons Menu", "EquipmentCmd");
		menu_additem(menu, "\wNew Weapons", "1", 0);

		if(PrimaryWeapon[id])
			menu_additem(menu, "\wPrevious Setup", "2", 0);
		else 
			menu_additem(menu, "\dPrevious Setup", "2", 0);

		menu_setprop(menu, MPROP_EXIT, MEXIT_NEVER);
		menu_display(id, menu, 0);
	}
}

public EquipmentCmd(id, menu, item)
{
	if(item == MENU_EXIT || !is_user_alive(id) || cs_get_user_team(id) !=  CS_TEAM_CT)
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}

	new Data[6], Name[64];
	new Access, CallBack;
	menu_item_getinfo(menu, item, Access, Data,5, Name, 63, CallBack);
	new Key = str_to_num(Data);

	switch(Key)
	{
		case 1:
		{
			if(!HavePrimaryWeapon[id])
				Primary(id);
		}

		case 2:
		{
			if(PrimaryWeapon[id])
				GiveLastWeapons(id);
			else Equipment(id);
		}

		default: return PLUGIN_HANDLED;
	}

	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

public Primary(id)
{
	if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
	{
		menu = menu_create("\yWeapons", "CmdWeaponsHandler")
		
		menu_additem(menu, "M4A1", "1", 0);
		menu_additem(menu, "AK47", "2", 0);
		menu_additem(menu, "M3", "3", 0);
		menu_additem(menu, "Famas", "4", 0);
		menu_additem(menu, "MP5 Navy", "5", 0);
		menu_additem(menu, "AWP", "6", 0);
		
		menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
		menu_display(id, menu, 0);
	}
}

public CmdWeaponsHandler(id, menu, item)
{
	if(item == MENU_EXIT || !is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_CT)
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}

	new Data[6], Name[64];
	new Access, CallBack;
	menu_item_getinfo(menu, item, Access, Data,5, Name, 63, CallBack);
	new Key = str_to_num(Data);

	switch(Key)
	{
		case 1:
		{
			give_item(id, "weapon_m4a1");
			cs_set_user_bpammo(id, CSW_M4A1, 254);
			PrimaryWeapon[id] = M4A1_KEY;
			HavePrimaryWeapon[id] = true;
		}

		case 2:
		{
			give_item(id, "weapon_ak47");
			cs_set_user_bpammo(id, CSW_AK47, 254);
			PrimaryWeapon[id] = AK47_KEY;
			HavePrimaryWeapon[id] = true;
		}

		case 3:
		{
			give_item(id, "weapon_m3");
			cs_set_user_bpammo(id, CSW_M3, 254);
			PrimaryWeapon[id] = M3_KEY;
			HavePrimaryWeapon[id] = true;
		}

		case 4:
		{
			give_item(id, "weapon_famas");
			cs_set_user_bpammo(id, CSW_FAMAS, 254);
			PrimaryWeapon[id] = FAMAS_KEY;
			HavePrimaryWeapon[id] = true;
		}

		case 5:
		{
			give_item(id, "weapon_mp5navy");
			cs_set_user_bpammo(id, CSW_MP5NAVY, 254);
			PrimaryWeapon[id] = MP5_KEY;
			HavePrimaryWeapon[id] = true;
		}

		case 6:
		{
			give_item(id, "weapon_awp");
			cs_set_user_bpammo(id, CSW_AWP, 110);
			PrimaryWeapon[id] = AWP_KEY;
			HavePrimaryWeapon[id] = true;
		}
	}

	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

public GiveLastWeapons(id)
{
	if(!HavePrimaryWeapon[id])
	{
		switch(PrimaryWeapon[id])
		{
			case M4A1_KEY:
			{
				give_item(id, "weapon_m4a1");
				cs_set_user_bpammo(id, CSW_M4A1, 256);
				HavePrimaryWeapon[id] = true;
			}

			case AK47_KEY:
			{
				give_item(id, "weapon_ak47");
				cs_set_user_bpammo(id, CSW_AK47, 256);
				HavePrimaryWeapon[id] = true;
			}

			case M3_KEY:
			{
				give_item(id, "weapon_m3");
				cs_set_user_bpammo(id, CSW_M3, 256);
				HavePrimaryWeapon[id] = true;
			}

			case FAMAS_KEY:
			{
				give_item(id, "weapon_famas");
				cs_set_user_bpammo(id, CSW_FAMAS, 256);
				HavePrimaryWeapon[id] = true;
			}

			case MP5_KEY:
			{
				give_item(id, "weapon_mp5navy");
				cs_set_user_bpammo(id, CSW_MP5NAVY, 256);
				HavePrimaryWeapon[id] = true;
			}

			case AWP_KEY:
			{
				give_item(id, "weapon_awp");
				cs_set_user_bpammo(id, CSW_AWP, 110);
				HavePrimaryWeapon[id] = true;
			}
		}
	}
}

stock ColorChat(id, String[], any:...)
{
	static szMesage[192];
	vformat(szMesage, charsmax(szMesage), String, 3);
	
	replace_all(szMesage, charsmax(szMesage), "!1", "^1");
	replace_all(szMesage, charsmax(szMesage), "!3", "^3");
	replace_all(szMesage, charsmax(szMesage), "!4", "^4");
	
	static g_msg_SayText = 0;
	if(!g_msg_SayText)
		g_msg_SayText = get_user_msgid("SayText");
	
	new Players[32], iNum = 1, i;

 	if(id) Players[0] = id;
	else get_players(Players, iNum, "ch");
	
	for(--iNum; iNum >= 0; iNum--)
	{
		i = Players[iNum];
	
		message_begin(MSG_ONE_UNRELIABLE, g_msg_SayText, _, i);
		write_byte(i);
		write_string(szMesage);
		message_end();
	}
}

stock bacon_strip_weapon(index, weapon[])
{
	if(!equal(weapon, "weapon_", 7)) 
		return PLUGIN_CONTINUE;

	static weaponid;
	weaponid = get_weaponid(weapon)
	
	if(!weaponid) 
		return PLUGIN_CONTINUE;

	static weaponent;
	weaponent = fm_find_ent_by_owner(-1, weapon, index);
	
	if(!weaponent)
		return PLUGIN_CONTINUE;

	if(get_user_weapon(index) == weaponid) 
		ExecuteHamB(Ham_Weapon_RetireWeapon, weaponent);

	if(!ExecuteHamB(Ham_RemovePlayerItem, index, weaponent)) 
		return PLUGIN_CONTINUE;
	
	ExecuteHamB(Ham_Item_Kill, weaponent);
	set_pev(index, pev_weapons, pev(index, pev_weapons) & ~(1<<weaponid));

	return PLUGIN_HANDLED;
}

stock fm_find_ent_by_owner(id, const szClassName[], iOwner, jghgtype = 0)
{
	new str_type[11] = "classname", iEnt = id;

	switch(jghgtype) {

		case 1: str_type = "target";
		case 2: str_type = "targetname";
	}

	while((iEnt = engfunc(EngFunc_FindEntityByString, iEnt, str_type, szClassName)) && pev(iEnt, pev_owner) != iOwner) {  }
	return iEnt;
}
imi da eroare la compilare error 048: array dimensions do not match
poate rezolva cineva?
eXtreamSHOP
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2311
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 33 times
Been thanked: 365 times
Contact:

13 Aug 2019, 16:25

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

#define PLUGIN_NAME	"[NightCrawler] PLUGIN"
#define PLUGIN_AUTHORS	"YONTU"
#define PLUGIN_VERSION	"1.0"

new g_HostName[64];
new menu, text_menu[128], text_items[4][128], menu_callback, money;
new bool:HavePrimaryWeapon[33], PrimaryWeapon[33];
new g_JumpNum[33] = 0, bool:g_bJump[33] = false, t_gravity[33];
new g_msg_ItemPickUp;
new cvar_hostname;

#define M4A1_KEY		100
#define AK47_KEY		101
#define M3_KEY		102
#define FAMAS_KEY	104
#define MP5_KEY		105
#define AWP_KEY		106

enum
{
	COST_HEALTH = 0,
	HEALTH,
	MAX_HEALTH,

	COST_ARMOR,
	ARMOR,
	MAX_ARMOR,

	T_HP,
	T_JUMPS,
	T_GRAVITY,
	CT_HP,
	CT_JUMPS
}

new const ITEM[] = 
{
	6000,		// COSTUL VIETII	
	100,		// VIATA
	250,		// VIATA MAXIMA PE CARE O POTI AVEA DACA TOT CUMPERI DIN SHOP

	5000,		// COSTUL ARMURII
	100,		// ARMURA
	250,		// ARMURA MAXIMA PE CARE O POTI AVEA DACA TOT CUMPERI DIN SHOP

	150,		// VIATA TERORISTILOR LA FIECARE SPAWN
	2,		// NUMARUL DE SARITURI ALE TERORISTILOR (daca pui 3, va sari de 4 ori | orice valoare pui va fi +1)
	400,		// GRAVITATEA TERORISTILOR (valoarea trebuie sa fie inclusa in intervalul 100.0 - 800.0)
	200,		// VIATA CONTRA-TERORISTILOR LA FIECARE SPAWN
	2		// NUMARUL DE SARITURI ALE CONTRA-TERORISTILOR (daca pui 3, va sari de 4 ori | orice valoare pui va fi +1)
}

new const KnifeModels[][] = 
{
	"models/Nightcrawler/v_knife_nc.mdl",
	"models/Nightcrawler/p_knife_nc.mdl"
}

new const TAG[] = "[Nightcrawler]";

public plugin_init() 
{
	register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHORS);

	register_event("CurWeapon", "event_CurWeapon", "be", "1=1");
	RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn", 1);

	register_clcmd("say /shop", "ShowShopMenu");
	register_clcmd("say_team /shop", "ShowShopMenu");
	register_clcmd("say shop", "ShowShopMenu");
	register_clcmd("say_team shop", "ShowShopMenu");

	register_clcmd("say guns", "CmdWeaponsMenu");
	register_clcmd("say /guns", "CmdWeaponsMenu");

	cvar_hostname = get_cvar_pointer("hostname");

	g_msg_ItemPickUp = get_user_msgid("ItemPickup");
}

public plugin_precache()
{
	new i;
	for(i = 0; i < sizeof KnifeModels; i++) precache_model(KnifeModels[ i ]);
}

public plugin_cfg()
{
	get_pcvar_string(cvar_hostname, g_HostName, charsmax(g_HostName));
}

public client_putinserver(id)
{
	g_JumpNum[id] = 0;
	t_gravity[id] = 0;
	g_bJump[id] = false;
}

public client_PreThink(id)
{
	if(!is_user_alive(id))
		return PLUGIN_CONTINUE;
		
	new nbut = get_user_button(id);
	new obut = get_user_oldbutton(id);
	new jump_num;

	switch(_:cs_get_user_team(id))
	{
		case CS_TEAM_T: jump_num = ITEM[T_JUMPS];
		case CS_TEAM_CT: jump_num = ITEM[CT_JUMPS];
	}
	
	if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))
	{
		if(g_JumpNum[id] < jump_num)
		{
			g_bJump[id] = true;
			g_JumpNum[id]++;
			return PLUGIN_CONTINUE;
		}
	}
	
	if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
	{
		g_JumpNum[id] = 0;
		return PLUGIN_CONTINUE;
	}
	
	return PLUGIN_CONTINUE;
}

public client_PostThink(id)
{
	if(!is_user_alive(id))
		return PLUGIN_CONTINUE;

	if(g_bJump[id])
	{
		new Float:fVelocity[3];
		entity_get_vector(id, EV_VEC_velocity, fVelocity);
		fVelocity[2] = random_float(265.0, 285.0);
		entity_set_vector(id, EV_VEC_velocity, fVelocity);
		
		g_bJump[id] = false;
		return PLUGIN_CONTINUE;
	}
	
	return PLUGIN_CONTINUE;
}

public fw_PlayerSpawn(id)
{
	if(!is_user_alive(id))
		return HAM_IGNORED;

	HavePrimaryWeapon[id] = false;

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

	switch(cs_get_user_team(id))
	{
		case CS_TEAM_CT:
		{
			set_user_health(id, ITEM[CT_HP]);
			set_user_gravity(id, 1.0);
			give_item(id, "weapon_hegrenade");
			give_item(id, "weapon_flashbang");
			cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
			give_item(id, "weapon_smokegrenade");
			set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 0);
			Equipment(id);
		}
		case CS_TEAM_T:
		{
			t_gravity[id] = 1;
			set_user_health(id, ITEM[T_HP]);
			set_user_footsteps(id, 1);
			set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 0);
		}
	}

	cs_set_user_armor(id, 0, CS_ARMOR_NONE);

	return HAM_IGNORED;
}

public event_CurWeapon(id)
{
	if(!is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_T)
		return PLUGIN_HANDLED;
	if(t_gravity[id] == 1)
		set_user_gravity(id, floatclamp(ITEM[T_GRAVITY] * 0.00125, 100.0, 800.0));

	if(get_user_weapon(id) == CSW_KNIFE)
	{
		set_pev(id, pev_viewmodel2, KnifeModels[0]);
		set_pev(id, pev_weaponmodel2, KnifeModels[1]);
	}

	return PLUGIN_CONTINUE;
}

public ShowShopMenu(id)
{
	if(!is_user_alive(id))
	{
		return PLUGIN_HANDLED;
	}

	Shop(id);
	return PLUGIN_CONTINUE;
}

public Shop(id)
{
	formatex(text_menu, charsmax(text_menu), "\wMoney:\r %d^n\y%s", cs_get_user_money(id), g_HostName);
	menu = menu_create(text_menu, "SHandler");
	menu_callback = menu_makecallback("CallBackMenu");
	
	formatex(text_items[0], charsmax(text_items[]), "\y%d HP -\r  %d $", ITEM[HEALTH], ITEM[COST_HEALTH]);
	menu_additem(menu, text_items[0], "1", 0, menu_callback);

	formatex(text_items[1], charsmax(text_items[]), "\y%d AP -\r %d $", ITEM[ARMOR], ITEM[COST_ARMOR]);
	menu_additem(menu, text_items[1], "2", 0, menu_callback);

	menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
	menu_display(id, menu, 0);
	
	return PLUGIN_CONTINUE;
}

public CallBackMenu(id, menu, item)
{
	new data[6], name[64], access, CallBack;
	menu_item_getinfo(menu, item, access, data, charsmax(data), name, charsmax(name), CallBack);
	
	switch(data[0])
	{
		case '1':
		{
			if(ITEM[COST_HEALTH] > cs_get_user_money(id) || get_user_health(id) >= ITEM[MAX_HEALTH] || !is_user_alive(id))
				return ITEM_DISABLED;
		}
		case '2':
		{
			if(ITEM[COST_ARMOR] > cs_get_user_money(id) || get_user_armor(id) >= ITEM[MAX_ARMOR] || !is_user_alive(id))
				return ITEM_DISABLED;
		}
	}
	
	return ITEM_ENABLED;
}

public SHandler(id, menu, item)
{
	money = cs_get_user_money(id);
	new effect[16];

	new data[6], name[64], access, CallBack;
	menu_item_getinfo(menu, item, access, data, charsmax(data), name, charsmax(name), CallBack);
	new iKey = str_to_num(data);

	switch(iKey)
	{
		case 1:
		{
			effect = "cross";
			set_user_health(id,  clamp(get_user_health(id) + ITEM[HEALTH],  0,  ITEM[MAX_HEALTH]));
			cs_set_user_money(id, money - ITEM[COST_HEALTH]);
			ColorChat(id, "!4%s!1 You bought!3 %d!1 health with!3 %d!1 money.", TAG, ITEM[HEALTH], ITEM[COST_HEALTH]);
		}

		case 2:
		{
			effect = "suithelmet_full";
			new CsArmorType:ArmorType = CS_ARMOR_VESTHELM;
			cs_set_user_armor(id, clamp(cs_get_user_armor(id, ArmorType) + ITEM[ARMOR], 0, ITEM[MAX_ARMOR]), ArmorType);
				
			cs_set_user_money(id, money - ITEM[COST_ARMOR]);
			ColorChat(id, "!4%s!1 You bought!3 %d!1 armor with!3 %d!1 money.", TAG, ITEM[ARMOR], ITEM[COST_ARMOR]);
		}
	}

	message_begin(MSG_ONE, g_msg_ItemPickUp, _, id);
	write_string(effect);
	write_byte(255);
	write_byte(0);
	write_byte(0);
	message_end();

	emit_sound(id, CHAN_VOICE, "items/tr_kevlar.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);

	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

public CmdWeaponsMenu(id)
{
	if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
	{
		if(!HavePrimaryWeapon[id])
			Equipment(id);
	}

	return PLUGIN_CONTINUE;
}

public Equipment(id)
{
	if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
	{
		menu = menu_create("\yWeapons Menu", "EquipmentCmd");
		menu_additem(menu, "\wNew Weapons", "1", 0);

		if(PrimaryWeapon[id])
			menu_additem(menu, "\wPrevious Setup", "2", 0);
		else 
			menu_additem(menu, "\dPrevious Setup", "2", 0);

		menu_setprop(menu, MPROP_EXIT, MEXIT_NEVER);
		menu_display(id, menu, 0);
	}
}

public EquipmentCmd(id, menu, item)
{
	if(item == MENU_EXIT || !is_user_alive(id) || cs_get_user_team(id) !=  CS_TEAM_CT)
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}

	new Data[6], Name[64];
	new Access, CallBack;
	menu_item_getinfo(menu, item, Access, Data,5, Name, 63, CallBack);
	new Key = str_to_num(Data);

	switch(Key)
	{
		case 1:
		{
			if(!HavePrimaryWeapon[id])
				Primary(id);
		}

		case 2:
		{
			if(PrimaryWeapon[id])
				GiveLastWeapons(id);
			else Equipment(id);
		}

		default: return PLUGIN_HANDLED;
	}

	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

public Primary(id)
{
	if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
	{
		menu = menu_create("\yWeapons", "CmdWeaponsHandler")
		
		menu_additem(menu, "M4A1", "1", 0);
		menu_additem(menu, "AK47", "2", 0);
		menu_additem(menu, "M3", "3", 0);
		menu_additem(menu, "Famas", "4", 0);
		menu_additem(menu, "MP5 Navy", "5", 0);
		menu_additem(menu, "AWP", "6", 0);
		
		menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
		menu_display(id, menu, 0);
	}
}

public CmdWeaponsHandler(id, menu, item)
{
	if(item == MENU_EXIT || !is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_CT)
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}

	new Data[6], Name[64];
	new Access, CallBack;
	menu_item_getinfo(menu, item, Access, Data,5, Name, 63, CallBack);
	new Key = str_to_num(Data);

	switch(Key)
	{
		case 1:
		{
			give_item(id, "weapon_m4a1");
			cs_set_user_bpammo(id, CSW_M4A1, 254);
			PrimaryWeapon[id] = M4A1_KEY;
			HavePrimaryWeapon[id] = true;
		}

		case 2:
		{
			give_item(id, "weapon_ak47");
			cs_set_user_bpammo(id, CSW_AK47, 254);
			PrimaryWeapon[id] = AK47_KEY;
			HavePrimaryWeapon[id] = true;
		}

		case 3:
		{
			give_item(id, "weapon_m3");
			cs_set_user_bpammo(id, CSW_M3, 254);
			PrimaryWeapon[id] = M3_KEY;
			HavePrimaryWeapon[id] = true;
		}

		case 4:
		{
			give_item(id, "weapon_famas");
			cs_set_user_bpammo(id, CSW_FAMAS, 254);
			PrimaryWeapon[id] = FAMAS_KEY;
			HavePrimaryWeapon[id] = true;
		}

		case 5:
		{
			give_item(id, "weapon_mp5navy");
			cs_set_user_bpammo(id, CSW_MP5NAVY, 254);
			PrimaryWeapon[id] = MP5_KEY;
			HavePrimaryWeapon[id] = true;
		}

		case 6:
		{
			give_item(id, "weapon_awp");
			cs_set_user_bpammo(id, CSW_AWP, 110);
			PrimaryWeapon[id] = AWP_KEY;
			HavePrimaryWeapon[id] = true;
		}
	}

	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

public GiveLastWeapons(id)
{
	if(!HavePrimaryWeapon[id])
	{
		switch(PrimaryWeapon[id])
		{
			case M4A1_KEY:
			{
				give_item(id, "weapon_m4a1");
				cs_set_user_bpammo(id, CSW_M4A1, 256);
				HavePrimaryWeapon[id] = true;
			}

			case AK47_KEY:
			{
				give_item(id, "weapon_ak47");
				cs_set_user_bpammo(id, CSW_AK47, 256);
				HavePrimaryWeapon[id] = true;
			}

			case M3_KEY:
			{
				give_item(id, "weapon_m3");
				cs_set_user_bpammo(id, CSW_M3, 256);
				HavePrimaryWeapon[id] = true;
			}

			case FAMAS_KEY:
			{
				give_item(id, "weapon_famas");
				cs_set_user_bpammo(id, CSW_FAMAS, 256);
				HavePrimaryWeapon[id] = true;
			}

			case MP5_KEY:
			{
				give_item(id, "weapon_mp5navy");
				cs_set_user_bpammo(id, CSW_MP5NAVY, 256);
				HavePrimaryWeapon[id] = true;
			}

			case AWP_KEY:
			{
				give_item(id, "weapon_awp");
				cs_set_user_bpammo(id, CSW_AWP, 110);
				HavePrimaryWeapon[id] = true;
			}
		}
	}
}

stock ColorChat(id, String[], any:...)
{
	static szMesage[192];
	vformat(szMesage, charsmax(szMesage), String, 3);
	
	replace_all(szMesage, charsmax(szMesage), "!1", "^1");
	replace_all(szMesage, charsmax(szMesage), "!3", "^3");
	replace_all(szMesage, charsmax(szMesage), "!4", "^4");
	
	static g_msg_SayText = 0;
	if(!g_msg_SayText)
		g_msg_SayText = get_user_msgid("SayText");
	
	new Players[32], iNum = 1, i;

 	if(id) Players[0] = id;
	else get_players(Players, iNum, "ch");
	
	for(--iNum; iNum >= 0; iNum--)
	{
		i = Players[iNum];
	
		message_begin(MSG_ONE_UNRELIABLE, g_msg_SayText, _, i);
		write_byte(i);
		write_string(szMesage);
		message_end();
	}
}

stock bacon_strip_weapon(index, weapon[])
{
	if(!equal(weapon, "weapon_", 7)) 
		return PLUGIN_CONTINUE;

	static weaponid;
	weaponid = get_weaponid(weapon)
	
	if(!weaponid) 
		return PLUGIN_CONTINUE;

	static weaponent;
	weaponent = fm_find_ent_by_owner(-1, weapon, index);
	
	if(!weaponent)
		return PLUGIN_CONTINUE;

	if(get_user_weapon(index) == weaponid) 
		ExecuteHamB(Ham_Weapon_RetireWeapon, weaponent);

	if(!ExecuteHamB(Ham_RemovePlayerItem, index, weaponent)) 
		return PLUGIN_CONTINUE;
	
	ExecuteHamB(Ham_Item_Kill, weaponent);
	set_pev(index, pev_weapons, pev(index, pev_weapons) & ~(1<<weaponid));

	return PLUGIN_HANDLED;
}

stock fm_find_ent_by_owner(id, const szClassName[], iOwner, jghgtype = 0)
{
	new str_type[11] = "classname", iEnt = id;

	switch(jghgtype) {

		case 1: str_type = "target";
		case 2: str_type = "targetname";
	}

	while((iEnt = engfunc(EngFunc_FindEntityByString, iEnt, str_type, szClassName)) && pev(iEnt, pev_owner) != iOwner) {  }
	return iEnt;
}
Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
În cazul în care utilizați ceva din addonsurile postate de mine aici, e bine să fiți la curent cu modificările aduse unor plugine, aici.
vasiumihai
Membru, skill 0
Membru, skill 0
Posts: 31
Joined: 11 Jan 2014, 23:15
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
SteamID: STEAM_0:1:83849775
Contact:

13 Aug 2019, 18:39

ok acum merge compilat , are insa probleme , cine ma poate ajuta?
terro primeste arma (nu ar trebui) , si in plus nu poate sa sara , cred ca de la gravitate e problema cade foarte repede jos , de exemplu cand pun fy_snow moare direct , deoarece cand primeste spawn cade.
Post Reply

Return to “Cereri”

  • Information