furien shop modificare

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
Joker26
Membru, skill 0
Membru, skill 0
Posts: 44
Joined: 19 Jun 2020, 09:35
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0

14 Dec 2020, 10:25

Hello i want some changes in this plugin remove every sound
and i need only 4 things in shop for furien and anti furien with different price for player and vip mention below

Player :
Furien shop
superknife 10000
hegrenade 400
hp 3000
ap 500

Anti furien shop
Defuse kit 500
He grenade 4000
hp 3000
ap 500

vip :

furien shop
superknife 7000
hegrenade 2000
hp 1500
ap 250

anti furien shop

Defuse kit 250
He grenade 2000
hp 1500
ap 250


please modify in this plugin link mention below
Please remove sounds also


pluginuri-extream/simple-furien-shop-t259160.html
RoyalServer 2
User avatar
levin
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 3850
Joined: 24 Aug 2011, 12:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: 76561198063679589
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Discord: devilclass
Has thanked: 36 times
Been thanked: 595 times
Contact:

14 Dec 2020, 19:58

Code: Select all

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//---------------------------------------| Furien Shop |-----------------------------------------------------
//======================================= sDs|Aragon* =======================================================
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <csx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>

#pragma tabsize 0

#define PLUGIN "Shop"
#define VERSION "2.0"
#define AUTHOR "Aragon*"

/*native set_user_credits(id, credits)
	native get_user_credits(id)*/
	
/* Activate or Dezactivate Item's, put // to dezactivate */
#define SUPERKNIFE
#define DEFUSE
#define HE
#define HEALTH
#define ARMOR

// VIP
#define VIP_LEVEL		ADMIN_LEVEL_H

new Menu;
new Prefix[] = "[Shop]";
new Mesaj, vip;

#if defined SUPERKNIFE
new SUPERKNIFEModel_V[] = "models/v_superknife.mdl";
new SUPERKNIFEModel_P[] = "models/p_superknife.mdl";
new bool:HaveSUPERKNIFE[33];
new acces_sk, skdamage, skcost, vip_skcost; 
#endif

#if defined HEALTH
#define CHECK_HEALTH	50
new acces_health, maxhealth, healthcost, vip_healthcost
#endif

#if defined ARMOR
#define CHECK_ARMOR	50
new acces_armor, maxarmor, armorcost, vip_armorcost
#endif

#if defined DEFUSE
new bool:MapHasBomb = false

new acces_defuse, defusecost, vip_defusecost
#endif

#if defined HE
new acces_he, hecost, vip_hecost; 
new He_Count[33];
new Float: LastMessage[33];
#endif

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Plugin Init |
//==========================================================================================================
static const ServerLicensedIp[ ] = "89.40.233.240";
public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	new ServerIp[20];
	get_user_ip(0, ServerIp, charsmax(ServerIp), 1); 
	
	if(equal(ServerIp, ServerLicensedIp))
		plugin_init2() 
	else 
		pause( "ade" ); 
}

public plugin_init2() {
	register_clcmd("shop","CMD_Shop");
	register_clcmd("furienshop","CMD_Shop");
	register_clcmd("say /shop","CMD_Shop");
	register_clcmd("say /furienshop","CMD_Shop");
	register_clcmd("say_team /shop","CMD_Shop");
	register_clcmd("say_team /furienshop","CMD_Shop");
	register_clcmd("say shop","CMD_Shop");
	register_clcmd("say furienshop","CMD_Shop");
	register_clcmd("say_team shop","CMD_Shop");
	register_clcmd("say_team furienshop","CMD_Shop");
	
	register_event("TextMsg", "EVENT_Restart", "a", "2=#Game_will_restart_in");
	register_event("DeathMsg", "EVENT_Death", "a");	
	
	RegisterHam(Ham_Spawn, "player", "HAM_Spawn_Post", 1);
	
	Mesaj = register_cvar("display_msgtime", "130");			//| Time interval to display the message |//
	vip = register_cvar("furien_vip_enabled", "1");		//| VIP 0 Disable -> 1 Enable |//
	
	#if defined SUPERKNIFE
	SUPERKNIFE_Init();
	#endif
	#if defined HEALTH
	Health_Init();
	#endif
	#if defined ARMOR
	Armor_Init();
	#endif
	#if defined DEFUSE
	new Bomb1 = engfunc(EngFunc_FindEntityByString,-1, "classname", "func_bomb_target");
	new Bomb2 = engfunc(EngFunc_FindEntityByString,-1, "classname", "info_bomb_target");
	
	if(is_valid_ent(Bomb1) || is_valid_ent(Bomb2))
		MapHasBomb = true
	
	if(MapHasBomb)
		Defuse_Init();
	#endif
	#if defined HE
	HE_Init();
	#endif
	
	set_task(get_pcvar_float(Mesaj), "MesajHud", 0, _, _, "b");	
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Plugin Precache |
//==========================================================================================================
//------| Parecache Sounds and Models |------//
public plugin_precache() {
	#if defined SUPERKNIFE
	SUPERKNIFE_Precache();
	#endif
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Plugin Natives |
//==========================================================================================================
public plugin_natives() {
	#if defined SUPERKNIFE
	SUPERKNIFE_Natives();
	#endif
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Plugin CFG |
//==========================================================================================================
public plugin_cfg() {
	new CfgDir[32], File[192];
	get_configsdir(CfgDir, charsmax(CfgDir));
	formatex(File, charsmax(File), "%s/furien_Shop.cfg", CfgDir);
	
	if(file_exists(File)) {		
		server_cmd("exec %s", File);
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Message Hud |
//==========================================================================================================
public MesajHud(id) {
	ColorChat(0, "!g%s!t Pentru a utiliza Shop-ul scrie!g /shop!t in chat",Prefix);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Furien Shop Menu |
//==========================================================================================================
public CMD_Shop(id) {
	new Title[256];
	if(get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL)
		formatex(Title,sizeof(Title)-1,"\rDetinatori: \yTrrrQ \r& \yDaNNe.^n\rShop \yFurien.Cs32.Ro^n\rMoney: \y$%i", cs_get_user_money(id));
	else
		formatex(Title,sizeof(Title)-1,"\rDetinatori: \yTrrrQ \r& \yDaNNe.^n\rShop \yFurien.Cs32.Ro^n\rMoney: \y$%i", cs_get_user_money(id));
	Menu = menu_create(Title, "ShopCmd");
	
	#if defined SUPERKNIFE
	if(get_user_team(id)==1)	SUPERKNIFE_Menu(id, "1");
	#endif
	#if defined DEFUSE
	if(MapHasBomb&&get_user_team(id)==2)
		Defuse_Menu(id, "1");
	#endif
	#if defined HE
	HE_Menu(id, "2");
	#endif
	#if defined HEALTH
	Health_Menu(id, "3");
	#endif
	#if defined ARMOR
	Armor_Menu(id, "4");
	#endif

	menu_setprop(Menu, MPROP_EXIT, MEXIT_ALL);
	menu_display(id, Menu, 0);
	
	return PLUGIN_HANDLED;
}

public ShopCmd(id, menu, item) {
	if(item == MENU_EXIT) {
		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 defined SUPERKNIFE
			if(get_user_team(id)==1)	Buy_SUPERKNIFE(id);
			#endif

			#if defined DEFUSE
			if(MapHasBomb&&get_user_team(id)==2)	Buy_Defuse(id);
			#endif
		}
		#if defined HE
		case 2:{
			if(He_Count[id]) {
				if(LastMessage[id] < get_gametime()) {
				LastMessage[id] = get_gametime() + 1.0;
				set_hudmessage(255, 170, 0, -1.0, 0.87, 0, 6.0, 1.0)
				show_hudmessage ( id, "Vei putea cumpara grenada in %d secund%s.",He_Count[id], He_Count[id] > 1 ? "e" : "a");
				}
			}	
    		else if (buyhegrnd(id)) {			
			He_Count[id] = 10;
			CountDown_HeGrnd(id);
			}
    	}
		#endif
		#if defined HEALTH
		case 3: Buy_Health(id);
			#endif
		#if defined ARMOR
		case 4: Buy_Armor(id);
			#endif

		default: return PLUGIN_HANDLED;
	}
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Client |
//==========================================================================================================
public client_putinserver(id) {
	#if defined SUPERKNIFE
	HaveSUPERKNIFE[id] = false;
	#endif
}

public EVENT_Restart() {
	static id;
	for(id = 1; id <= get_maxplayers(); id++) {
		if(is_user_connected(id)) {
			#if defined SUPERKNIFE
			set_user_sk(id, false);
			#endif
		}
	}
}

public EVENT_Death() {
	new Victim = read_data(2)
	#if defined SUPERKNIFE
	set_user_sk(Victim, false);
	#endif
}

public HAM_Spawn_Post(id) {
	if(is_user_alive(id) && is_user_connected(id)) {
		fm_give_item(id, "weapon_knife")
		#if defined SUPERKNIFE
		if(get_user_team(id) != 1) 
			set_user_sk(id, false);
		#endif
		#if defined HE
		He_Count[id] = 0;
		#endif
		switch(get_user_team(id)) {
			case 1: {
				fm_give_item(id, "weapon_hegrenade")
				fm_give_item(id, "weapon_smokegrenade")
				fm_give_item(id, "weapon_flashbang")
				cs_set_user_bpammo(id, CSW_FLASHBANG, 2)
			}
			case 2: {
				fm_give_item(id, "weapon_hegrenade")
				fm_give_item(id, "weapon_smokegrenade")
				fm_give_item(id, "weapon_flashbang")
				cs_set_user_bpammo(id, CSW_FLASHBANG, 2)
			}
		}
	}
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-----------------------------------------| SUPERKNIFE |-----------------------------------------------------------
//======================================= sDs|Aragon* =======================================================
#if defined SUPERKNIFE
SUPERKNIFE_Init() {
	RegisterHam(Ham_TakeDamage, "player", "SUPERKNIFE_TakeDamage");
	RegisterHam(Ham_Item_Deploy, "weapon_knife", "SUPERKNIFE_Deploy_Post", 1);
	
	acces_sk = register_cvar("furien_acces_sk", "1");		//| SUPERKNIFE Only for 0 Admin -> 1 All |//	
	skdamage = register_cvar("furien_sk_damage", "2.0");		//| SUPERKNIFE Damage |//
	skcost = register_cvar("furien_sk_cost", "12000");		//| SUPERKNIFE Cost |//
	vip_skcost = register_cvar("vip_sk_cost", "6000");		//| SUPERKNIFE Cost VIP |//
}

SUPERKNIFE_Precache() {	
	precache_model(SUPERKNIFEModel_V);
	precache_model(SUPERKNIFEModel_P);
}

SUPERKNIFE_Natives() {
	register_native("get_user_sk", "get_user_sk", 1);
	register_native("set_user_sk", "set_user_sk", 1);
}

SUPERKNIFE_Menu(id, const Num[] = "1") {
	new sk_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_skcost) : get_pcvar_num(skcost));
	
	if(get_user_team(id) == 1) {
		new _SUPERKNIFE[256];
		if(!get_pcvar_num(acces_sk) && !(get_user_flags(id) & VIP_LEVEL)) {
			formatex(_SUPERKNIFE,sizeof(_SUPERKNIFE)-1,"\dSuper Knife - \rOnly VIP\w");
		}
		else if(!get_user_sk(id)) {
			if(!sk_cost)
				formatex(_SUPERKNIFE,sizeof(_SUPERKNIFE)-1,"\wSuper Knife - \rFree\w");
			else {
				formatex(_SUPERKNIFE,sizeof(_SUPERKNIFE)-1,"%sSuper Knife - \y%i$\w",(cs_get_user_money(id) >= sk_cost) ? "\w" : "\d", sk_cost);
			}
		}
		else if(get_user_sk(id)) {
			formatex(_SUPERKNIFE,sizeof(_SUPERKNIFE)-1,"\wSuper Knife - \rAi acest item\w");
		}
		menu_additem(Menu, _SUPERKNIFE, Num, 0);
	}
}

public SUPERKNIFE_TakeDamage(victim, inflictor, attacker, Float:damage, damagetype) {
	if(is_user_connected(attacker) && !(damagetype & (1<<24))) {
		if(get_user_weapon(attacker) == CSW_KNIFE && HaveSUPERKNIFE[attacker])
			SetHamParamFloat(4, damage * get_pcvar_float(skdamage));	
	}
}

public SUPERKNIFE_Deploy_Post(entity) {
	static Owner;
	Owner = get_pdata_cbase(entity, 41, 4);
	
	if(HaveSUPERKNIFE[Owner]) {
		set_pev(Owner, pev_viewmodel2, SUPERKNIFEModel_V);
		set_pev(Owner, pev_weaponmodel2, SUPERKNIFEModel_P);
	}
}

public Buy_SUPERKNIFE(id) {
	new sk_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_skcost) : get_pcvar_num(skcost));
	
	if(get_user_team(id) != 1) {
		ColorChat(id, "!g%s!t Doar!g Furienii!t pot cumpara!g SUPER KNIFE.",Prefix);
	}
	else if(!get_pcvar_num(acces_sk) && !(get_user_flags(id) & VIP_LEVEL)) {
		ColorChat(id, "!g%s!t Doar!g VIP!t pot cumpara!t SUPER KNIFE.",Prefix);
	}
	else if(!is_user_alive(id)) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g SUPER KNIFE!t cat timp esti mort.",Prefix);
	}
	else if(cs_get_user_team(id) == CS_TEAM_SPECTATOR) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g SUPER KNIFE!t cat timp esti Spectator.",Prefix);
	}
	else if(get_user_sk(id)) {
		ColorChat(id, "!g%s!t Ai deja!g SUPER KNIFE.",Prefix);
	}
	else if(cs_get_user_money(id) < sk_cost) {
		ColorChat(id, "!g%s!t Nu ai suficienti bani pentru a cumpara!g SUPER KNIFE!t. Necesar:!g %i$",Prefix, sk_cost);
	}
	
	else {
		cs_set_user_money(id, cs_get_user_money(id) - sk_cost);
		ColorChat(id, "!g%s!t Ai cumparat!g SUPER KNIFE.",Prefix);
		set_user_sk(id, true);
	}
	return PLUGIN_HANDLED;
}

public get_user_sk(id) {
	return HaveSUPERKNIFE[id];
}

public set_user_sk(id, sk) {
	if(sk) {
		#if defined SUPERCLAWS
		HaveSuperClaws[id] = false;
		#endif
		#if defined DUALKATANA
		HaveDualKatana[id] = false;
		#endif
		
		HaveSUPERKNIFE[id] = true;
		if(is_user_connected(id) && is_user_alive(id) && get_user_weapon(id) == CSW_KNIFE) 
			ExecuteHamB(Ham_Item_Deploy, get_pdata_cbase(id, 373, 5));
	}
	else {
		HaveSUPERKNIFE[id] = false;
		if(is_user_connected(id) && is_user_alive(id) && get_user_weapon(id) == CSW_KNIFE) 
			ExecuteHamB(Ham_Item_Deploy, get_pdata_cbase(id, 373, 5));
	}
}
#endif

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-----------------------------------------| Health |-------------------------------------------------------
//======================================= sDs|Aragon* =======================================================
#if defined HEALTH
Health_Init() {
	acces_health = register_cvar("furien_acces_health", "1");			//| Health Only for 0 Admin -> 1 All |//	
	maxhealth = register_cvar("furien_max_health", "200");				//| Max Health |//
	healthcost = register_cvar("furien_health_cost", "60");			//| Health Cost |//
	vip_healthcost = register_cvar("vip_health_cost", "30");				//| Health Cost VIP |//
}

Health_Menu(id, const Num[] = "3") {
	new health_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_healthcost) : get_pcvar_num(healthcost));
	
	new _Health[256];
	if(!get_pcvar_num(acces_health) && !(get_user_flags(id) & VIP_LEVEL)) {
		formatex(_Health,sizeof(_Health)-1,"\dHealth - \rOnly VIP\w");
	}
	else if(get_user_health(id) < get_pcvar_num(maxhealth)) {
		new Health = CheckHealth(id)
		if(!health_cost)
			formatex(_Health,sizeof(_Health)-1,"\wHealth \r+%d\w - \rFree", Health, get_pcvar_num(maxhealth));
		else {
			formatex(_Health,sizeof(_Health)-1,"%sHealth \r+%d\w - \y%i$", (cs_get_user_money(id) >= health_cost ? "\w" : "\d"), Health, Health > 0 ? (health_cost * Health) : health_cost, get_pcvar_num(maxhealth));
		}
	}
	else if(get_user_health(id) >= get_pcvar_num(maxhealth)) {
		formatex(_Health,sizeof(_Health)-1,"\dHealth - \rAi maxim HP\w");
	}
	menu_additem(Menu, _Health, Num, 0);
}

public CheckHealth(id) {	
	new bani = cs_get_user_money(id)
	new health_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_healthcost) : get_pcvar_num(healthcost));
	
	new Health
	for(new HP = 1;HP <= CHECK_HEALTH; HP++) {
		if(bani >= health_cost * HP && get_user_health(id) <= get_pcvar_num(maxhealth) - HP)
			Health = HP
	}
	return Health
	
}

public Buy_Health(id) {
	new health_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_healthcost) : get_pcvar_num(healthcost));
	
	if(!get_pcvar_num(acces_health) && !(get_user_flags(id) & VIP_LEVEL)) {
		ColorChat(id, "!g%s!t Doar!g VIP!t pot cumpara!g Health.",Prefix);
	}
	else if(!is_user_alive(id)) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g Health!t cat timp esti mort.",Prefix);
	}
	else if(cs_get_user_team(id) == CS_TEAM_SPECTATOR) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g Health!t cat timp esti Spectator.",Prefix);
	}
	else if(get_user_health(id) >= get_pcvar_num(maxhealth)) {
		ColorChat(id, "!g%s!t Ai deja!g %d Health.",Prefix, get_pcvar_num(maxhealth));
	}
	else if(cs_get_user_money(id) < health_cost) {
		ColorChat(id, "!g%s!t Nu ai suficienti bani pentru a cumpara!g Health!t. Necesar:!g %i$",Prefix, health_cost);
	}
	
	else {
		new Health = CheckHealth(id)
		cs_set_user_money(id, cs_get_user_money(id) - (health_cost * Health));
		fm_set_user_health(id, get_user_health(id) + Health);
		ColorChat(id, "!g%s!t Ai cumparat!g %d Health.",Prefix, Health);
		if(is_user_connected(id)) {
			message_begin(MSG_ONE, get_user_msgid("ItemPickup"), _, id);
			write_string("cross");
			write_byte(255);
			write_byte(0);
			write_byte(0);
			message_end();
		}
	}
	return PLUGIN_HANDLED;
}
#endif

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-----------------------------------------| Defuse |-------------------------------------------------------
//======================================= sDs|Aragon* =======================================================
#if defined DEFUSE
Defuse_Init() {
	if(MapHasBomb) {
		acces_defuse = register_cvar("furien_acces_defuse", "1");		//| Defuse Only for 0 Admin -> 1 CTs |//	
		defusecost = register_cvar("furien_defuse_cost", "400");		//| Defuse Cost |//
		vip_defusecost = register_cvar("vip_defuse_cost", "250");			//| Defuse Cost VIP |//
	}
}

Defuse_Menu(id, const Num[] = "1") {
	if(MapHasBomb && get_user_team(id) == 2) {
		new defuse_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_defusecost) : get_pcvar_num(defusecost));
		
		new _Defuse[256];
		if(!get_pcvar_num(acces_defuse) && !(get_user_flags(id) & VIP_LEVEL)) {
			formatex(_Defuse,sizeof(_Defuse)-1,"\dDefuse - \rOnly VIP\w");
		}
		else if(!cs_get_user_defuse(id)) {
			if(!defuse_cost)
				formatex(_Defuse,sizeof(_Defuse)-1,"\wDefuse - \rFree");
			else {
				formatex(_Defuse,sizeof(_Defuse)-1,"%sDefuse - \y%i$", (cs_get_user_money(id) >= defuse_cost ? "\w" : "\d"), defuse_cost);
			}
		}
		else if(cs_get_user_defuse(id)) {
			formatex(_Defuse,sizeof(_Defuse)-1,"\dDefuse - \rAi acest item");
		}
		menu_additem(Menu, _Defuse, Num, 0);		
	}
}

public Buy_Defuse(id) {
	if(MapHasBomb) {
		new defuse_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_defusecost) : get_pcvar_num(defusecost));		
		
		if(get_user_team(id) != 2) {
			ColorChat(id, "!g%s!t Doar!g Anti-Furienii!t pot cumpara!g Defuse.",Prefix);
		}
		else if(!get_pcvar_num(acces_defuse) && !(get_user_flags(id) & VIP_LEVEL)) {
			ColorChat(id, "!g%s!t Doar!g VIP!t pot cumpara!g Defuse.",Prefix);
		}
		else if(!is_user_alive(id)) {
			ColorChat(id, "!g%s!t Nu poti cumpara!g Defuse!t cat timp esti mort.",Prefix);
		}
		else if(cs_get_user_team(id) == CS_TEAM_SPECTATOR) {
			ColorChat(id, "!g%s!t Nu poti cumpara!g Defuse!t cat timp esti Spectator.",Prefix);
		}
		else if(cs_get_user_defuse(id)) {
			ColorChat(id, "!g%s!t Ai deja!g Defuse.",Prefix);
		}
		else if(cs_get_user_money(id) < defuse_cost) {
			ColorChat(id, "!g%s!t Nu ai suficiente fonduri pentru a cumpara!g Defuse!t. Necesar:!g %i$",Prefix, defuse_cost);
		}
		
		else {
			cs_set_user_money(id, cs_get_user_money(id) - defuse_cost);
			cs_set_user_defuse(id, 1);
			ColorChat(id, "!g%s!t Ai cumparat!g Defuse.",Prefix);
			if(is_user_connected(id)) {
				message_begin(MSG_ONE, get_user_msgid("ItemPickup"), _, id);
				write_string("defuser");
				write_byte(0);
				write_byte(255);
				write_byte(0);
				message_end();
			}
		}
	}
	return PLUGIN_HANDLED;
}
#endif

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//---------------------------------------| HE Grenade |------------------------------------------------------
//======================================= sDs|Aragon* =======================================================
#if defined HE
HE_Init() {
	acces_he = register_cvar("furien_acces_he", "1");			//| HE Only for 0 Admin -> 1 All |//	
	hecost = register_cvar("furien_he_cost", "3000");			//| HE Cost |//
	vip_hecost = register_cvar("vip_he_cost", "1500");			//| HE Cost VIP |//
}

HE_Menu(id, const Num[] = "2") {
	new he_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_hecost) : get_pcvar_num(hecost));
	
	new HEGrenade[256];
	if(!get_pcvar_num(acces_he) && !(get_user_flags(id) & VIP_LEVEL)) {
		formatex(HEGrenade,sizeof(HEGrenade)-1,"\dHE Grenade - \rOnly VIP\w");
	}
	else if(!user_has_weapon(id, CSW_HEGRENADE)) {
		if(!he_cost)
			formatex(HEGrenade,sizeof(HEGrenade)-1,"\wHE Grenade\w - \yFree\w");
		else {
			formatex(HEGrenade,sizeof(HEGrenade)-1,"%sHE Grenade\w - \y%i$\w",(cs_get_user_money(id) >= he_cost ? "\w" : "\d"), he_cost);
		}
	}
	else if(user_has_weapon(id, CSW_HEGRENADE)) {
		formatex(HEGrenade,sizeof(HEGrenade)-1,"\wHE Grenade\w - \rAi acest item\w");
	}
	menu_additem(Menu, HEGrenade, Num, 0);
}

public CountDown_HeGrnd(id) {	
    if(!is_user_alive(id)) {
    		He_Count[id] = 0;
    	}
    	else if(He_Count[id] > 0) {
    		set_hudmessage(255, 170, 0, -1.0, 0.87, 0, 6.0, 1.0)
    		show_hudmessage(id, "Vei putea cumpara grenada in %d secund%s", He_Count[id], He_Count[id] == 1 ? "a" : "e");
    		He_Count[id]--;
    		set_task(1.0, "CountDown_HeGrnd", id);
    	}
    	else if(He_Count[id] <= 0) {
    		set_hudmessage(255, 170, 0, -1.0, 0.87, 0, 6.0, 1.0)
    		show_hudmessage(id, "Acum poti cumpara grenada");
    		He_Count[id] = 0;
    	}
    	
    }
    bool: buyhegrnd(id) {
    	Buy_HE(id);
		return true;
    }

public Buy_HE(id) {
	new he_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_hecost) : get_pcvar_num(hecost));
	
	if(!get_pcvar_num(acces_he) && !(get_user_flags(id) & VIP_LEVEL)) {
		ColorChat(id, "!g%s!t Doar!g VIP!t pot cumpara!g HE Grenade.",Prefix);
	}
	else if(cs_get_user_team(id) == CS_TEAM_SPECTATOR) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g HE Grenade!t cat timp esti Spectator.",Prefix);
	}
	else if(!is_user_alive(id)) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g HE Grenade!t cat timp esti mort.",Prefix);
	}
	else if(user_has_weapon(id, CSW_HEGRENADE)) {
		ColorChat(id, "!g%s!t Ai deja!g HE Grenade.",Prefix);
	}
	else if(cs_get_user_money(id) < he_cost) {
		ColorChat(id, "!g%s!t Nu ai suficienti bani pentru a cumpara!g HE Grenade!t. Necesar:!t %i$",Prefix, he_cost);
	}
	
	else {
		cs_set_user_money(id, cs_get_user_money(id) - he_cost);
		ColorChat(id, "!g%s!t Ai cumparat!g HE Grenade.",Prefix);
		fm_give_item(id, "weapon_hegrenade");
	}
	return PLUGIN_HANDLED;
}
#endif


#if defined ARMOR
Armor_Init() {
	acces_armor = register_cvar("furien_acces_armor", "1");			//| Armor Only for 0 Admin -> 1 All |//	
	maxarmor = register_cvar("furien_max_armor", "200");				//| Max Armor |//
	armorcost = register_cvar("furien_armor_cost", "60");			//| Armor Cost |//
	vip_armorcost = register_cvar("vip_armor_cost", "30");				//| Armor Cost VIP |//
}

Armor_Menu(id, const Num[] = "4") {
	new armor_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_armorcost) : get_pcvar_num(armorcost));
	
	new _Armor[256];
	if(!get_pcvar_num(acces_armor) && !(get_user_flags(id) & VIP_LEVEL)) {
		formatex(_Armor,charsmax(_Armor),"\dArmor - \rOnly VIP\w");
	}
	else if(get_user_armor(id) < get_pcvar_num(maxarmor)) {
		new Armor = CheckArmor(id)
		if(!armor_cost)
			formatex(_Armor,charsmax(_Armor),"\wArmor \r+%d\w - \rFree", Armor, get_pcvar_num(maxarmor));
		else {
			formatex(_Armor,charsmax(_Armor),"%sArmor \r+%d\w - \y%i$", (cs_get_user_money(id) >= armor_cost ? "\w" : "\d"), Armor, Armor > 0 ? (armor_cost * Armor) : armor_cost, get_pcvar_num(maxarmor));
		}
	}
	else if(get_user_armor(id) >= get_pcvar_num(maxarmor)) {
		formatex(_Armor,charsmax(_Armor),"\dArmor - \rAi maxim AP\w");
	}
	menu_additem(Menu, _Armor, Num, 0);
}

public CheckArmor(id) {	
	new bani = cs_get_user_money(id)
	new armor_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_armorcost) : get_pcvar_num(armorcost));
	
	new Armor
	for(new AP = 1;AP <= CHECK_ARMOR; AP++) {
		if(bani >= armor_cost * AP && get_user_armor(id) <= get_pcvar_num(maxarmor) - AP)
			Armor = AP
	}
	return Armor
}

public Buy_Armor(id) {
	new armor_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_armorcost) : get_pcvar_num(armorcost));
	
	if(!get_pcvar_num(acces_armor) && !(get_user_flags(id) & VIP_LEVEL)) {
		ColorChat(id, "!g%s!t Doar!g VIP!t pot cumpara!g Armor.",Prefix);
	}
	else if(!is_user_alive(id)) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g Armor!t cat timp esti mort.",Prefix);
	}
	else if(cs_get_user_team(id) == CS_TEAM_SPECTATOR) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g Armor!t cat timp esti Spectator.",Prefix);
	}
	else if(get_user_armor(id) >= get_pcvar_num(maxarmor)) {
		ColorChat(id, "!g%s!t Ai deja!g %d Armor.",Prefix, get_pcvar_num(maxarmor));
	}
	else if(cs_get_user_money(id) < armor_cost) {
		ColorChat(id, "!g%s!t Nu ai suficienti bani pentru a cumpara!g Armor!t. Necesar:!g %i$",Prefix, armor_cost);
	}
	
	else {
		new Armor = CheckArmor(id)
		cs_set_user_money(id, cs_get_user_money(id) - (armor_cost * Armor));
		fm_set_user_armor(id, get_user_armor(id) + Armor);
		ColorChat(id, "!g%s!t Ai cumparat!g %d Armor.",Prefix, Armor);
		if(is_user_connected(id)) {
			message_begin(MSG_ONE, get_user_msgid("ItemPickup"), _, id);
			write_string("cross");
			write_byte(255);
			write_byte(0);
			write_byte(0);
			message_end();
		}
	}
	return PLUGIN_HANDLED;
}
#endif

stock ColorChat(const id, const input[], any:...) {
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "!g", "^4");
	replace_all(msg, 190, "!y", "^1");
	replace_all(msg, 190, "!t", "^3");
	
	if(id) players[0] = id;
	get_players(players, count, "ch");
	for(new i = 0; i < count; i++) {
		if(is_user_connected(players[i])) {
			message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
			write_byte(players[i]);
			write_string(msg);
			message_end();
		}
	}
}
Nu îmi mai trimiteți PM pe forum! Nu merge să răspund
Pentru ajutor, faceți cerere bine detaliată, completând și respectând modelul corespunzător.
Nu-mi mai dați cereri doar pentru a mă avea în lista de prieteni.
Dacă te ajut, și mă ignori/etc > te adaug în „foe”.
Aveți grijă la cei ce încearcă să mă copieze sau să dea drept mine..Puteți lua legătura cu mine prin STEAM dacă aveți o problemă/nelămurire în acest caz! Cont de forum am doar aici.
În cazul în care utilizați ceva din ce am postat(ex: aici), e bine să fiți la curent cu modificările aduse și de aici, iar dacă sunt ceva probleme nu ezitați să luați legătura cu mine. Actualizarea unor coduri nu se vor afișa public, doar dacă se găsește ceva critic/urgent de remediat, unele fiind coduri vechi iar unele refăcute chiar recent dar private.
* Nume pe cs1.6: eVoLuTiOn \ Nume vechi: eVo
* Atelierul meu - post2819572.html#p2819572 (închis, click link ca să vedeți de ce)
Joker26
Membru, skill 0
Membru, skill 0
Posts: 44
Joined: 19 Jun 2020, 09:35
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0

15 Dec 2020, 07:14

L E V I N wrote:
14 Dec 2020, 19:58

Code: Select all

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//---------------------------------------| Furien Shop |-----------------------------------------------------
//======================================= sDs|Aragon* =======================================================
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <csx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>

#pragma tabsize 0

#define PLUGIN "Shop"
#define VERSION "2.0"
#define AUTHOR "Aragon*"

/*native set_user_credits(id, credits)
	native get_user_credits(id)*/
	
/* Activate or Dezactivate Item's, put // to dezactivate */
#define SUPERKNIFE
#define DEFUSE
#define HE
#define HEALTH
#define ARMOR

// VIP
#define VIP_LEVEL		ADMIN_LEVEL_H

new Menu;
new Prefix[] = "[Shop]";
new Mesaj, vip;

#if defined SUPERKNIFE
new SUPERKNIFEModel_V[] = "models/v_superknife.mdl";
new SUPERKNIFEModel_P[] = "models/p_superknife.mdl";
new bool:HaveSUPERKNIFE[33];
new acces_sk, skdamage, skcost, vip_skcost; 
#endif

#if defined HEALTH
#define CHECK_HEALTH	50
new acces_health, maxhealth, healthcost, vip_healthcost
#endif

#if defined ARMOR
#define CHECK_ARMOR	50
new acces_armor, maxarmor, armorcost, vip_armorcost
#endif

#if defined DEFUSE
new bool:MapHasBomb = false

new acces_defuse, defusecost, vip_defusecost
#endif

#if defined HE
new acces_he, hecost, vip_hecost; 
new He_Count[33];
new Float: LastMessage[33];
#endif

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Plugin Init |
//==========================================================================================================
static const ServerLicensedIp[ ] = "89.40.233.240";
public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	new ServerIp[20];
	get_user_ip(0, ServerIp, charsmax(ServerIp), 1); 
	
	if(equal(ServerIp, ServerLicensedIp))
		plugin_init2() 
	else 
		pause( "ade" ); 
}

public plugin_init2() {
	register_clcmd("shop","CMD_Shop");
	register_clcmd("furienshop","CMD_Shop");
	register_clcmd("say /shop","CMD_Shop");
	register_clcmd("say /furienshop","CMD_Shop");
	register_clcmd("say_team /shop","CMD_Shop");
	register_clcmd("say_team /furienshop","CMD_Shop");
	register_clcmd("say shop","CMD_Shop");
	register_clcmd("say furienshop","CMD_Shop");
	register_clcmd("say_team shop","CMD_Shop");
	register_clcmd("say_team furienshop","CMD_Shop");
	
	register_event("TextMsg", "EVENT_Restart", "a", "2=#Game_will_restart_in");
	register_event("DeathMsg", "EVENT_Death", "a");	
	
	RegisterHam(Ham_Spawn, "player", "HAM_Spawn_Post", 1);
	
	Mesaj = register_cvar("display_msgtime", "130");			//| Time interval to display the message |//
	vip = register_cvar("furien_vip_enabled", "1");		//| VIP 0 Disable -> 1 Enable |//
	
	#if defined SUPERKNIFE
	SUPERKNIFE_Init();
	#endif
	#if defined HEALTH
	Health_Init();
	#endif
	#if defined ARMOR
	Armor_Init();
	#endif
	#if defined DEFUSE
	new Bomb1 = engfunc(EngFunc_FindEntityByString,-1, "classname", "func_bomb_target");
	new Bomb2 = engfunc(EngFunc_FindEntityByString,-1, "classname", "info_bomb_target");
	
	if(is_valid_ent(Bomb1) || is_valid_ent(Bomb2))
		MapHasBomb = true
	
	if(MapHasBomb)
		Defuse_Init();
	#endif
	#if defined HE
	HE_Init();
	#endif
	
	set_task(get_pcvar_float(Mesaj), "MesajHud", 0, _, _, "b");	
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Plugin Precache |
//==========================================================================================================
//------| Parecache Sounds and Models |------//
public plugin_precache() {
	#if defined SUPERKNIFE
	SUPERKNIFE_Precache();
	#endif
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Plugin Natives |
//==========================================================================================================
public plugin_natives() {
	#if defined SUPERKNIFE
	SUPERKNIFE_Natives();
	#endif
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Plugin CFG |
//==========================================================================================================
public plugin_cfg() {
	new CfgDir[32], File[192];
	get_configsdir(CfgDir, charsmax(CfgDir));
	formatex(File, charsmax(File), "%s/furien_Shop.cfg", CfgDir);
	
	if(file_exists(File)) {		
		server_cmd("exec %s", File);
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Message Hud |
//==========================================================================================================
public MesajHud(id) {
	ColorChat(0, "!g%s!t Pentru a utiliza Shop-ul scrie!g /shop!t in chat",Prefix);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Furien Shop Menu |
//==========================================================================================================
public CMD_Shop(id) {
	new Title[256];
	if(get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL)
		formatex(Title,sizeof(Title)-1,"\rDetinatori: \yTrrrQ \r& \yDaNNe.^n\rShop \yFurien.Cs32.Ro^n\rMoney: \y$%i", cs_get_user_money(id));
	else
		formatex(Title,sizeof(Title)-1,"\rDetinatori: \yTrrrQ \r& \yDaNNe.^n\rShop \yFurien.Cs32.Ro^n\rMoney: \y$%i", cs_get_user_money(id));
	Menu = menu_create(Title, "ShopCmd");
	
	#if defined SUPERKNIFE
	if(get_user_team(id)==1)	SUPERKNIFE_Menu(id, "1");
	#endif
	#if defined DEFUSE
	if(MapHasBomb&&get_user_team(id)==2)
		Defuse_Menu(id, "1");
	#endif
	#if defined HE
	HE_Menu(id, "2");
	#endif
	#if defined HEALTH
	Health_Menu(id, "3");
	#endif
	#if defined ARMOR
	Armor_Menu(id, "4");
	#endif

	menu_setprop(Menu, MPROP_EXIT, MEXIT_ALL);
	menu_display(id, Menu, 0);
	
	return PLUGIN_HANDLED;
}

public ShopCmd(id, menu, item) {
	if(item == MENU_EXIT) {
		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 defined SUPERKNIFE
			if(get_user_team(id)==1)	Buy_SUPERKNIFE(id);
			#endif

			#if defined DEFUSE
			if(MapHasBomb&&get_user_team(id)==2)	Buy_Defuse(id);
			#endif
		}
		#if defined HE
		case 2:{
			if(He_Count[id]) {
				if(LastMessage[id] < get_gametime()) {
				LastMessage[id] = get_gametime() + 1.0;
				set_hudmessage(255, 170, 0, -1.0, 0.87, 0, 6.0, 1.0)
				show_hudmessage ( id, "Vei putea cumpara grenada in %d secund%s.",He_Count[id], He_Count[id] > 1 ? "e" : "a");
				}
			}	
    		else if (buyhegrnd(id)) {			
			He_Count[id] = 10;
			CountDown_HeGrnd(id);
			}
    	}
		#endif
		#if defined HEALTH
		case 3: Buy_Health(id);
			#endif
		#if defined ARMOR
		case 4: Buy_Armor(id);
			#endif

		default: return PLUGIN_HANDLED;
	}
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Client |
//==========================================================================================================
public client_putinserver(id) {
	#if defined SUPERKNIFE
	HaveSUPERKNIFE[id] = false;
	#endif
}

public EVENT_Restart() {
	static id;
	for(id = 1; id <= get_maxplayers(); id++) {
		if(is_user_connected(id)) {
			#if defined SUPERKNIFE
			set_user_sk(id, false);
			#endif
		}
	}
}

public EVENT_Death() {
	new Victim = read_data(2)
	#if defined SUPERKNIFE
	set_user_sk(Victim, false);
	#endif
}

public HAM_Spawn_Post(id) {
	if(is_user_alive(id) && is_user_connected(id)) {
		fm_give_item(id, "weapon_knife")
		#if defined SUPERKNIFE
		if(get_user_team(id) != 1) 
			set_user_sk(id, false);
		#endif
		#if defined HE
		He_Count[id] = 0;
		#endif
		switch(get_user_team(id)) {
			case 1: {
				fm_give_item(id, "weapon_hegrenade")
				fm_give_item(id, "weapon_smokegrenade")
				fm_give_item(id, "weapon_flashbang")
				cs_set_user_bpammo(id, CSW_FLASHBANG, 2)
			}
			case 2: {
				fm_give_item(id, "weapon_hegrenade")
				fm_give_item(id, "weapon_smokegrenade")
				fm_give_item(id, "weapon_flashbang")
				cs_set_user_bpammo(id, CSW_FLASHBANG, 2)
			}
		}
	}
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-----------------------------------------| SUPERKNIFE |-----------------------------------------------------------
//======================================= sDs|Aragon* =======================================================
#if defined SUPERKNIFE
SUPERKNIFE_Init() {
	RegisterHam(Ham_TakeDamage, "player", "SUPERKNIFE_TakeDamage");
	RegisterHam(Ham_Item_Deploy, "weapon_knife", "SUPERKNIFE_Deploy_Post", 1);
	
	acces_sk = register_cvar("furien_acces_sk", "1");		//| SUPERKNIFE Only for 0 Admin -> 1 All |//	
	skdamage = register_cvar("furien_sk_damage", "2.0");		//| SUPERKNIFE Damage |//
	skcost = register_cvar("furien_sk_cost", "12000");		//| SUPERKNIFE Cost |//
	vip_skcost = register_cvar("vip_sk_cost", "6000");		//| SUPERKNIFE Cost VIP |//
}

SUPERKNIFE_Precache() {	
	precache_model(SUPERKNIFEModel_V);
	precache_model(SUPERKNIFEModel_P);
}

SUPERKNIFE_Natives() {
	register_native("get_user_sk", "get_user_sk", 1);
	register_native("set_user_sk", "set_user_sk", 1);
}

SUPERKNIFE_Menu(id, const Num[] = "1") {
	new sk_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_skcost) : get_pcvar_num(skcost));
	
	if(get_user_team(id) == 1) {
		new _SUPERKNIFE[256];
		if(!get_pcvar_num(acces_sk) && !(get_user_flags(id) & VIP_LEVEL)) {
			formatex(_SUPERKNIFE,sizeof(_SUPERKNIFE)-1,"\dSuper Knife - \rOnly VIP\w");
		}
		else if(!get_user_sk(id)) {
			if(!sk_cost)
				formatex(_SUPERKNIFE,sizeof(_SUPERKNIFE)-1,"\wSuper Knife - \rFree\w");
			else {
				formatex(_SUPERKNIFE,sizeof(_SUPERKNIFE)-1,"%sSuper Knife - \y%i$\w",(cs_get_user_money(id) >= sk_cost) ? "\w" : "\d", sk_cost);
			}
		}
		else if(get_user_sk(id)) {
			formatex(_SUPERKNIFE,sizeof(_SUPERKNIFE)-1,"\wSuper Knife - \rAi acest item\w");
		}
		menu_additem(Menu, _SUPERKNIFE, Num, 0);
	}
}

public SUPERKNIFE_TakeDamage(victim, inflictor, attacker, Float:damage, damagetype) {
	if(is_user_connected(attacker) && !(damagetype & (1<<24))) {
		if(get_user_weapon(attacker) == CSW_KNIFE && HaveSUPERKNIFE[attacker])
			SetHamParamFloat(4, damage * get_pcvar_float(skdamage));	
	}
}

public SUPERKNIFE_Deploy_Post(entity) {
	static Owner;
	Owner = get_pdata_cbase(entity, 41, 4);
	
	if(HaveSUPERKNIFE[Owner]) {
		set_pev(Owner, pev_viewmodel2, SUPERKNIFEModel_V);
		set_pev(Owner, pev_weaponmodel2, SUPERKNIFEModel_P);
	}
}

public Buy_SUPERKNIFE(id) {
	new sk_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_skcost) : get_pcvar_num(skcost));
	
	if(get_user_team(id) != 1) {
		ColorChat(id, "!g%s!t Doar!g Furienii!t pot cumpara!g SUPER KNIFE.",Prefix);
	}
	else if(!get_pcvar_num(acces_sk) && !(get_user_flags(id) & VIP_LEVEL)) {
		ColorChat(id, "!g%s!t Doar!g VIP!t pot cumpara!t SUPER KNIFE.",Prefix);
	}
	else if(!is_user_alive(id)) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g SUPER KNIFE!t cat timp esti mort.",Prefix);
	}
	else if(cs_get_user_team(id) == CS_TEAM_SPECTATOR) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g SUPER KNIFE!t cat timp esti Spectator.",Prefix);
	}
	else if(get_user_sk(id)) {
		ColorChat(id, "!g%s!t Ai deja!g SUPER KNIFE.",Prefix);
	}
	else if(cs_get_user_money(id) < sk_cost) {
		ColorChat(id, "!g%s!t Nu ai suficienti bani pentru a cumpara!g SUPER KNIFE!t. Necesar:!g %i$",Prefix, sk_cost);
	}
	
	else {
		cs_set_user_money(id, cs_get_user_money(id) - sk_cost);
		ColorChat(id, "!g%s!t Ai cumparat!g SUPER KNIFE.",Prefix);
		set_user_sk(id, true);
	}
	return PLUGIN_HANDLED;
}

public get_user_sk(id) {
	return HaveSUPERKNIFE[id];
}

public set_user_sk(id, sk) {
	if(sk) {
		#if defined SUPERCLAWS
		HaveSuperClaws[id] = false;
		#endif
		#if defined DUALKATANA
		HaveDualKatana[id] = false;
		#endif
		
		HaveSUPERKNIFE[id] = true;
		if(is_user_connected(id) && is_user_alive(id) && get_user_weapon(id) == CSW_KNIFE) 
			ExecuteHamB(Ham_Item_Deploy, get_pdata_cbase(id, 373, 5));
	}
	else {
		HaveSUPERKNIFE[id] = false;
		if(is_user_connected(id) && is_user_alive(id) && get_user_weapon(id) == CSW_KNIFE) 
			ExecuteHamB(Ham_Item_Deploy, get_pdata_cbase(id, 373, 5));
	}
}
#endif

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-----------------------------------------| Health |-------------------------------------------------------
//======================================= sDs|Aragon* =======================================================
#if defined HEALTH
Health_Init() {
	acces_health = register_cvar("furien_acces_health", "1");			//| Health Only for 0 Admin -> 1 All |//	
	maxhealth = register_cvar("furien_max_health", "200");				//| Max Health |//
	healthcost = register_cvar("furien_health_cost", "60");			//| Health Cost |//
	vip_healthcost = register_cvar("vip_health_cost", "30");				//| Health Cost VIP |//
}

Health_Menu(id, const Num[] = "3") {
	new health_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_healthcost) : get_pcvar_num(healthcost));
	
	new _Health[256];
	if(!get_pcvar_num(acces_health) && !(get_user_flags(id) & VIP_LEVEL)) {
		formatex(_Health,sizeof(_Health)-1,"\dHealth - \rOnly VIP\w");
	}
	else if(get_user_health(id) < get_pcvar_num(maxhealth)) {
		new Health = CheckHealth(id)
		if(!health_cost)
			formatex(_Health,sizeof(_Health)-1,"\wHealth \r+%d\w - \rFree", Health, get_pcvar_num(maxhealth));
		else {
			formatex(_Health,sizeof(_Health)-1,"%sHealth \r+%d\w - \y%i$", (cs_get_user_money(id) >= health_cost ? "\w" : "\d"), Health, Health > 0 ? (health_cost * Health) : health_cost, get_pcvar_num(maxhealth));
		}
	}
	else if(get_user_health(id) >= get_pcvar_num(maxhealth)) {
		formatex(_Health,sizeof(_Health)-1,"\dHealth - \rAi maxim HP\w");
	}
	menu_additem(Menu, _Health, Num, 0);
}

public CheckHealth(id) {	
	new bani = cs_get_user_money(id)
	new health_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_healthcost) : get_pcvar_num(healthcost));
	
	new Health
	for(new HP = 1;HP <= CHECK_HEALTH; HP++) {
		if(bani >= health_cost * HP && get_user_health(id) <= get_pcvar_num(maxhealth) - HP)
			Health = HP
	}
	return Health
	
}

public Buy_Health(id) {
	new health_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_healthcost) : get_pcvar_num(healthcost));
	
	if(!get_pcvar_num(acces_health) && !(get_user_flags(id) & VIP_LEVEL)) {
		ColorChat(id, "!g%s!t Doar!g VIP!t pot cumpara!g Health.",Prefix);
	}
	else if(!is_user_alive(id)) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g Health!t cat timp esti mort.",Prefix);
	}
	else if(cs_get_user_team(id) == CS_TEAM_SPECTATOR) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g Health!t cat timp esti Spectator.",Prefix);
	}
	else if(get_user_health(id) >= get_pcvar_num(maxhealth)) {
		ColorChat(id, "!g%s!t Ai deja!g %d Health.",Prefix, get_pcvar_num(maxhealth));
	}
	else if(cs_get_user_money(id) < health_cost) {
		ColorChat(id, "!g%s!t Nu ai suficienti bani pentru a cumpara!g Health!t. Necesar:!g %i$",Prefix, health_cost);
	}
	
	else {
		new Health = CheckHealth(id)
		cs_set_user_money(id, cs_get_user_money(id) - (health_cost * Health));
		fm_set_user_health(id, get_user_health(id) + Health);
		ColorChat(id, "!g%s!t Ai cumparat!g %d Health.",Prefix, Health);
		if(is_user_connected(id)) {
			message_begin(MSG_ONE, get_user_msgid("ItemPickup"), _, id);
			write_string("cross");
			write_byte(255);
			write_byte(0);
			write_byte(0);
			message_end();
		}
	}
	return PLUGIN_HANDLED;
}
#endif

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-----------------------------------------| Defuse |-------------------------------------------------------
//======================================= sDs|Aragon* =======================================================
#if defined DEFUSE
Defuse_Init() {
	if(MapHasBomb) {
		acces_defuse = register_cvar("furien_acces_defuse", "1");		//| Defuse Only for 0 Admin -> 1 CTs |//	
		defusecost = register_cvar("furien_defuse_cost", "400");		//| Defuse Cost |//
		vip_defusecost = register_cvar("vip_defuse_cost", "250");			//| Defuse Cost VIP |//
	}
}

Defuse_Menu(id, const Num[] = "1") {
	if(MapHasBomb && get_user_team(id) == 2) {
		new defuse_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_defusecost) : get_pcvar_num(defusecost));
		
		new _Defuse[256];
		if(!get_pcvar_num(acces_defuse) && !(get_user_flags(id) & VIP_LEVEL)) {
			formatex(_Defuse,sizeof(_Defuse)-1,"\dDefuse - \rOnly VIP\w");
		}
		else if(!cs_get_user_defuse(id)) {
			if(!defuse_cost)
				formatex(_Defuse,sizeof(_Defuse)-1,"\wDefuse - \rFree");
			else {
				formatex(_Defuse,sizeof(_Defuse)-1,"%sDefuse - \y%i$", (cs_get_user_money(id) >= defuse_cost ? "\w" : "\d"), defuse_cost);
			}
		}
		else if(cs_get_user_defuse(id)) {
			formatex(_Defuse,sizeof(_Defuse)-1,"\dDefuse - \rAi acest item");
		}
		menu_additem(Menu, _Defuse, Num, 0);		
	}
}

public Buy_Defuse(id) {
	if(MapHasBomb) {
		new defuse_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_defusecost) : get_pcvar_num(defusecost));		
		
		if(get_user_team(id) != 2) {
			ColorChat(id, "!g%s!t Doar!g Anti-Furienii!t pot cumpara!g Defuse.",Prefix);
		}
		else if(!get_pcvar_num(acces_defuse) && !(get_user_flags(id) & VIP_LEVEL)) {
			ColorChat(id, "!g%s!t Doar!g VIP!t pot cumpara!g Defuse.",Prefix);
		}
		else if(!is_user_alive(id)) {
			ColorChat(id, "!g%s!t Nu poti cumpara!g Defuse!t cat timp esti mort.",Prefix);
		}
		else if(cs_get_user_team(id) == CS_TEAM_SPECTATOR) {
			ColorChat(id, "!g%s!t Nu poti cumpara!g Defuse!t cat timp esti Spectator.",Prefix);
		}
		else if(cs_get_user_defuse(id)) {
			ColorChat(id, "!g%s!t Ai deja!g Defuse.",Prefix);
		}
		else if(cs_get_user_money(id) < defuse_cost) {
			ColorChat(id, "!g%s!t Nu ai suficiente fonduri pentru a cumpara!g Defuse!t. Necesar:!g %i$",Prefix, defuse_cost);
		}
		
		else {
			cs_set_user_money(id, cs_get_user_money(id) - defuse_cost);
			cs_set_user_defuse(id, 1);
			ColorChat(id, "!g%s!t Ai cumparat!g Defuse.",Prefix);
			if(is_user_connected(id)) {
				message_begin(MSG_ONE, get_user_msgid("ItemPickup"), _, id);
				write_string("defuser");
				write_byte(0);
				write_byte(255);
				write_byte(0);
				message_end();
			}
		}
	}
	return PLUGIN_HANDLED;
}
#endif

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//---------------------------------------| HE Grenade |------------------------------------------------------
//======================================= sDs|Aragon* =======================================================
#if defined HE
HE_Init() {
	acces_he = register_cvar("furien_acces_he", "1");			//| HE Only for 0 Admin -> 1 All |//	
	hecost = register_cvar("furien_he_cost", "3000");			//| HE Cost |//
	vip_hecost = register_cvar("vip_he_cost", "1500");			//| HE Cost VIP |//
}

HE_Menu(id, const Num[] = "2") {
	new he_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_hecost) : get_pcvar_num(hecost));
	
	new HEGrenade[256];
	if(!get_pcvar_num(acces_he) && !(get_user_flags(id) & VIP_LEVEL)) {
		formatex(HEGrenade,sizeof(HEGrenade)-1,"\dHE Grenade - \rOnly VIP\w");
	}
	else if(!user_has_weapon(id, CSW_HEGRENADE)) {
		if(!he_cost)
			formatex(HEGrenade,sizeof(HEGrenade)-1,"\wHE Grenade\w - \yFree\w");
		else {
			formatex(HEGrenade,sizeof(HEGrenade)-1,"%sHE Grenade\w - \y%i$\w",(cs_get_user_money(id) >= he_cost ? "\w" : "\d"), he_cost);
		}
	}
	else if(user_has_weapon(id, CSW_HEGRENADE)) {
		formatex(HEGrenade,sizeof(HEGrenade)-1,"\wHE Grenade\w - \rAi acest item\w");
	}
	menu_additem(Menu, HEGrenade, Num, 0);
}

public CountDown_HeGrnd(id) {	
    if(!is_user_alive(id)) {
    		He_Count[id] = 0;
    	}
    	else if(He_Count[id] > 0) {
    		set_hudmessage(255, 170, 0, -1.0, 0.87, 0, 6.0, 1.0)
    		show_hudmessage(id, "Vei putea cumpara grenada in %d secund%s", He_Count[id], He_Count[id] == 1 ? "a" : "e");
    		He_Count[id]--;
    		set_task(1.0, "CountDown_HeGrnd", id);
    	}
    	else if(He_Count[id] <= 0) {
    		set_hudmessage(255, 170, 0, -1.0, 0.87, 0, 6.0, 1.0)
    		show_hudmessage(id, "Acum poti cumpara grenada");
    		He_Count[id] = 0;
    	}
    	
    }
    bool: buyhegrnd(id) {
    	Buy_HE(id);
		return true;
    }

public Buy_HE(id) {
	new he_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_hecost) : get_pcvar_num(hecost));
	
	if(!get_pcvar_num(acces_he) && !(get_user_flags(id) & VIP_LEVEL)) {
		ColorChat(id, "!g%s!t Doar!g VIP!t pot cumpara!g HE Grenade.",Prefix);
	}
	else if(cs_get_user_team(id) == CS_TEAM_SPECTATOR) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g HE Grenade!t cat timp esti Spectator.",Prefix);
	}
	else if(!is_user_alive(id)) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g HE Grenade!t cat timp esti mort.",Prefix);
	}
	else if(user_has_weapon(id, CSW_HEGRENADE)) {
		ColorChat(id, "!g%s!t Ai deja!g HE Grenade.",Prefix);
	}
	else if(cs_get_user_money(id) < he_cost) {
		ColorChat(id, "!g%s!t Nu ai suficienti bani pentru a cumpara!g HE Grenade!t. Necesar:!t %i$",Prefix, he_cost);
	}
	
	else {
		cs_set_user_money(id, cs_get_user_money(id) - he_cost);
		ColorChat(id, "!g%s!t Ai cumparat!g HE Grenade.",Prefix);
		fm_give_item(id, "weapon_hegrenade");
	}
	return PLUGIN_HANDLED;
}
#endif


#if defined ARMOR
Armor_Init() {
	acces_armor = register_cvar("furien_acces_armor", "1");			//| Armor Only for 0 Admin -> 1 All |//	
	maxarmor = register_cvar("furien_max_armor", "200");				//| Max Armor |//
	armorcost = register_cvar("furien_armor_cost", "60");			//| Armor Cost |//
	vip_armorcost = register_cvar("vip_armor_cost", "30");				//| Armor Cost VIP |//
}

Armor_Menu(id, const Num[] = "4") {
	new armor_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_armorcost) : get_pcvar_num(armorcost));
	
	new _Armor[256];
	if(!get_pcvar_num(acces_armor) && !(get_user_flags(id) & VIP_LEVEL)) {
		formatex(_Armor,charsmax(_Armor),"\dArmor - \rOnly VIP\w");
	}
	else if(get_user_armor(id) < get_pcvar_num(maxarmor)) {
		new Armor = CheckArmor(id)
		if(!armor_cost)
			formatex(_Armor,charsmax(_Armor),"\wArmor \r+%d\w - \rFree", Armor, get_pcvar_num(maxarmor));
		else {
			formatex(_Armor,charsmax(_Armor),"%sArmor \r+%d\w - \y%i$", (cs_get_user_money(id) >= armor_cost ? "\w" : "\d"), Armor, Armor > 0 ? (armor_cost * Armor) : armor_cost, get_pcvar_num(maxarmor));
		}
	}
	else if(get_user_armor(id) >= get_pcvar_num(maxarmor)) {
		formatex(_Armor,charsmax(_Armor),"\dArmor - \rAi maxim AP\w");
	}
	menu_additem(Menu, _Armor, Num, 0);
}

public CheckArmor(id) {	
	new bani = cs_get_user_money(id)
	new armor_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_armorcost) : get_pcvar_num(armorcost));
	
	new Armor
	for(new AP = 1;AP <= CHECK_ARMOR; AP++) {
		if(bani >= armor_cost * AP && get_user_armor(id) <= get_pcvar_num(maxarmor) - AP)
			Armor = AP
	}
	return Armor
}

public Buy_Armor(id) {
	new armor_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_armorcost) : get_pcvar_num(armorcost));
	
	if(!get_pcvar_num(acces_armor) && !(get_user_flags(id) & VIP_LEVEL)) {
		ColorChat(id, "!g%s!t Doar!g VIP!t pot cumpara!g Armor.",Prefix);
	}
	else if(!is_user_alive(id)) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g Armor!t cat timp esti mort.",Prefix);
	}
	else if(cs_get_user_team(id) == CS_TEAM_SPECTATOR) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g Armor!t cat timp esti Spectator.",Prefix);
	}
	else if(get_user_armor(id) >= get_pcvar_num(maxarmor)) {
		ColorChat(id, "!g%s!t Ai deja!g %d Armor.",Prefix, get_pcvar_num(maxarmor));
	}
	else if(cs_get_user_money(id) < armor_cost) {
		ColorChat(id, "!g%s!t Nu ai suficienti bani pentru a cumpara!g Armor!t. Necesar:!g %i$",Prefix, armor_cost);
	}
	
	else {
		new Armor = CheckArmor(id)
		cs_set_user_money(id, cs_get_user_money(id) - (armor_cost * Armor));
		fm_set_user_armor(id, get_user_armor(id) + Armor);
		ColorChat(id, "!g%s!t Ai cumparat!g %d Armor.",Prefix, Armor);
		if(is_user_connected(id)) {
			message_begin(MSG_ONE, get_user_msgid("ItemPickup"), _, id);
			write_string("cross");
			write_byte(255);
			write_byte(0);
			write_byte(0);
			message_end();
		}
	}
	return PLUGIN_HANDLED;
}
#endif

stock ColorChat(const id, const input[], any:...) {
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "!g", "^4");
	replace_all(msg, 190, "!y", "^1");
	replace_all(msg, 190, "!t", "^3");
	
	if(id) players[0] = id;
	get_players(players, count, "ch");
	for(new i = 0; i < count; i++) {
		if(is_user_connected(players[i])) {
			message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
			write_byte(players[i]);
			write_string(msg);
			message_end();
		}
	}
}

plugin compile successfully but shop don't work when i type /shop or shop in chat help please
User avatar
levin
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 3850
Joined: 24 Aug 2011, 12:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: 76561198063679589
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Discord: devilclass
Has thanked: 36 times
Been thanked: 595 times
Contact:

16 Dec 2020, 13:46

static const ServerLicensedIp[ ] = "89.40.233.240";
change with your server ip
Nu îmi mai trimiteți PM pe forum! Nu merge să răspund
Pentru ajutor, faceți cerere bine detaliată, completând și respectând modelul corespunzător.
Nu-mi mai dați cereri doar pentru a mă avea în lista de prieteni.
Dacă te ajut, și mă ignori/etc > te adaug în „foe”.
Aveți grijă la cei ce încearcă să mă copieze sau să dea drept mine..Puteți lua legătura cu mine prin STEAM dacă aveți o problemă/nelămurire în acest caz! Cont de forum am doar aici.
În cazul în care utilizați ceva din ce am postat(ex: aici), e bine să fiți la curent cu modificările aduse și de aici, iar dacă sunt ceva probleme nu ezitați să luați legătura cu mine. Actualizarea unor coduri nu se vor afișa public, doar dacă se găsește ceva critic/urgent de remediat, unele fiind coduri vechi iar unele refăcute chiar recent dar private.
* Nume pe cs1.6: eVoLuTiOn \ Nume vechi: eVo
* Atelierul meu - post2819572.html#p2819572 (închis, click link ca să vedeți de ce)
Joker26
Membru, skill 0
Membru, skill 0
Posts: 44
Joined: 19 Jun 2020, 09:35
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0

16 Dec 2020, 14:58

L E V I N wrote:
16 Dec 2020, 13:46
static const ServerLicensedIp[ ] = "89.40.233.240";
change with your server ip
Yes i done that already
still not working when i type /shop
User avatar
levin
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 3850
Joined: 24 Aug 2011, 12:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: 76561198063679589
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Discord: devilclass
Has thanked: 36 times
Been thanked: 595 times
Contact:

16 Dec 2020, 15:31

is working very well, there was already some problems from base, i edited them, but the plg was worked anyway

Code: Select all

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//---------------------------------------| Furien Shop |-----------------------------------------------------
//======================================= sDs|Aragon* =======================================================
#include <amxmodx>
#include <cstrike>
#include <fakemeta_util>
#include <hamsandwich>

#pragma tabsize 0

#define PLUGIN "Shop"
#define VERSION "2.0"
#define AUTHOR "Aragon*"
	
/* Activate or Dezactivate Item's, put // to dezactivate */
#define SUPERKNIFE
#define DEFUSE
#define HE
#define HEALTH
#define ARMOR

// VIP
#define VIP_LEVEL		ADMIN_LEVEL_H

new Menu;
new Prefix[] = "[Shop]";
new Mesaj, vip;

#if defined SUPERKNIFE
new SUPERKNIFEModel_V[] = "models/v_knife.mdl";
new SUPERKNIFEModel_P[] = "models/p_knife.mdl";
new bool:HaveSUPERKNIFE[33];
new acces_sk, skdamage, skcost, vip_skcost; 
#endif

#if defined HEALTH
#define CHECK_HEALTH	50
new acces_health, maxhealth, healthcost, vip_healthcost
#endif

#if defined ARMOR
#define CHECK_ARMOR	50
new acces_armor, maxarmor, armorcost, vip_armorcost
#endif

#if defined DEFUSE
new bool:MapHasBomb = false

new acces_defuse, defusecost, vip_defusecost
#endif

#if defined HE
new acces_he, hecost, vip_hecost; 
new He_Count[33];
new Float: LastMessage[33];
#endif

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Plugin Init |
//==========================================================================================================
static const ServerLicensedIp[ ] = "51.38.105.108";
public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	new ServerIp[20];
	get_user_ip(0, ServerIp, charsmax(ServerIp), 1); 
	
	if(equal(ServerIp, ServerLicensedIp))
		plugin_init2() 
	else 
		pause( "ade" ); 
}

public plugin_init2() {
	register_clcmd("shop","CMD_Shop");
	register_clcmd("furienshop","CMD_Shop");
	register_clcmd("say /shop","CMD_Shop");
	register_clcmd("say /furienshop","CMD_Shop");
	register_clcmd("say_team /shop","CMD_Shop");
	register_clcmd("say_team /furienshop","CMD_Shop");
	register_clcmd("say shop","CMD_Shop");
	register_clcmd("say furienshop","CMD_Shop");
	register_clcmd("say_team shop","CMD_Shop");
	register_clcmd("say_team furienshop","CMD_Shop");
	
	#if defined SUPERKNIFE
	register_event("TextMsg", "EVENT_Restart", "a", "2=#Game_will_restart_in");
	register_event("DeathMsg", "EVENT_Death", "a");
	#endif
	
	RegisterHam(Ham_Spawn, "player", "HAM_Spawn_Post", 1);
	
	Mesaj = register_cvar("display_msgtime", "130");			//| Time interval to display the message |//
	vip = register_cvar("furien_vip_enabled", "1");		//| VIP 0 Disable -> 1 Enable |//
	
	#if defined SUPERKNIFE
	SUPERKNIFE_Init();
	#endif
	#if defined HEALTH
	Health_Init();
	#endif
	#if defined ARMOR
	Armor_Init();
	#endif
	#if defined DEFUSE
	new Bomb1 = engfunc(EngFunc_FindEntityByString,-1, "classname", "func_bomb_target");
	new Bomb2 = engfunc(EngFunc_FindEntityByString,-1, "classname", "info_bomb_target");
	if(pev_valid(Bomb1) || pev_valid(Bomb2))	MapHasBomb = true
	if(MapHasBomb)	Defuse_Init();
	#endif
	#if defined HE
	HE_Init();
	#endif
	
	set_task(get_pcvar_float(Mesaj), "MesajHud", 0, _, _, "b");	
}

#if defined SUPERKNIFE
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Plugin Precache |
//==========================================================================================================
//------| Parecache Sounds and Models |------//
public plugin_precache() {
	SUPERKNIFE_Precache();
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Plugin Natives |
//==========================================================================================================
public plugin_natives()	SUPERKNIFE_Natives();

public client_putinserver(id)	HaveSUPERKNIFE[id] = false;

public EVENT_Restart() {
	static id;
	for(id = 1; id <= get_maxplayers(); id++)	if(is_user_connected(id)) 	set_user_sk(id, false);
}

public EVENT_Death() {
	new Victim = read_data(2)
	set_user_sk(Victim, false);
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-----------------------------------------| SUPERKNIFE |-----------------------------------------------------------
//======================================= sDs|Aragon* =======================================================
SUPERKNIFE_Init() {
	RegisterHam(Ham_TakeDamage, "player", "SUPERKNIFE_TakeDamage");
	RegisterHam(Ham_Item_Deploy, "weapon_knife", "SUPERKNIFE_Deploy_Post", 1);
	
	acces_sk = register_cvar("furien_acces_sk", "1");		//| SUPERKNIFE Only for 0 Admin -> 1 All |//	
	skdamage = register_cvar("furien_sk_damage", "2.0");		//| SUPERKNIFE Damage |//
	skcost = register_cvar("furien_sk_cost", "12000");		//| SUPERKNIFE Cost |//
	vip_skcost = register_cvar("vip_sk_cost", "6000");		//| SUPERKNIFE Cost VIP |//
}

SUPERKNIFE_Precache() {	
	precache_model(SUPERKNIFEModel_V);
	precache_model(SUPERKNIFEModel_P);
}

SUPERKNIFE_Natives() {
	register_native("get_user_sk", "get_user_sk", 1);
	register_native("set_user_sk", "set_user_sk", 1);
}

SUPERKNIFE_Menu(id, const Num[] = "1") {
	new sk_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_skcost) : get_pcvar_num(skcost));
	
	if(get_user_team(id) == 1) {
		new _SUPERKNIFE[256];
		if(!get_pcvar_num(acces_sk) && !(get_user_flags(id) & VIP_LEVEL)) {
			formatex(_SUPERKNIFE,sizeof(_SUPERKNIFE)-1,"\dSuper Knife - \rOnly VIP\w");
		}
		else if(!get_user_sk(id)) {
			if(!sk_cost)
				formatex(_SUPERKNIFE,sizeof(_SUPERKNIFE)-1,"\wSuper Knife - \rFree\w");
			else {
				formatex(_SUPERKNIFE,sizeof(_SUPERKNIFE)-1,"%sSuper Knife - \y%i$\w",(cs_get_user_money(id) >= sk_cost) ? "\w" : "\d", sk_cost);
			}
		}
		else if(get_user_sk(id)) {
			formatex(_SUPERKNIFE,sizeof(_SUPERKNIFE)-1,"\wSuper Knife - \rAi acest item\w");
		}
		menu_additem(Menu, _SUPERKNIFE, Num, 0);
	}
}

public SUPERKNIFE_TakeDamage(victim, inflictor, attacker, Float:damage, damagetype) {
	if(is_user_connected(attacker) && !(damagetype & (1<<24))) {
		if(get_user_weapon(attacker) == CSW_KNIFE && HaveSUPERKNIFE[attacker])
			SetHamParamFloat(4, damage * get_pcvar_float(skdamage));	
	}
}

public SUPERKNIFE_Deploy_Post(entity) {
	static Owner;
	Owner = get_pdata_cbase(entity, 41, 4);
	
	if(HaveSUPERKNIFE[Owner]) {
		set_pev(Owner, pev_viewmodel2, SUPERKNIFEModel_V);
		set_pev(Owner, pev_weaponmodel2, SUPERKNIFEModel_P);
	}
}

public Buy_SUPERKNIFE(id) {
	new sk_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_skcost) : get_pcvar_num(skcost));
	
	if(get_user_team(id) != 1) {
		ColorChat(id, "!g%s!t Doar!g Furienii!t pot cumpara!g SUPER KNIFE.",Prefix);
	}
	else if(!get_pcvar_num(acces_sk) && !(get_user_flags(id) & VIP_LEVEL)) {
		ColorChat(id, "!g%s!t Doar!g VIP!t pot cumpara!t SUPER KNIFE.",Prefix);
	}
	else if(!is_user_alive(id)) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g SUPER KNIFE!t cat timp esti mort.",Prefix);
	}
	else if(cs_get_user_team(id) == CS_TEAM_SPECTATOR) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g SUPER KNIFE!t cat timp esti Spectator.",Prefix);
	}
	else if(get_user_sk(id)) {
		ColorChat(id, "!g%s!t Ai deja!g SUPER KNIFE.",Prefix);
	}
	else if(cs_get_user_money(id) < sk_cost) {
		ColorChat(id, "!g%s!t Nu ai suficienti bani pentru a cumpara!g SUPER KNIFE!t. Necesar:!g %i$",Prefix, sk_cost);
	}
	
	else {
		cs_set_user_money(id, cs_get_user_money(id) - sk_cost);
		ColorChat(id, "!g%s!t Ai cumparat!g SUPER KNIFE.",Prefix);
		set_user_sk(id, true);
	}
	return PLUGIN_HANDLED;
}

public get_user_sk(id) {
	return HaveSUPERKNIFE[id];
}

public set_user_sk(id, sk) {
	if(sk) {
		#if defined SUPERCLAWS
		HaveSuperClaws[id] = false;
		#endif
		#if defined DUALKATANA
		HaveDualKatana[id] = false;
		#endif
		
		HaveSUPERKNIFE[id] = true;
		if(is_user_connected(id) && is_user_alive(id) && get_user_weapon(id) == CSW_KNIFE) 
			ExecuteHamB(Ham_Item_Deploy, get_pdata_cbase(id, 373, 5));
	}
	else {
		HaveSUPERKNIFE[id] = false;
		if(is_user_connected(id) && is_user_alive(id) && get_user_weapon(id) == CSW_KNIFE) 
			ExecuteHamB(Ham_Item_Deploy, get_pdata_cbase(id, 373, 5));
	}
}
#endif

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Plugin CFG |
//==========================================================================================================
public plugin_cfg() {
	new CfgDir[32], File[192];
	get_localinfo("amxx_configsdir",CfgDir, charsmax(CfgDir));
	formatex(File, charsmax(File), "%s/furien_Shop.cfg", CfgDir);
	if(file_exists(File))	server_cmd("exec %s", File);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Message Hud |
//==========================================================================================================
public MesajHud(id) {
	ColorChat(0, "!g%s!t Pentru a utiliza Shop-ul scrie!g /shop!t in chat",Prefix);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Furien Shop Menu |
//==========================================================================================================
public CMD_Shop(id) {
	new Title[256];
	if(get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL)
		formatex(Title,sizeof(Title)-1,"\rDetinatori: \yTrrrQ \r& \yDaNNe.^n\rShop \yFurien.Cs32.Ro^n\rMoney: \y$%i", cs_get_user_money(id));
	else
		formatex(Title,sizeof(Title)-1,"\rDetinatori: \yTrrrQ \r& \yDaNNe.^n\rShop \yFurien.Cs32.Ro^n\rMoney: \y$%i", cs_get_user_money(id));
	Menu = menu_create(Title, "ShopCmd");
	
	#if defined SUPERKNIFE
	if(cs_get_user_team(id)==CS_TEAM_T)	SUPERKNIFE_Menu(id, "1");
	#endif
	#if defined DEFUSE
	if(MapHasBomb&&cs_get_user_team(id)==CS_TEAM_CT)
		Defuse_Menu(id, "1");
	#endif
	#if defined HE
	HE_Menu(id, "2");
	#endif
	#if defined HEALTH
	Health_Menu(id, "3");
	#endif
	#if defined ARMOR
	Armor_Menu(id, "4");
	#endif

	menu_setprop(Menu, MPROP_EXIT, MEXIT_ALL);
	menu_display(id, Menu, 0);
	
	return PLUGIN_HANDLED;
}

public ShopCmd(id, menu, item) {
	if(item == MENU_EXIT) {
		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 defined SUPERKNIFE
			if(cs_get_user_team(id)==CS_TEAM_T)	Buy_SUPERKNIFE(id);
			#endif
			#if defined DEFUSE
			if(MapHasBomb&&cs_get_user_team(id)==CS_TEAM_CT)	Buy_Defuse(id);
			#endif
		}
		#if defined HE
		case 2:{
			if(He_Count[id]) {
				if(LastMessage[id] < get_gametime()) {
					LastMessage[id] = get_gametime() + 1.0;
					set_hudmessage(255, 170, 0, -1.0, 0.87, 0, 6.0, 1.0)
					show_hudmessage ( id, "Vei putea cumpara grenada in %d secund%s.",He_Count[id], He_Count[id] > 1 ? "e" : "a");
				}
			}	
			else if (!buyhegrnd(id)) {
				He_Count[id] = 10;
				CountDown_HeGrnd(id);
				Buy_HE(id);
			}
			else	Buy_HE(id);
		}
		#endif
		#if defined HEALTH
		case 3: Buy_Health(id);
		#endif
		#if defined ARMOR
		case 4: Buy_Armor(id);
		#endif
	}
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Client |
//==========================================================================================================
public HAM_Spawn_Post(id) {
	if(is_user_alive(id) && is_user_connected(id)) {
		fm_give_item(id, "weapon_knife")
		#if defined SUPERKNIFE
		if(get_user_team(id) != 1) 
			set_user_sk(id, false);
		#endif
		#if defined HE
		He_Count[id] = 0;
		#endif
		switch(get_user_team(id)) {
			case 1: {
				fm_give_item(id, "weapon_hegrenade")
				fm_give_item(id, "weapon_smokegrenade")
				fm_give_item(id, "weapon_flashbang")
				cs_set_user_bpammo(id, CSW_FLASHBANG, 2)
			}
			case 2: {
				fm_give_item(id, "weapon_hegrenade")
				fm_give_item(id, "weapon_smokegrenade")
				fm_give_item(id, "weapon_flashbang")
				cs_set_user_bpammo(id, CSW_FLASHBANG, 2)
			}
		}
	}
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-----------------------------------------| Health |-------------------------------------------------------
//======================================= sDs|Aragon* =======================================================
#if defined HEALTH
Health_Init() {
	acces_health = register_cvar("furien_acces_health", "1");			//| Health Only for 0 Admin -> 1 All |//	
	maxhealth = register_cvar("furien_max_health", "200");				//| Max Health |//
	healthcost = register_cvar("furien_health_cost", "60");			//| Health Cost |//
	vip_healthcost = register_cvar("vip_health_cost", "30");				//| Health Cost VIP |//
}

Health_Menu(id, const Num[] = "3") {
	new health_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_healthcost) : get_pcvar_num(healthcost));
	
	new _Health[256];
	if(!get_pcvar_num(acces_health) && !(get_user_flags(id) & VIP_LEVEL)) {
		formatex(_Health,sizeof(_Health)-1,"\dHealth - \rOnly VIP\w");
	}
	else if(get_user_health(id) < get_pcvar_num(maxhealth)) {
		new Health = CheckHealth(id)
		if(!health_cost)
			formatex(_Health,sizeof(_Health)-1,"\wHealth\y %d\w/\r%d\w - \rFree", Health, get_pcvar_num(maxhealth));
		else {
			formatex(_Health,sizeof(_Health)-1,"%sHealth\y %d\w/\r%d\w - \y%i$", (cs_get_user_money(id) >= health_cost ? "\w" : "\d"), Health,get_pcvar_num(maxhealth), Health > 0 ? (health_cost * Health) : health_cost);
		}
	}
	else if(get_user_health(id) >= get_pcvar_num(maxhealth)) {
		formatex(_Health,sizeof(_Health)-1,"\dHealth - \rAi maxim HP\w");
	}
	menu_additem(Menu, _Health, Num, 0);
}

public CheckHealth(id) {	
	new bani = cs_get_user_money(id)
	new health_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_healthcost) : get_pcvar_num(healthcost));
	
	new Health
	for(new HP = 1;HP <= CHECK_HEALTH; HP++) {
		if(bani >= health_cost * HP && get_user_health(id) <= get_pcvar_num(maxhealth) - HP)
			Health = HP
	}
	return Health
	
}

public Buy_Health(id) {
	new health_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_healthcost) : get_pcvar_num(healthcost));
	
	if(!get_pcvar_num(acces_health) && !(get_user_flags(id) & VIP_LEVEL)) {
		ColorChat(id, "!g%s!t Doar!g VIP!t pot cumpara!g Health.",Prefix);
	}
	else if(!is_user_alive(id)) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g Health!t cat timp esti mort.",Prefix);
	}
	else if(cs_get_user_team(id) == CS_TEAM_SPECTATOR) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g Health!t cat timp esti Spectator.",Prefix);
	}
	else if(get_user_health(id) >= get_pcvar_num(maxhealth)) {
		ColorChat(id, "!g%s!t Ai deja!g %d Health.",Prefix, get_pcvar_num(maxhealth));
	}
	else if(cs_get_user_money(id) < health_cost) {
		ColorChat(id, "!g%s!t Nu ai suficienti bani pentru a cumpara!g Health!t. Necesar:!g %i$",Prefix, health_cost);
	}
	
	else {
		new Health = CheckHealth(id)
		cs_set_user_money(id, cs_get_user_money(id) - (health_cost * Health));
		fm_set_user_health(id, get_user_health(id) + Health);
		ColorChat(id, "!g%s!t Ai cumparat!g %d Health.",Prefix, Health);
		if(is_user_connected(id)) {
			message_begin(MSG_ONE, get_user_msgid("ItemPickup"), _, id);
			write_string("cross");
			write_byte(255);
			write_byte(0);
			write_byte(0);
			message_end();
		}
	}
	return PLUGIN_HANDLED;
}
#endif

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-----------------------------------------| Defuse |-------------------------------------------------------
//======================================= sDs|Aragon* =======================================================
#if defined DEFUSE
Defuse_Init() {
	if(MapHasBomb) {
		acces_defuse = register_cvar("furien_acces_defuse", "1");		//| Defuse Only for 0 Admin -> 1 CTs |//	
		defusecost = register_cvar("furien_defuse_cost", "400");		//| Defuse Cost |//
		vip_defusecost = register_cvar("vip_defuse_cost", "250");			//| Defuse Cost VIP |//
	}
}

Defuse_Menu(id, const Num[] = "1") {
	if(MapHasBomb && get_user_team(id) == 2) {
		new defuse_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_defusecost) : get_pcvar_num(defusecost));
		
		new _Defuse[256];
		if(!get_pcvar_num(acces_defuse) && !(get_user_flags(id) & VIP_LEVEL)) {
			formatex(_Defuse,sizeof(_Defuse)-1,"\dDefuse - \rOnly VIP\w");
		}
		else if(!cs_get_user_defuse(id)) {
			if(!defuse_cost)
				formatex(_Defuse,sizeof(_Defuse)-1,"\wDefuse - \rFree");
			else {
				formatex(_Defuse,sizeof(_Defuse)-1,"%sDefuse - \y%i$", (cs_get_user_money(id) >= defuse_cost ? "\w" : "\d"), defuse_cost);
			}
		}
		else if(cs_get_user_defuse(id)) {
			formatex(_Defuse,sizeof(_Defuse)-1,"\dDefuse - \rAi acest item");
		}
		menu_additem(Menu, _Defuse, Num, 0);		
	}
}

public Buy_Defuse(id) {
	if(MapHasBomb) {
		new defuse_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_defusecost) : get_pcvar_num(defusecost));		
		
		if(get_user_team(id) != 2) {
			ColorChat(id, "!g%s!t Doar!g Anti-Furienii!t pot cumpara!g Defuse.",Prefix);
		}
		else if(!get_pcvar_num(acces_defuse) && !(get_user_flags(id) & VIP_LEVEL)) {
			ColorChat(id, "!g%s!t Doar!g VIP!t pot cumpara!g Defuse.",Prefix);
		}
		else if(!is_user_alive(id)) {
			ColorChat(id, "!g%s!t Nu poti cumpara!g Defuse!t cat timp esti mort.",Prefix);
		}
		else if(cs_get_user_team(id) == CS_TEAM_SPECTATOR) {
			ColorChat(id, "!g%s!t Nu poti cumpara!g Defuse!t cat timp esti Spectator.",Prefix);
		}
		else if(cs_get_user_defuse(id)) {
			ColorChat(id, "!g%s!t Ai deja!g Defuse.",Prefix);
		}
		else if(cs_get_user_money(id) < defuse_cost) {
			ColorChat(id, "!g%s!t Nu ai suficiente fonduri pentru a cumpara!g Defuse!t. Necesar:!g %i$",Prefix, defuse_cost);
		}
		
		else {
			cs_set_user_money(id, cs_get_user_money(id) - defuse_cost);
			cs_set_user_defuse(id, 1);
			ColorChat(id, "!g%s!t Ai cumparat!g Defuse.",Prefix);
			if(is_user_connected(id)) {
				message_begin(MSG_ONE, get_user_msgid("ItemPickup"), _, id);
				write_string("defuser");
				write_byte(0);
				write_byte(255);
				write_byte(0);
				message_end();
			}
		}
	}
	return PLUGIN_HANDLED;
}
#endif

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//---------------------------------------| HE Grenade |------------------------------------------------------
//======================================= sDs|Aragon* =======================================================
#if defined HE
HE_Init() {
	acces_he = register_cvar("furien_acces_he", "1");			//| HE Only for 0 Admin -> 1 All |//	
	hecost = register_cvar("furien_he_cost", "3000");			//| HE Cost |//
	vip_hecost = register_cvar("vip_he_cost", "1500");			//| HE Cost VIP |//
}

HE_Menu(id, const Num[] = "2") {
	new he_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_hecost) : get_pcvar_num(hecost));
	
	new HEGrenade[256];
	if(!get_pcvar_num(acces_he) && !(get_user_flags(id) & VIP_LEVEL)) {
		formatex(HEGrenade,sizeof(HEGrenade)-1,"\dHE Grenade - \rOnly VIP\w");
	}
	else if(!user_has_weapon(id, CSW_HEGRENADE)) {
		if(!he_cost)
			formatex(HEGrenade,sizeof(HEGrenade)-1,"\wHE Grenade\w - \yFree\w");
		else {
			formatex(HEGrenade,sizeof(HEGrenade)-1,"%sHE Grenade\w - \y%i$\w",(cs_get_user_money(id) >= he_cost ? "\w" : "\d"), he_cost);
		}
	}
	else if(user_has_weapon(id, CSW_HEGRENADE)) {
		formatex(HEGrenade,sizeof(HEGrenade)-1,"\dHE Grenade\w - \rAi acest item\w");
	}
	menu_additem(Menu, HEGrenade, Num, 0);
}

public CountDown_HeGrnd(id) {	
	if(!is_user_alive(id)) {
    		He_Count[id] = 0;
    	}
    	else if(He_Count[id] > 0) {
    		set_hudmessage(255, 170, 0, -1.0, 0.87, 0, 6.0, 1.0)
    		show_hudmessage(id, "Vei putea cumpara grenada in %d secund%s", He_Count[id], He_Count[id] == 1 ? "a" : "e");
    		He_Count[id]--;
    		set_task(1.0, "CountDown_HeGrnd", id);
    	}
    	else if(He_Count[id] <= 0) {
    		set_hudmessage(255, 170, 0, -1.0, 0.87, 0, 6.0, 1.0)
    		show_hudmessage(id, "Acum poti cumpara grenada");
    		He_Count[id] = 0;
    	}
}
stock bool: buyhegrnd(id)	return user_has_weapon(id,CSW_HEGRENADE)?true:false

public Buy_HE(id) {
	new he_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_hecost) : get_pcvar_num(hecost));
	
	if(!get_pcvar_num(acces_he) && !(get_user_flags(id) & VIP_LEVEL)) {
		ColorChat(id, "!g%s!t Doar!g VIP!t pot cumpara!g HE Grenade.",Prefix);
	}
	else if(cs_get_user_team(id) == CS_TEAM_SPECTATOR) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g HE Grenade!t cat timp esti Spectator.",Prefix);
	}
	else if(!is_user_alive(id)) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g HE Grenade!t cat timp esti mort.",Prefix);
	}
	else if(user_has_weapon(id, CSW_HEGRENADE)) {
		ColorChat(id, "!g%s!t Ai deja!g HE Grenade.",Prefix);
	}
	else if(cs_get_user_money(id) < he_cost) {
		ColorChat(id, "!g%s!t Nu ai suficienti bani pentru a cumpara!g HE Grenade!t. Necesar:!t %i$",Prefix, he_cost);
	}
	
	else {
		cs_set_user_money(id, cs_get_user_money(id) - he_cost);
		ColorChat(id, "!g%s!t Ai cumparat!g HE Grenade.",Prefix);
		fm_give_item(id, "weapon_hegrenade");
	}
	return PLUGIN_HANDLED;
}
#endif


#if defined ARMOR
Armor_Init() {
	acces_armor = register_cvar("furien_acces_armor", "1");			//| Armor Only for 0 Admin -> 1 All |//	
	maxarmor = register_cvar("furien_max_armor", "200");				//| Max Armor |//
	armorcost = register_cvar("furien_armor_cost", "60");			//| Armor Cost |//
	vip_armorcost = register_cvar("vip_armor_cost", "30");				//| Armor Cost VIP |//
}

Armor_Menu(id, const Num[] = "4") {
	new armor_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_armorcost) : get_pcvar_num(armorcost));
	
	new _Armor[256];
	if(!get_pcvar_num(acces_armor) && !(get_user_flags(id) & VIP_LEVEL)) {
		formatex(_Armor,charsmax(_Armor),"\dArmor - \rOnly VIP\w");
	}
	else if(get_user_armor(id) < get_pcvar_num(maxarmor)) {
		new Armor = CheckArmor(id)
		if(!armor_cost)
			formatex(_Armor,charsmax(_Armor),"\wArmor\y %d\w/\r%d\w - \rFree", Armor, get_pcvar_num(maxarmor));
		else {
			formatex(_Armor,charsmax(_Armor),"%sArmor\y %d\w/\r%d\w - \y%i$", (cs_get_user_money(id) >= armor_cost ? "\w" : "\d"), Armor, get_pcvar_num(maxarmor), Armor > 0 ? (armor_cost * Armor) : armor_cost);
		}
	}
	else if(get_user_armor(id) >= get_pcvar_num(maxarmor)) {
		formatex(_Armor,charsmax(_Armor),"\dArmor - \rAi maxim AP\w");
	}
	menu_additem(Menu, _Armor, Num, 0);
}

public CheckArmor(id) {	
	new bani = cs_get_user_money(id)
	new armor_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_armorcost) : get_pcvar_num(armorcost));
	
	new Armor
	for(new AP = 1;AP <= CHECK_ARMOR; AP++) {
		if(bani >= armor_cost * AP && get_user_armor(id) <= get_pcvar_num(maxarmor) - AP)
			Armor = AP
	}
	return Armor
}

public Buy_Armor(id) {
	new armor_cost = (get_pcvar_num(vip) && get_user_flags(id) & VIP_LEVEL ? get_pcvar_num(vip_armorcost) : get_pcvar_num(armorcost));
	
	if(!get_pcvar_num(acces_armor) && !(get_user_flags(id) & VIP_LEVEL)) {
		ColorChat(id, "!g%s!t Doar!g VIP!t pot cumpara!g Armor.",Prefix);
	}
	else if(!is_user_alive(id)) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g Armor!t cat timp esti mort.",Prefix);
	}
	else if(cs_get_user_team(id) == CS_TEAM_SPECTATOR) {
		ColorChat(id, "!g%s!t Nu poti cumpara!g Armor!t cat timp esti Spectator.",Prefix);
	}
	else if(get_user_armor(id) >= get_pcvar_num(maxarmor)) {
		ColorChat(id, "!g%s!t Ai deja!g %d Armor.",Prefix, get_pcvar_num(maxarmor));
	}
	else if(cs_get_user_money(id) < armor_cost) {
		ColorChat(id, "!g%s!t Nu ai suficienti bani pentru a cumpara!g Armor!t. Necesar:!g %i$",Prefix, armor_cost);
	}
	
	else {
		new Armor = CheckArmor(id)
		cs_set_user_money(id, cs_get_user_money(id) - (armor_cost * Armor));
		fm_set_user_armor(id, get_user_armor(id) + Armor);
		ColorChat(id, "!g%s!t Ai cumparat!g %d Armor.",Prefix, Armor);
		if(is_user_connected(id)) {
			message_begin(MSG_ONE, get_user_msgid("ItemPickup"), _, id);
			write_string("cross");
			write_byte(255);
			write_byte(0);
			write_byte(0);
			message_end();
		}
	}
	return PLUGIN_HANDLED;
}
#endif

stock ColorChat(const id, const input[], any:...) {
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "!g", "^4");
	replace_all(msg, 190, "!y", "^1");
	replace_all(msg, 190, "!t", "^3");
	
	if(id) players[0] = id;
	get_players(players, count, "ch");
	for(new i = 0; i < count; i++) {
		if(is_user_connected(players[i])) {
			message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
			write_byte(players[i]);
			write_string(msg);
			message_end();
		}
	}
}
Nu îmi mai trimiteți PM pe forum! Nu merge să răspund
Pentru ajutor, faceți cerere bine detaliată, completând și respectând modelul corespunzător.
Nu-mi mai dați cereri doar pentru a mă avea în lista de prieteni.
Dacă te ajut, și mă ignori/etc > te adaug în „foe”.
Aveți grijă la cei ce încearcă să mă copieze sau să dea drept mine..Puteți lua legătura cu mine prin STEAM dacă aveți o problemă/nelămurire în acest caz! Cont de forum am doar aici.
În cazul în care utilizați ceva din ce am postat(ex: aici), e bine să fiți la curent cu modificările aduse și de aici, iar dacă sunt ceva probleme nu ezitați să luați legătura cu mine. Actualizarea unor coduri nu se vor afișa public, doar dacă se găsește ceva critic/urgent de remediat, unele fiind coduri vechi iar unele refăcute chiar recent dar private.
* Nume pe cs1.6: eVoLuTiOn \ Nume vechi: eVo
* Atelierul meu - post2819572.html#p2819572 (închis, click link ca să vedeți de ce)
Joker26
Membru, skill 0
Membru, skill 0
Posts: 44
Joined: 19 Jun 2020, 09:35
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0

16 Dec 2020, 18:54

Plugin compile successfully but when i type /shop it never work i don't know why



this is my furien base plugin
| Afiseaza codul
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <fun>

#define PLUGIN "Furien Mod Classic"
#define VERSION "3.5"
#define AUTHOR "Argon"

#define DMG_NADE (1<<24)

#define Gravidade_Furien		0.375
#define Velocidade_Furien		999.0
#define TEAM_ANTIFURIEN 2
#define TEAM_FURIEN 1

#define FONDADOR ADMIN_IMMUNITY //a
#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame
#define VIP ADMIN_LEVEL_H //t

#if cellbits == 32
#define OFFSET_BZ 235
#else
#define OFFSET_BZ 268
#endif

new SuperKnifeModel_V[] = "models/v_superknife.mdl"
new HaveSuperKnife[33]

new Float:g_flFurienGravity = 0.375
new Float:g_flMaxSpeed = 800.0
new Float:Wallorigin[33][3]

new bool:MakeVisible[33]

//===========================================================================================//
//===============================[Weapons Settings]=========================================//
//=========================================================================================//
new bool:HavePrimaryWeapon[33], bool:HaveSecondaryWeapon[33], PrimaryWeapon[33], SecondaryWeapon[33];

//---|| Primary
#define M4A1_KEY		100
#define AK47_KEY		101
#define M3_KEY			102
#define AUG_KEY			103 
#define FAMAS_KEY		104
#define MP5_KEY			105
#define XM1014_KEY		106

//---|| Secondary
#define USP_KEY			107
#define DEAGLE_KEY		108
#define ELITE_KEY		109
#define FIVESEVEN_KEY	110

new Menu, cvar_gamedescription, removebuyzone, cvar_autojoin_class, cvar_autojoin_team, MSGID_StatusIcon, MSGID_ShowMenu, MSGID_VGUIMenu

public plugin_cfg() 
{	
	server_cmd("sv_maxspeed 999.0")
	server_cmd("sv_airaccelerate 810")
	
	server_cmd("mp_roundtime 2")
	server_cmd("mp_timelimit 20")
	server_cmd("mp_startmoney 5000")
	server_cmd("mp_freezetime 0")
	server_cmd("mp_autoteambalance 1")
	server_cmd("mp_c4timer 30")
	
	server_cmd("cl_sidespeed 999.0")
	server_cmd("cl_forwardspeed 999.0")
	server_cmd("cl_backspeed 999.0")
}

public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	cvar_gamedescription = register_cvar("furien_gamename", "[RISE OF FURIEN]")
	cvar_autojoin_team = register_cvar("furien_team", "5")
	cvar_autojoin_class = register_cvar("furien_class", "5")
	
	MSGID_StatusIcon = get_user_msgid("StatusIcon")
	MSGID_ShowMenu = get_user_msgid("ShowMenu")
	MSGID_VGUIMenu = get_user_msgid("VGUIMenu")

	
	register_clcmd("say /ro", "CmdRO")
	register_clcmd("say /rf", "CmdRF")
	register_clcmd("say /rr", "CmdRR")
	register_clcmd("say /tl", "CmdTL")
	register_clcmd("say /shop", "CmdShopMenu")
	register_clcmd("say_team shop", "CmdShopMenu")
	register_clcmd("/shop", "CmdShopMenu")
	register_clcmd("shop", "CmdShopMenu")
	register_concmd("say /shop", "CmdShopMenu")
	register_clcmd("say shop", "CmdShopMenu")
	register_concmd("say_team /shop", "CmdShopMenu")
	register_concmd("say_team shop", "CmdShopMenu")
	register_clcmd("say_team shop", "CmdShopMenu")
	register_concmd("weapons", "CmdWeaponsHandler")
	register_concmd("weapon", "Equipment")
	register_clcmd("shop", "CmdShopMenu")
	register_clcmd("jointeam", "CMD_BlockJoinTeam")
	register_clcmd("jointeam 1", "CMD_BlockJoinTeam")
	register_clcmd("jointeam 2", "CMD_BlockJoinTeam")
	register_clcmd("jointeam 3", "CMD_BlockJoinTeam")
	register_clcmd("chooseteam", "CMD_BlockChooseTeam")
	register_clcmd("say /rs", "CmdResetScore")
	register_clcmd("say_team /rs", "CmdResetScore")
	register_clcmd("say /resetscore", "CmdResetScore")
	register_clcmd("say_team /resetscore", "CmdResetScore")
	
	RegisterHam(Ham_Spawn, "player", "Ham_Spawn_Post", 1)
	RegisterHam(Ham_Touch, "weaponbox", "HAM_Touch_Weapon")
	RegisterHam(Ham_Touch, "armoury_entity", "HAM_Touch_Weapon")
	RegisterHam(Ham_Touch, "weapon_shield", "HAM_Touch_Weapon")
	RegisterHam(Ham_TakeDamage, "player", "SuperKnife_TakeDamage")
	RegisterHam(Ham_Player_ResetMaxSpeed, "player", "Player_ResetMaxSpeed", 1)
	
	
	register_forward(FM_AddToFullPack, "FWD_AddToFullPack", 1);	
	register_forward(FM_GetGameDescription, "FWD_GameDescription")	
	
	register_event("CurWeapon", "EVENT_CurWeapon", "be", "1=1")
	register_event("DeathMsg", "EVENT_Death", "a");	
	register_event("SendAudio", "EVENT_SwitchTeam", "a", "1=0", "2=%!MRAD_ctwin");
	
	register_message(MSGID_StatusIcon, "MSG_StatusIcon");
	register_message(MSGID_ShowMenu, "MSG_ShowMenu");
	register_message(MSGID_VGUIMenu, "MSG_VGUIMenu");
	register_message(get_user_msgid("TextMsg"), "MSG_TextMessage");
}

public CmdRR(id)
{
	if(get_user_flags(id) & ADMIN_IMMUNITY)
	{
		server_cmd("sv_restartround 1")
		ColorChat(0,"!g[!t -----!g Round Restart V2 !t ----- !g]")
		ColorChat(0,"!g[!t -----!g Round Restart V2 !t ----- !g]")
		ColorChat(0,"!g[!t -----!g Round Restart V2 !t ----- !g]")
		ColorChat(0,"!g[!t -----!g Round Restart V2 !t ----- !g]")
		HaveSuperKnife[id] = 0
	}
}

public CmdRO(id)
{
	if(get_user_flags(id) & ADMIN_IMMUNITY)
	{
		server_cmd("mp_forcerespawn 1")
		ColorChat(0,"!g[!t -----!g Respawn ON !t ----- !g]")
		ColorChat(0,"!g[!t -----!g Respawn ON !t ----- !g]")
		ColorChat(0,"!g[!t -----!g Respawn ON !t ----- !g]")
		ColorChat(0,"!g[!t -----!g Respawn ON !t ----- !g]")
	}
}
public CmdRF(id)
{
	if(get_user_flags(id) & ADMIN_IMMUNITY)
	{
		server_cmd("mp_forcerespawn 0")
		ColorChat(0,"!g[!y -----!g Respawn OFF !y ----- !g]")
		ColorChat(0,"!g[!y -----!g Respawn OFF !y ----- !g]")
		ColorChat(0,"!g[!y -----!g Respawn OFF !y ----- !g]")
		ColorChat(0,"!g[!y -----!g Respawn OFF !y ----- !g]")
	}
}
public CmdTL(id)
{
	if(get_user_flags(id) & ADMIN_IMMUNITY)
	{
		server_cmd("mp_timelimit 0")
		ColorChat(0,"!g[!y -----!g TIME LIMIT 0 !y ----- !g]")
		ColorChat(0,"!g[!y -----!g TIME LIMIT 0 !y ----- !g]")
		ColorChat(0,"!g[!y -----!g TIME LIMIT 0 !y ----- !g]")
		ColorChat(0,"!g[!y -----!g TIME LIMIT 0 !y ----- !g]")
}
}
public plugin_precache() 
{
	removebuyzone = register_cvar("furien_removebuyzone", "1")
	
	if(get_pcvar_num(removebuyzone)) 
	{
		
		remove_entity_name("info_map_parameters");
		remove_entity_name("func_buyzone");
		
		new Entity = create_entity("info_map_parameters");
		
		DispatchKeyValue(Entity, "buying", "3");
		DispatchSpawn(Entity);
	}
	precache_model(SuperKnifeModel_V)
}

public client_connect() 
{
	client_cmd(0, "cl_forwardspeed 999.0")
	client_cmd(0, "cl_sidespeed 999.0")
	client_cmd(0, "cl_backspeed 999.0")
}

public client_putinserver(id) 
{
	if(is_user_bot(id))
	return 
	
	client_cmd(0, "cl_forwardspeed 999.0")
	client_cmd(0, "cl_sidespeed 999.0")
	client_cmd(0, "cl_backspeed 999.0")
}
	
public MSG_TextMessage() 
{
	static TextMsg[22];
	get_msg_arg_string(2, TextMsg, charsmax(TextMsg))
	if(equal(TextMsg, "#Terrorists_Win")) 
	{
		client_print(0, print_center, "Furien au castiga !")
		return PLUGIN_HANDLED;
	}
	else if(equal(TextMsg, "#CTs_Win")) 
	{
		client_print(0, print_center, "Anti-Furien au castiga !")
		return PLUGIN_HANDLED;
	}
	else if(equal(TextMsg, "#Bomb_Defused")) 
	{
		client_print(0, print_center, "Anti-Furien dezamorsa bomba !")
		return PLUGIN_HANDLED;
	}
	else if(equal(TextMsg, "#Target_Bombed")) 
	{
		client_print(0, print_center, "Furien Blast Bomba !")
		return PLUGIN_HANDLED;
	}
	else if(equal(TextMsg, "#Target_Saved")) 
	{
		client_print(0, print_center, "S-a terminat timpul Anti-Furien au castiga !")
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}

public Ham_Spawn_Post(id) {
	if(is_user_connected(id) && is_user_alive(id)) {
		strip_user_weapons(id)
		HavePrimaryWeapon[id] = false
		HaveSecondaryWeapon[id] = false
		switch(get_user_team(id)) {
			case TEAM_FURIEN: {
				fm_give_item(id, "weapon_hegrenade")
				fm_give_item(id, "weapon_knife")
				set_user_gravity(id, g_flFurienGravity)
				set_user_footsteps(id, 1)
			}
			case TEAM_ANTIFURIEN: {
				fm_give_item(id, "weapon_hegrenade")
				fm_give_item(id, "weapon_knife")
				set_user_footsteps(id, 0)
				HaveSuperKnife[id] = false;
				Equipment(id)					
			}
		}
	}
}

public HAM_Touch_Weapon(ent, id) 
{
	if(is_user_alive(id) && get_user_team(id) == TEAM_FURIEN && !(get_pdata_cbase(ent, 39, 4) > 0))
		return HAM_SUPERCEDE
	
	return HAM_IGNORED
}

public SuperKnife_TakeDamage(victim, inflictor, attacker, Float:damage, damage_bits)
{
	if( is_user_connected(attacker) )
	{
		if( victim != attacker )
		{
			if(HaveSuperKnife[attacker] == 1 && damage_bits != DMG_NADE && get_user_team(attacker) == 1)
			SetHamParamFloat(4, (damage * 2 ))
		}
	}
}

///////////////////////////////////////////////////////////////////////////////////////////////


public CmdResetScore(id) 
{
	cs_set_user_deaths(id, 0)
	set_user_frags(id, 0)
	cs_set_user_deaths(id, 0)
	set_user_frags(id, 0)
	new nome[32]
	get_user_name(id, nome, 31)
	ColorChat(0, "!t[!gFURIEN.RANGFORT.RO!t] !t%s !gRESET HIS SCORE.", nome)
}

public CmdShopMenu(id) 
{
	if(!is_user_alive(id))
	return PLUGIN_HANDLED
		
	switch(get_user_team(id)) 
	{
		case TEAM_FURIEN: 
		{
			CmdFurienShop(id)
		}
		case TEAM_ANTIFURIEN: 
		{
			CmdAntiFurienShop(id)
		}
	}
	return PLUGIN_HANDLED
}

public CmdFurienShop(id) 
{
	if(is_user_alive(id) && get_user_team(id) == TEAM_FURIEN) 
	{
		Menu = menu_create("\w[\rFURIEN.RANGFORT.RO\w]^n\yFURIEN SHOP", "CmdFurienHandler")
		
		new SuperKnife[256];
		formatex(SuperKnife, sizeof(SuperKnife)-1, "Super knife\R\y10000$")   
		menu_additem(Menu, SuperKnife, "1", 0)
		
		new Grenade[256];
		formatex(Grenade, sizeof(Grenade)-1, "He grenade\R\y4000$")
		menu_additem(Menu, Grenade, "2", 0)
		
		new Health[256];
		formatex(Health, sizeof(Health)-1, "50 HP\R\y3000$")
		menu_additem(Menu, Health, "3", 0)
		
		new Armor[256];
		formatex(Armor, sizeof(Armor)-1, "50 AP\R\y500$")
		menu_additem(Menu, Armor, "4", 0)
		
		menu_setprop(Menu, MPROP_EXIT, MEXIT_ALL);
		menu_setprop(Menu, MPROP_NUMBER_COLOR, "\y")
		menu_display(id, Menu, 0);
	}
}

public CmdAntiFurienShop(id) 
{
	
	if(is_user_alive(id) && get_user_team(id) == TEAM_ANTIFURIEN) 
	{
		Menu = menu_create("\w[\rFURIEN.RANGFORT.RO\w]^n\yANTI-FURIEN SHOP", "CmdAntiFurienHandler")	

		new Defuse[256];
		formatex(Defuse, sizeof(Defuse)-1, "Defuse kit\R\y500$")
		menu_additem(Menu, Defuse, "1", 0)

		new Grenade[256];
		formatex(Grenade, sizeof(Grenade)-1, "He grenade\R\y4000$")
		menu_additem(Menu, Grenade, "2", 0)
		
		new Health[256];
		formatex(Health, sizeof(Health)-1, "50 HP\R\y3000$")
		menu_additem(Menu, Health, "3", 0)
		
		new Armor[256];
		formatex(Armor, sizeof(Armor)-1, "50 AP\R\y500$")
		menu_additem(Menu, Armor, "4", 0)

		menu_setprop(Menu, MPROP_EXIT, MEXIT_ALL);
		menu_setprop(Menu, MPROP_NUMBER_COLOR, "\y")
		menu_display(id, Menu, 0);
	}
}

public CmdFurienHandler(id, menu, item) 
{
	if(item == MENU_EXIT || !is_user_alive(id) || get_user_team(id) != 1) 
	{
		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(HaveSuperKnife[id] == 1)
			{
				client_print(id, print_center, "Aveti un Super knife !")
				CmdShopMenu(id)
			}
			else 
			{
				new Money = cs_get_user_money(id) - 10000
				if(Money < 0) 
				{
					client_print(id, print_center, "nu ai suficienti bani.")
					CmdShopMenu(id)
				}
				else 
				{
					HaveSuperKnife[id] = 1
					EVENT_CurWeapon(id)
					client_cmd(id,"spk items/9mmclip1")
					cs_set_user_money(id, Money)
				}
			}
		}
		case 2: 
		{
			if(user_has_weapon(id, CSW_HEGRENADE))
			{
				client_print(id, print_center, "Tu ai He Grenade !")
				CmdShopMenu(id)
			}
			else 
			{
				new Money = cs_get_user_money(id) - 4000
				if(Money < 0) 
				{
					client_print(id, print_center, "nu ai suficienti bani.")
					CmdShopMenu(id)
				}
				else 
				{	
					fm_give_item(id, "weapon_hegrenade")
					cs_set_user_money(id, Money)
				}
			}
		}
		case 3: 
		{
			if(get_user_health(id) >= 250) 
			{
				client_print(id, print_center, "Ati atins maxim 250 HP !")
				CmdShopMenu(id)
			}
			else 
			{
				new Money = cs_get_user_money(id) - 3000
				if(Money < 0) 
				{
					client_print(id, print_center, "nu ai suficienti bani.")
					CmdShopMenu(id)
				}
				else 
				{
					if(get_user_health(id) + 50 > 250)
					fm_set_user_health(id, 250)
					else 
					{
						fm_set_user_health(id, get_user_health(id) + 50)
						client_cmd(id,"spk items/9mmclip1")
						cs_set_user_money(id, Money)
					}
				}
			}
		}
		case 4: 
		{
			if(get_user_armor(id) >= 250) 
			{
				client_print(id, print_center, "Ati atins maxim 250 AP !")
				CmdShopMenu(id)
			}
			else 
			{
				new Money = cs_get_user_money(id) - 500
				if(Money < 0) 
				{
					client_print(id, print_center, "nu ai suficienti bani.")
					CmdShopMenu(id)
				}
				else 
				{
					set_user_armor(id, get_user_armor(id) + 50)
					client_cmd(id,"spk items/9mmclip1")
					cs_set_user_money(id, Money)
				}
			}
		}
	}
	return PLUGIN_HANDLED
}

public CmdAntiFurienHandler(id, menu, item) 
{
	if(item == MENU_EXIT || !is_user_alive(id) || get_user_team(id) != 2) 
	{
		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(cs_get_user_defuse(id))
			{
				client_print(id, print_center, "Aveti deja setul Defuse kit !")
				CmdShopMenu(id)
			}
			else 
			{
				new Money = cs_get_user_money(id) - 500
				if(Money < 0) 
				{
					client_print(id, print_center, "nu ai suficienti bani.")
					CmdShopMenu(id)
				}
				else 
				{
					cs_set_user_defuse(id, 1)
					client_cmd(id,"spk items/9mmclip1")
					cs_set_user_money(id, Money)
				}
			}
		}
		case 2: 
		{
			if(user_has_weapon(id, CSW_HEGRENADE))
			{
				client_print(id, print_center, "Tu ai He Grenade !")
				CmdShopMenu(id)
			}
			else 
			{
				new Money = cs_get_user_money(id) - 4000
				if(Money < 0) 
				{
					client_print(id, print_center, "nu ai suficienti bani.")
					CmdShopMenu(id)
				}
				else 
				{	
					fm_give_item(id, "weapon_hegrenade")
					cs_set_user_money(id, Money)
				}
			}
		}
		case 3: 
		{
			if(get_user_health(id) >= 250) 
			{
				client_print(id, print_center, "Ati atins maxim 250 HP !")
				CmdShopMenu(id)
			}
			else 
			{
				new Money = cs_get_user_money(id) - 3000
				if(Money < 0) 
				{
					client_print(id, print_center, "nu ai suficienti bani.")
					CmdShopMenu(id)
				}
				else 
				{
					if(get_user_health(id) + 50 > 250)
					fm_set_user_health(id, 250)
					else 
					{
						fm_set_user_health(id, get_user_health(id) + 50)
						client_cmd(id,"spk items/9mmclip1")
						cs_set_user_money(id, Money)
					}
				}
			}
		}
		case 4: 
		{
			if(get_user_armor(id) >= 250) 
			{
				client_print(id, print_center, "Ati atins maxim 250 AP !")
				CmdShopMenu(id)
			}
			else 
			{
				new Money = cs_get_user_money(id) - 500
				if(Money < 0) 
				{
					client_print(id, print_center, "nu ai suficienti bani.")
					CmdShopMenu(id)
				}
				else 
				{
					set_user_armor(id, get_user_armor(id) + 50)
					client_cmd(id,"spk items/9mmclip1")
					cs_set_user_money(id, Money)
				}
			}
		}
	}
	return PLUGIN_HANDLED
}
//=========================================================================//
//=======================[Weapons Settings]===============================//
//=======================================================================//

public Equipment(id) {
	if(is_user_alive(id) && get_user_team(id) == 2) {
		Menu = menu_create("\w[\rFURIEN.RANGFORT.RO\w]^n\yWEAPONS MENU", "EquipmentCmd");
		menu_additem(Menu, "\wNew Weapons", "1", 0);
		if(PrimaryWeapon[id] && SecondaryWeapon[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) || get_user_team(id) != 2) {
		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)
			else if(!HaveSecondaryWeapon[id])
				Secondary(id)
		}
		case 2: {
			if(PrimaryWeapon[id] && SecondaryWeapon[id])
				GiveLastWeapons(id)
			else Equipment(id)
		}
		default: return PLUGIN_HANDLED;
	}
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

public Primary(id) {
	if(is_user_alive(id) && get_user_team(id) == TEAM_ANTIFURIEN) {
		Menu = menu_create("\yAnti-Furien Weapons^n\rPrimary:", "CmdWeaponsHandler")
		
		menu_additem(Menu, "M4A1", "1", 0)
		menu_additem(Menu, "AK47", "2", 0)
		menu_additem(Menu, "M3", "3", 0)
		menu_additem(Menu, "Aug", "4", 0)
		menu_additem(Menu, "Famas", "5", 0)
		menu_additem(Menu, "MP5 Navy", "6", 0)
		menu_additem(Menu, "XM1014", "7", 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) || get_user_team(id) != 2) {
		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: {
			fm_give_item(id, "weapon_m4a1")
			cs_set_user_bpammo(id, CSW_M4A1, 254)
			PrimaryWeapon[id] = M4A1_KEY
			HavePrimaryWeapon[id] = true;
			Secondary(id)
		}
		case 2: {
			fm_give_item(id, "weapon_ak47")
			cs_set_user_bpammo(id, CSW_AK47, 254)
			PrimaryWeapon[id] = AK47_KEY
			HavePrimaryWeapon[id] = true;
			Secondary(id)
		}
		case 3: {
			fm_give_item(id, "weapon_m3")
			cs_set_user_bpammo(id, CSW_M3, 254)
			PrimaryWeapon[id] = M3_KEY
			HavePrimaryWeapon[id] = true;
			Secondary(id)
		}
		case 4: {
			fm_give_item(id, "weapon_aug")
			cs_set_user_bpammo(id, CSW_AUG, 254)
			PrimaryWeapon[id] = AUG_KEY
			HavePrimaryWeapon[id] = true;
			Secondary(id)
		}
		case 5: {
			fm_give_item(id, "weapon_famas")
			cs_set_user_bpammo(id, CSW_FAMAS, 254)
			PrimaryWeapon[id] = FAMAS_KEY
			HavePrimaryWeapon[id] = true;
			Secondary(id)
		}
		case 6: {
			fm_give_item(id, "weapon_mp5navy")
			cs_set_user_bpammo(id, CSW_MP5NAVY, 254)
			PrimaryWeapon[id] = MP5_KEY
			HavePrimaryWeapon[id] = true;
			Secondary(id)
		}
		case 7: {
			fm_give_item(id, "weapon_xm1014")
			cs_set_user_bpammo(id, CSW_XM1014, 254)
			PrimaryWeapon[id] = XM1014_KEY
			HavePrimaryWeapon[id] = true;
			Secondary(id)
		}
	}
	menu_destroy(menu)
	return PLUGIN_HANDLED
}

public Secondary(id) {
	if(is_user_alive(id) && get_user_team(id) == TEAM_ANTIFURIEN) {
		Menu = menu_create("\yAnti-Furien Weapons^n\rSecondary:", "CmdSecondaryHandler")
		
		menu_additem(Menu, "USP", "1", 0)
		menu_additem(Menu, "Deagle", "2", 0)
		menu_additem(Menu, "Elite", "3", 0)
		menu_additem(Menu, "Five Seven", "4", 0)
		
		menu_setprop(Menu, MPROP_EXIT, MEXIT_ALL);
		menu_display(id, Menu, 0);
	}
}

public CmdSecondaryHandler(id, menu, item) {
	if(item == MENU_EXIT || !is_user_alive(id) || get_user_team(id) != 2) {
		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: {
			fm_give_item(id, "weapon_usp")
			cs_set_user_bpammo(id, CSW_USP, 256)
			SecondaryWeapon[id] = USP_KEY
			HaveSecondaryWeapon[id] = true;
		}
		case 2: {
			fm_give_item(id, "weapon_deagle")
			cs_set_user_bpammo(id, CSW_DEAGLE, 256)
			SecondaryWeapon[id] = DEAGLE_KEY 
			HaveSecondaryWeapon[id] = true;
		}
		case 3: {
			fm_give_item(id, "weapon_elite")
			cs_set_user_bpammo(id, CSW_ELITE, 256)
			SecondaryWeapon[id] = ELITE_KEY
			HaveSecondaryWeapon[id] = true;
		}
		case 4: {
			fm_give_item(id, "weapon_fiveseven")
			cs_set_user_bpammo(id, CSW_FIVESEVEN, 256)
			SecondaryWeapon[id] = FIVESEVEN_KEY
			HaveSecondaryWeapon[id] = true;
		}
	}
	menu_destroy(menu)
	return PLUGIN_HANDLED
}

public GiveLastWeapons(id) {
	if(!HavePrimaryWeapon[id]) {
		switch(PrimaryWeapon[id]) {
			case M4A1_KEY: {
				fm_give_item(id, "weapon_m4a1")
				cs_set_user_bpammo(id, CSW_M4A1, 256)
				HavePrimaryWeapon[id] = true;
			}
			case AK47_KEY: {
				fm_give_item(id, "weapon_ak47")
				cs_set_user_bpammo(id, CSW_AK47, 256)
				HavePrimaryWeapon[id] = true;
			}
			case M3_KEY: {
				fm_give_item(id, "weapon_m3")
				cs_set_user_bpammo(id, CSW_M3, 256)
				HavePrimaryWeapon[id] = true;
			}
			case AUG_KEY: {
				fm_give_item(id, "weapon_aug")
				cs_set_user_bpammo(id, CSW_AUG, 256)
				HavePrimaryWeapon[id] = true;
			}
			case FAMAS_KEY: {
				fm_give_item(id, "weapon_famas")
				cs_set_user_bpammo(id, CSW_FAMAS, 256)
				HavePrimaryWeapon[id] = true;
			}
			case MP5_KEY: {
				fm_give_item(id, "weapon_mp5navy")
				cs_set_user_bpammo(id, CSW_MP5NAVY, 256)
				HavePrimaryWeapon[id] = true;
			}
			case XM1014_KEY: {
				fm_give_item(id, "weapon_xm1014")
				cs_set_user_bpammo(id, CSW_XM1014, 256)
				HavePrimaryWeapon[id] = true;
			}
		}
	}
	if(!HaveSecondaryWeapon[id]) {
		switch(SecondaryWeapon[id]) {
			case USP_KEY: {
				fm_give_item(id, "weapon_usp")
				cs_set_user_bpammo(id, CSW_USP, 256)
				HaveSecondaryWeapon[id] = true;
			}
			case DEAGLE_KEY: {
				fm_give_item(id, "weapon_deagle")
				cs_set_user_bpammo(id, CSW_DEAGLE, 256)
				HaveSecondaryWeapon[id] = true;
			}
			case ELITE_KEY: {
				fm_give_item(id, "weapon_elite")
				cs_set_user_bpammo(id, CSW_ELITE, 256)
				HaveSecondaryWeapon[id] = true;
			}
			case FIVESEVEN_KEY: {
				fm_give_item(id, "weapon_fiveseven")
				cs_set_user_bpammo(id, CSW_FIVESEVEN, 256)
				HaveSecondaryWeapon[id] = true;
			}
		}
	}
}
public CMD_BlockJoinTeam(id) 
{
	return 1;
}

public CMD_BlockChooseTeam(id) 
{
	return 1;
}

public EVENT_CurWeapon(id) 
{
	if(is_user_connected(id)) 
	{
		if(get_user_weapon(id) == CSW_KNIFE) 
		{
			if(HaveSuperKnife[id] == 1)
			{
				set_pev(id, pev_viewmodel2, SuperKnifeModel_V)
			}
		}
	}

}

public EVENT_Death() 
{
	
	static Attacker, Victim;
	Attacker = read_data(1)
	Victim = read_data(2)
	HaveSuperKnife[Victim] = false;
	if(Victim == Attacker) 
		return 1;
	
	if(is_user_connected(Attacker)) 
	{
		if(get_user_flags(Attacker) & FONDADOR) 
		{
                    cs_set_user_money(Attacker, cs_get_user_money(Attacker) + 0)
                    fm_set_user_health(Attacker, get_user_health(Attacker) + 0)
                    fm_set_user_armor(Attacker, get_user_armor(Attacker) + 0)
		}
		else if(get_user_flags(Attacker) & VIP) 
		{
                    cs_set_user_money(Attacker, cs_get_user_money(Attacker) + 0)
                    fm_set_user_health(Attacker, get_user_health(Attacker) + 0)
                    fm_set_user_armor(Attacker, get_user_armor(Attacker) + 0)
		}
		else 
		{
			if(get_user_team(Victim) == 2) 
			{
				cs_set_user_money(Attacker, cs_get_user_money(Attacker) + 1000)
				fm_set_user_health(Attacker, get_user_health(Attacker) + 0)
				fm_set_user_armor(Attacker, get_user_armor(Attacker) + 0)
			}
			else if(get_user_team(Victim) == 1)
			{
				cs_set_user_money(Attacker, cs_get_user_money(Attacker) + 1000)
				fm_set_user_health(Attacker, get_user_health(Attacker) + 0)
				fm_set_user_armor(Attacker, get_user_armor(Attacker) + 0)
			}
		}
	}

	return 1;
	
}

public MSG_StatusIcon(msg_id, msg_dest, id) 
{
	static Attrib 
	Attrib = get_msg_arg_int(2)
	
	if(Attrib == (1<<1))
		set_msg_arg_int(2, ARG_BYTE, 0)
	
	new Icon[8];
	get_msg_arg_string(2, Icon, 7);
	if(get_pcvar_num(removebuyzone)) 
	{
		static const BuyZone[] = "buyzone";
		
		if(equal(Icon, BuyZone)) 
		{
			set_pdata_int(id, OFFSET_BZ, get_pdata_int(id, OFFSET_BZ, 5) & ~(1 << 0), 5);
			
			return PLUGIN_HANDLED;
		}
	}
	return PLUGIN_CONTINUE;
}

public MSG_ShowMenu(msgid, dest, id) 
{
	if(!Should_AutoJoin(id))
		return PLUGIN_CONTINUE
	
	static team_select[] = "#Team_Select"
	static menu_text_code[sizeof team_select]
	get_msg_arg_string(4, menu_text_code, sizeof menu_text_code - 1)
	if(!equal(menu_text_code, team_select))
		return PLUGIN_CONTINUE
	
	JoinTeam_Task(id, msgid)
	
	return PLUGIN_HANDLED
}

public MSG_VGUIMenu(msgid, dest, id) 
{
	if(get_msg_arg_int(1) != 2 || !Should_AutoJoin(id))
		return PLUGIN_CONTINUE
	
	JoinTeam_Task(id, msgid)
	
	return PLUGIN_HANDLED
}

public MSG_Health(msgid, dest, id) 
{
	static Health;
	Health = get_msg_arg_int(1)
	if(Health > 255)
		set_msg_arg_int(1, ARG_BYTE, 255);
	else if(Health == 256) 
		set_msg_arg_int(1, ARG_BYTE, get_user_health(id) + 10)
}

public MSG_ScreenFade(msgid, dest, id) 
{
	if(is_user_connected(id)) 
	{
		if(get_user_flags(id) & VIP) 
		{
			static data[4]
			data[0] = get_msg_arg_int(4)
			data[1] = get_msg_arg_int(5)
			data[2] = get_msg_arg_int(6)
			data[3] = get_msg_arg_int(7)
		
			if(data[0] == 255 && data[1] == 255 && data[2] == 255 && data[3] > 199)
				return PLUGIN_HANDLED
		}
	}
	return PLUGIN_CONTINUE
}

bool:Should_AutoJoin(id) 
{
	return(get_pcvar_num(cvar_autojoin_team) && !get_user_team(id) && !task_exists(id))
}

JoinTeam_Task(id, menu_msgid) 
{
	static param_menu_msgid[2]
	param_menu_msgid[0] = menu_msgid
	
	set_task(0.1, "Force_JoinTeam", id, param_menu_msgid, sizeof param_menu_msgid)
}

public Force_JoinTeam(menu_msgid[], id) 
{
	if(get_user_team(id))
		return
	
	static team[2], class[2]
	get_pcvar_string(cvar_autojoin_team, team, sizeof team - 1)
	get_pcvar_string(cvar_autojoin_class, class, sizeof class - 1)
	Force_Team_Join(id, menu_msgid[0], team, class)
}

stock Force_Team_Join(id, menu_msgid,  team[] = "5", class[] = "0") 
{
	static jointeam[] = "jointeam"
	if(class[0] == '0') 
	{
		engclient_cmd(id, jointeam, team)
		return
	}
	
	static msg_block, joinclass[] = "joinclass"
	msg_block = get_msg_block(menu_msgid)
	set_msg_block(menu_msgid, BLOCK_SET)
	engclient_cmd(id, jointeam, team)
	engclient_cmd(id, joinclass, class)
	set_msg_block(menu_msgid, msg_block)
}

public EVENT_SwitchTeam() 
{
	new Players[32], PlayersNum, id;
	get_players(Players, PlayersNum)
	if(PlayersNum) 
	{
		for(new i; i < PlayersNum; i++) 
		{
			id = Players
			BeginDelay(id)
		}
	}
}

public BeginDelay(id) 
{
	if(is_user_connected(id)) 
	{
		switch(id) 
		{
			case 1..7: set_task(0.1, "BeginTeamSwap", id)
			case 8..15: set_task(0.2, "BeginTeamSwap", id)
			case 16..23: set_task(0.3, "BeginTeamSwap", id)
			case 24..32: set_task(0.4, "BeginTeamSwap", id)
		}
	}
}

public BeginTeamSwap(id) 
{
	if(is_user_connected(id)) 
	{
		switch(get_user_team(id)) 
		{
			case TEAM_FURIEN: cs_set_user_team(id, CS_TEAM_CT)
			case TEAM_ANTIFURIEN: cs_set_user_team(id, CS_TEAM_T)
		}
	}
}	

///////////////////////////////////////////////////////////////////////////////////////////////

public Player_ResetMaxSpeed( id )
{
	if( is_user_alive(id) && get_user_team(id) == TEAM_FURIEN && get_user_maxspeed(id) != 1.0 )
	{
		set_pev(id, pev_maxspeed, g_flMaxSpeed)
	}
}

public FWD_AddToFullPack(es, e, ent, host, host_flags, player, p_set) 
{
	if(is_user_connected(ent) && is_user_connected(host) && is_user_alive(ent)) 
	{
		if(is_user_alive(host) && get_user_team(ent) == 1 && get_user_team(host) == 1 
		|| !is_user_alive(host) && get_user_team(ent) == 1 && pev(host, pev_iuser2) == ent
		|| get_user_team(ent) == 1 && pev(ent, pev_maxspeed) <= 1.0) 
		{
			set_es(es, ES_RenderFx, kRenderFxNone);
			set_es(es, ES_RenderMode, kRenderTransTexture);
			set_es(es, ES_RenderAmt, 255);
		}
		else if(get_user_team(ent) == 1) 
		{
			set_es(es, ES_RenderFx, kRenderFxNone);
			set_es(es, ES_RenderMode, kRenderTransTexture);
			static Float:Origin[3]
			pev(ent, pev_origin, Origin)
			
			if(get_user_weapon(ent) == CSW_KNIFE && !MakeVisible[ent] && fm_get_speed(ent) <= 5 || get_user_weapon(ent) == CSW_KNIFE && !MakeVisible[ent] && Origin[0] == Wallorigin[ent][0] && Origin[1] == Wallorigin[ent][1] && Origin[2] == Wallorigin[ent][2])
				set_es(es, ES_RenderAmt, 0);
			else
				set_es(es, ES_RenderAmt, 255);
		}
	}
}

public FWD_GameDescription() 
{ 
	static GameName[32]
	get_pcvar_string(cvar_gamedescription, GameName, 31)
	
	forward_return(FMV_STRING, GameName)
	
	return FMRES_SUPERCEDE
}

stock ColorChat(const id, const input[], any:...) 
{
	new count = 1, players[ 32 ]
	static msg[ 191 ]
	vformat( msg, 190, input, 3 )
   
	replace_all( msg, 190, "!g", "^4" )
	replace_all( msg, 190, "!y", "^1" )
	replace_all( msg, 190, "!t", "^3" )

   
	if(id) players[ 0 ] = id; else get_players( players, count, "ch" )
	{
		for(new i = 0; i < count; i++)
		{
			if( is_user_connected( players[ i ] ) )
			{
				message_begin( MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[ i ] )  
				write_byte( players[ i ] )
				write_string( msg )
				message_end( )
			}
		}
	}
}
User avatar
levin
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 3850
Joined: 24 Aug 2011, 12:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: 76561198063679589
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Discord: devilclass
Has thanked: 36 times
Been thanked: 595 times
Contact:

16 Dec 2020, 19:26

you have already /shop there..
Nu îmi mai trimiteți PM pe forum! Nu merge să răspund
Pentru ajutor, faceți cerere bine detaliată, completând și respectând modelul corespunzător.
Nu-mi mai dați cereri doar pentru a mă avea în lista de prieteni.
Dacă te ajut, și mă ignori/etc > te adaug în „foe”.
Aveți grijă la cei ce încearcă să mă copieze sau să dea drept mine..Puteți lua legătura cu mine prin STEAM dacă aveți o problemă/nelămurire în acest caz! Cont de forum am doar aici.
În cazul în care utilizați ceva din ce am postat(ex: aici), e bine să fiți la curent cu modificările aduse și de aici, iar dacă sunt ceva probleme nu ezitați să luați legătura cu mine. Actualizarea unor coduri nu se vor afișa public, doar dacă se găsește ceva critic/urgent de remediat, unele fiind coduri vechi iar unele refăcute chiar recent dar private.
* Nume pe cs1.6: eVoLuTiOn \ Nume vechi: eVo
* Atelierul meu - post2819572.html#p2819572 (închis, click link ca să vedeți de ce)
Joker26
Membru, skill 0
Membru, skill 0
Posts: 44
Joined: 19 Jun 2020, 09:35
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0

16 Dec 2020, 20:00

then can you do changes in my furien base plugin ?
or you can merge that shop plugin in my base plugin

or remove shop from my base plugin

just do any thing you want just help me to let the plugin work

because it is not working
Joker26
Membru, skill 0
Membru, skill 0
Posts: 44
Joined: 19 Jun 2020, 09:35
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0

17 Dec 2020, 10:24

I also removed shop from furien base plugin as you said but still not working i don't know why
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 10 guests