modificare custom shop

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
BoGdAnMoNs
Membru, skill +1
Membru, skill +1
Posts: 104
Joined: 30 Mar 2021, 23:14
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Has thanked: 4 times
Been thanked: 1 time

08 Jan 2023, 12:07

meniul sa contina si M4A1 GOLD

Code: Select all

/*
OciXCrom's Custom Shop
The shop contains the following items (by default):

[a] +50 Health -- Gives you +50 health points
[b] +100 Armor -- Gives you +100 armor points
[c] Unlimited Clip -- Makes your current weapon have unlimited bullets (without reloading). This item can only be activated on a weapon that actually uses bullets, reloading will remove the unlimited clip
[d] Unlimited Ammo -- Adds unlimited backpack ammo to your current weapon
[e] All Grenades -- Gives you HE Grenade, 2x Flashbang and a Smoke Grenade
[f] Bomber -- Gives you 20 HE Grenades
[g] Silent Footsteps -- You won't make noise when running
[h] Faster Speed -- Makes you run faster
[i] Low Gravity -- Allows you to jump higher
[j] Chameleon -- Use this item to fool your enemies by disguising as them
[k] Drugs (Speed + Health) -- Distorts your screen, makes you run faster and gives you additional health. The distortion is lost when zooming in
[l] Transparency -- Makes you transparent
[m] Invisibility (15 Seconds) -- Buying this will make you fully invisible for 15 seconds
[n] Double Damage -- Doubles the damage you make on an enemy player
[o] GodMode (5 Seconds) -- Become immortal for 5 seconds
[p] Health Regeneration -- Regenerates 1 health point each half of a second
[q] Armor Regeneration -- Regenerates 10 armor points each half of a second
[r] No Recoil -- Removes weapon recoil
[s] AWP -- Gives you an AWP
[t] Golden AK -- Get an Golden AK-47

Every single item can be disabled and modified by using various cvars.
To disable any item, you can use the cvar "customshop_disableditems", add the item's letter in the cvar string to disable it.

Use these cvars to control the main options of the Shop:

* customshop_disableditems <any available item letter (case sensitive)> -- Leave it empty if you want all items to be enabled
* customshop_viponly <default: 0> -- Set to "1" if you want the Shop to be available only for players with a certain flag
* customshop_flag_access <default: b> -- The flag which is used when "customshop_viponly" is set to "1"
* customshop_infomessage_enabled <default: 1> -- Enable/Disable information message showing in chat
* customshop_infomessage_time <default: 90.0> -- Controls the time needed (in seconds) for the information message to display in chat
* customshop_buyequip <default: 1> -- Use "0" if you don't want the shop to be accessed by using the "buyequip" command (or button "o" by default)
* customshop_currency_symbol <default: $ / Pts.> -- Set the currency symbol that is shown in the shop menu
* customshop_teamonly <default: 0> -- Use this to make the shop available only for a certain team (0 = None; 1 = T; 2 = CT; 3 = Spectator)

Cvars for the Points System:

* customshop_points <default: 0> -- Set to "1" if you want to use special points, instead of money
* customshop_savepoints <default: 1> -- Controls whether the plugin will save players' points on disconnect
* customshop_vipbonus <default: 0> -- Set to "1" if you want VIP users to get more points with every kill
* customshop_flag_bonus <default: b> -- The flag which is used when "customshop_vipbonus" is set to "1"
* customshop_teamkillpoints <default: 0> -- If you want players to get points when killing a teammate
* customshop_killmessage <default: 1> -- Use "0" to disable the kill messages in chat
* customshop_reward_normal <default: 15> -- Controls how many points you get for a normal kill
* customshop_reward_headshot <default: 30> -- Controls how many points you get for a headshot
* customshop_reward_knife <default: 50> -- Controls how many points you get for a knife kill
* customshop_reward_bonus <default: 10> -- Controls how many bonus points VIP users get if "customshop_vipbonus" is set to "1"
* customshop_hud <default: 0> -- Use "1" to show the player's points on his HUD
* customshop_hud_red <default: 255> -- HUD: red color amount
* customshop_hud_green <default: 255> -- HUD: green color amount
* customshop_hud_blue <default: 0> -- HUD: blue color amount
* customshop_hud_x <default: 0.01> -- HUD: X coordinates
* customshop_hud_y <default: 0.93> -- HUD: Y coordinates

Commands:

* say /shop -- Opens up the Shop Menu
* say /points -- Shows the player his current points status
* amx_points <nick|#userid|@team> <points to give/take> -- An admin command to give or take points, you can use "0" to take all points from the player

You can change any item's price by using the following cvars:

[a] customshop_health_price <default: 1500>
[b] customshop_armor_price <default: 1000>
[c] customshop_unlclip_price <default: 3000>
[d] customshop_unlammo_price <default: 200>
[e] customshop_allgrenades_price <default: 800>
[f] customshop_bomber_price <default: 1600>
[g] customshop_silentsteps_price <default: 3000>
[h] customshop_fasterspeed_price <default: 4300>
[i] customshop_lowgravity_price <default: 2800>
[j] customshop_chameleon_price <default: 9000>
[k] customshop_drugs_price <default: 8000>
[l] customshop_transparency_price <default: 2500>
[m] customshop_invisibility_price <default: 16000>
[n] customshop_doubledamage_price <default: 10000>
[o] customshop_godmode_price <default: 16000>
[p] customshop_healthregen_price <default: 1800>
[q] customshop_armorregen_price <default: 2000>
[r] customshop_norecoil_price <default: 12000>
[s] customshop_awp_price <default: 4750>
[t] customshop_goldenak_price <default: 16000>

Note: The cvars above are for the regular Money System, and the other ones are for the Points System.

[a] customshop_health_price2 <default: 150>
[b] customshop_armor_price2 <default: 100>
[c] customshop_unlclip_price2 <default: 300>
[d] customshop_unlammo_price2 <default: 20>
[e] customshop_allgrenades_price2 <default: 80>
[f] customshop_bomber_price2 <default: 160>
[g] customshop_silentsteps_price2 <default: 300>
[h] customshop_fasterspeed_price2 <default: 430>
[i] customshop_lowgravity_price2 <default: 280>
[j] customshop_chameleon_price2 <default: 900>
[k] customshop_drugs_price2 <default: 800>
[l] customshop_transparency_price2 <default: 250>
[m] customshop_invisibility_price2 <default: 1600>
[n] customshop_doubledamage_price2 <default: 1000>
[o] customshop_godmode_price2 <default: 1600>
[p] customshop_healthregen_price2 <default: 180>
[q] customshop_armorregen_price2 <default: 200>
[r] customshop_norecoil_price2 <default: 1200>
[s] customshop_awp_price2 <default: 475>
[t] customshop_goldenak_price2 <default: 1600>

Use these cvars to control the item limit:
	
[a] customshop_health_limit <default: 5>
[b] customshop_armor_limit <default: 8>
[c] customshop_unlclip_limit <default: 3>
[d] customshop_unlammo_limit <default: 5>
[e] customshop_allgrenades_limit <default: 10>
[f] customshop_bomber_limit <default: 3>
[g] customshop_silentsteps_limit <default: 1>
[h] customshop_fasterspeed_limit <default: 1>
[i] customshop_lowgravity_limit <default: 1>
[j] customshop_chameleon_limit <default: 1>
[k] customshop_drugs_limit <default: 2>
[l] customshop_transparency_limit <default: 1>
[m] customshop_invisibility_limit <default: 3>
[n] customshop_doubledamage_limit <default: 1>
[o] customshop_godmode_limit <default: 1>
[p] customshop_healthregen_limit <default: 2>
[q] customshop_armorregen_limit <default: 2>
[r] customshop_norecoil_limit <default: 1>
[s] customshop_awp_limit <default: 1>
[t] customshop_goldenak_limit <default: 1>

Other item cvars:

[a] customshop_health_amount <default: 50> -- Controls the health points you get when buying item "a"
[b] customshop_armor_amount <default: 100> -- Controls the armor points you get when buying item "b"
[f] customshop_bomber_amount <default: 20> -- Controls how many HE Grenades you get when buying item "f"
[h] customshop_fasterspeed_amount <default: 300.0> -- Controls the speed boost you get when buying item "h"
[i] customshop_lowgravity_amount <default: 0.5> -- Controls the gravity you get when buying item "i". Be aware that the lower the gravity is, the higher you jump
[k] customshop_drugs_speedamount <default: 300.0> -- Controls the speed boost you get when buying item "k"
[k] customshop_drugs_healthamount <default: 200> -- Controls the health points you get when buying item "k"
[l] customshop_transparency_amount <default: 75> -- Controls the transparency amount when buying item "l". Use a number from 0 to 255, the lower the number, the more transparency you get
[m] customshop_invisibility_time <default: 15.0> -- Controls how many seconds you're invisible when buying item "m"
[o] customshop_godmode_time <default: 5.0> -- Controls how many seconds you're immortal when buying item "o"
[p] customshop_healthregen_amount <default: 1> -- Controls how many health points you get every second when buying item "p"
[p] customshop_healthregen_time <default: 0.5> -- Controls the speed of regeneration when buying item "p"
[p] customshop_healthregen_max <default: 150> -- Controls the maximum amount of regenerated health when buying item "p"
[q] customshop_armorregen_amount <default: 10> -- Controls how many armor points you get every second when buying item "p"
[q] customshop_armorregen_time <default: 0.5> -- Controls the speed of regeneration when buying item "p"
[q] customshop_armorregen_max <default: 150> -- Controls the maximum amount of regenerated armor when buying item "p"
[t] customshop_goldenak_damage <default: 5> -- Controls the the damage multiplier for item "t"
[t] customshop_goldenak_bullets <default: 1> -- Controls whether item "t" will use golden bullets or not
[t] customshop_goldenak_ammo <default: 500> -- Controls how many ammo item "t" has

The plugin also allows you to add a custom sound for every item, check g_itemSounds.
*/

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <nvault>

#define PLUGIN_NAME "Custom Shop"
#define PLUGIN_VERSION "2.2"
#define PLUGIN_AUTHOR "OciXCrom"

#define FLAG_ADMIN ADMIN_SLAY
#define MAX_ITEMS 19
#define m_pActiveItem 373

#define sNo "buttons/button11.wav"
#define sOver "buttons/blip2.wav"

#define mGoldenAKp "models/custom_shop/p_goldenak.mdl"
#define mGoldenAKv "models/custom_shop/v_goldenak.mdl"

new const szPrefix[] = "^4[Custom Shop]"

enum Color
{
	NORMAL = 1, // clients scr_concolor cvar color
	GREEN, // Green Color
	TEAM_COLOR, // Red, grey, blue
	GREY, // grey
	RED, // Red
	BLUE, // Blue
}

new TeamName[][] = 
{
	"",
	"TERRORIST",
	"CT",
	"SPECTATOR"
}

new const g_playerModels[][] = {
	"arctic",
	"guerilla",
	"leet",
	"terror",
	"gign",
	"gsg9",
	"sas",
	"urban"
}

new const g_itemSounds[][] = {
	"items/smallmedkit1.wav", // Item "a": +50 Health
	"items/ammopickup2.wav", // Item "b": +50 Armor
	"items/gunpickup2.wav", // Item "c": Unlimited Clip
	"items/gunpickup2.wav", // Item "d": Unlimited Ammo
	"items/gunpickup2.wav", // Item "e": All Grenades
	"x/x_pain2.wav", // Item "f": Bomber
	"items/gunpickup2.wav", // Item "g": Silent Footsteps
	"misc/bipbip.wav", // Item "h": Faster Speed
	"items/gunpickup2.wav", // Item "i": Low Gravity
	"items/gunpickup2.wav", // Item "j": Chameleon
	"items/gunpickup2.wav", // Item "k": Drugs (Speed + Health)
	"items/gunpickup2.wav", // Item "l": Transparency
	"hornet/ag_buzz1.wav", // Item "m": Invisibility (15 Seconds)
	"items/gunpickup2.wav", // Item "n": Double Damage
	"misc/stinger12.wav", // Item "o": GodMode (5 Seconds)
	"items/suitchargeok1.wav", // Item "p": Health Regeneration
	"items/suitchargeok1.wav", // Item "q": Armor Regeneration
	"items/gunpickup2.wav", // Item "r": No Recoil
	"items/gunpickup2.wav", // Item "s": AWP
	"items/gunpickup2.wav" // Item "t": Golden AK
}

new DisabledItems, VIPOnly, VIPBonus, FlagAccess, FlagBonus, gmsg_SetFOV, GoldenBullet
new HealthAmount, HealthPrice, ArmorAmount, ArmorPrice, UnlimitedClipPrice, UnlimitedAmmoPrice, AllGrenadesPrice, BomberPrice, BomberAmount, SilentFootstepsPrice
new FasterSpeedAmount, FasterSpeedPrice, LowGravityAmount, LowGravityPrice, ChameleonPrice, DrugsSpeedAmount, DrugsHealthAmount, DrugsPrice
new TransparencyAmount, TransparencyPrice, InvisibilityTime, InvisibilityPrice, DoubleDamagePrice, GodModeTime, GodModePrice, HealthRegenAmount, HealthRegenTime
new HealthRegenMax, HealthRegenPrice, ArmorRegenAmount, ArmorRegenTime, ArmorRegenMax, ArmorRegenPrice, InfoMessageEnabled, InfoMessageTime, ShopEquip, ShopPoints
new SavePoints, TeamKillPoints, KillMessage, NormalReward, HeadshotReward, KnifeReward, CurrencySymbol, NoRecoilPrice, AWPPrice, TeamOnly
new HealthLimit, ArmorLimit, UnlimitedClipLimit, UnlimitedAmmoLimit, AllGrenadesLimit, BomberLimit, SilentFootstepsLimit, FasterSpeedLimit, LowGravityLimit, ChameleonLimit
new DrugsLimit, TransparencyLimit, InvisibilityLimit, DoubleDamageLimit, GodModeLimit, HealthRegenLimit, ArmorRegenLimit, NoRecoilLimit, AWPLimit, GoldenAKPrice, GoldenAKLimit
new GoldenAKBullets, GoldenAKDamage, GoldenAKAmmo, HUDEnabled, HUDRed, HUDGreen, HUDBlue, HUDX, HUDY, BonusReward
new g_vault, activity, cvar, hudinfo

new weapon[33], points[33], bullets[33]
new userlimit[33][33]

new bool:cshop_speed[33]
new bool:cshop_ddamage[33]
new bool:cshop_healthregen[33]
new bool:cshop_armorregen[33]
new bool:cshop_norecoil[33]
new bool:cshop_goldenak[33]

new bool:use_points

new const g_itemLanguage[][] = {
	"CSHOP_HEALTH",
	"CSHOP_ARMOR",
	"CSHOP_UNLCLIP",
	"CSHOP_UNLAMMO",
	"CSHOP_ALLGRENADES",
	"CSHOP_BOMBER",
	"CSHOP_SILENTSTEPS",
	"CSHOP_FASTERSPEED",
	"CSHOP_LOWGRAVITY",
	"CSHOP_CHAMELEON",
	"CSHOP_DRUGS",
	"CSHOP_TRANSPARENCY",
	"CSHOP_INVISIBILITY",
	"CSHOP_DDAMAGE",
	"CSHOP_GODMODE",
	"CSHOP_HEALTHREGEN",
	"CSHOP_ARMORREGEN",
	"CSHOP_NORECOIL",
	"CSHOP_AWP",
	"CSHOP_GOLDENAK"
}

public plugin_init()
{
	register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
	register_cvar("CustomShop", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
	register_dictionary("custom_shop.txt")
	
	register_event("CurWeapon", "change_weapon", "be", "1=1")
	register_event("CurWeapon", "goldenak_bullets", "be", "1=1", "3>0")
	register_event("DeathMsg", "player_killed", "a")
	RegisterHam(Ham_Spawn, "player", "player_spawn", 1)
	RegisterHam(Ham_TakeDamage, "player", "player_damage")
	register_forward(FM_PlayerPreThink, "player_prethink")
	
	register_clcmd("say /shop", "cshop_main")
	register_clcmd("say_team /shop", "cshop_main")
	register_clcmd("say /points", "cmd_points")
	register_clcmd("say_team /points", "cmd_points")
	
	ShopPoints = register_cvar("customshop_points", "0")
	use_points = (get_pcvar_num(ShopPoints) == 1) ? true : false
	
	DisabledItems = register_cvar("customshop_disableditems", "")
	VIPOnly = register_cvar("customshop_viponly", "0")
	FlagAccess = register_cvar("customshop_flag_access", "b")
	
	if(use_points)
	{
		VIPBonus = register_cvar("customshop_vipbonus", "0")
		FlagBonus = register_cvar("customshop_flag_bonus", "b")
		HealthPrice = register_cvar("customshop_health_price2", "150")
		ArmorPrice = register_cvar("customshop_armor_price2", "100")
		UnlimitedClipPrice = register_cvar("customshop_unlclip_price2", "300")
		UnlimitedAmmoPrice = register_cvar("customshop_unlammo_price2", "20")
		AllGrenadesPrice = register_cvar("customshop_allgrenades_price2", "80")
		BomberPrice = register_cvar("customshop_bomber_price2", "160")
		SilentFootstepsPrice = register_cvar("customshop_silentsteps_price2", "300")
		FasterSpeedPrice = register_cvar("customshop_fasterspeed_price2", "430")
		LowGravityPrice = register_cvar("customshop_lowgravity_price2", "280")
		ChameleonPrice = register_cvar("customshop_chameleon_price2", "900")
		DrugsPrice = register_cvar("customshop_drugs_price2", "800")
		TransparencyPrice = register_cvar("customshop_transparency_price2", "250")
		InvisibilityPrice = register_cvar("customshop_invisibility_price2", "1600")
		DoubleDamagePrice = register_cvar("customshop_doubledamage_price2", "1000")
		GodModePrice = register_cvar("customshop_godmode_price2", "1600")
		HealthRegenPrice = register_cvar("customshop_healthregen_price2", "180")
		ArmorRegenPrice = register_cvar("customshop_armorregen_price2", "200")
		SavePoints = register_cvar("customshop_savepoints", "1")
		TeamKillPoints = register_cvar("customshop_teamkillpoints", "0")
		KillMessage = register_cvar("customshop_killmessage", "1")
		NormalReward = register_cvar("customshop_reward_normal", "15")
		HeadshotReward = register_cvar("customshop_reward_headshot", "30")
		KnifeReward = register_cvar("customshop_reward_knife", "50")
		CurrencySymbol = register_cvar("customshop_currency_symbol2", " Pts.")
		NoRecoilPrice = register_cvar("customshop_norecoil_price2", "1200")
		AWPPrice = register_cvar("customshop_awp_price2", "475")
		GoldenAKPrice = register_cvar("customshop_goldenak_price2", "1600")
		HUDEnabled = register_cvar("customshop_hud", "0")
		HUDRed = register_cvar("customshop_hud_red", "255")
		HUDGreen = register_cvar("customshop_hud_green", "255")
		HUDBlue = register_cvar("customshop_hud_blue", "0")
		HUDX = register_cvar("customshop_hud_x", "0.01")
		HUDY = register_cvar("customshop_hud_y", "0.93")
		BonusReward = register_cvar("customshop_reward_bonus", "10")
		
		register_concmd("amx_points", "cmd_givepoints", FLAG_ADMIN, "<nick|#userid|@team> <points to give/take>")
	}
	else
	{
		HealthPrice = register_cvar("customshop_health_price", "1500")
		ArmorPrice = register_cvar("customshop_armor_price", "1000")
		UnlimitedClipPrice = register_cvar("customshop_unlclip_price", "3000")
		UnlimitedAmmoPrice = register_cvar("customshop_unlammo_price", "200")
		AllGrenadesPrice = register_cvar("customshop_allgrenades_price", "800")
		BomberPrice = register_cvar("customshop_bomber_price", "1600")
		SilentFootstepsPrice = register_cvar("customshop_silentsteps_price", "3000")
		FasterSpeedPrice = register_cvar("customshop_fasterspeed_price", "4300")
		LowGravityPrice = register_cvar("customshop_lowgravity_price", "2800")
		ChameleonPrice = register_cvar("customshop_chameleon_price", "9000")
		DrugsPrice = register_cvar("customshop_drugs_price", "8000")
		TransparencyPrice = register_cvar("customshop_transparency_price", "2500")
		InvisibilityPrice = register_cvar("customshop_invisibility_price", "16000")
		DoubleDamagePrice = register_cvar("customshop_doubledamage_price", "10000")
		GodModePrice = register_cvar("customshop_godmode_price", "16000")
		HealthRegenPrice = register_cvar("customshop_healthregen_price", "1800")
		ArmorRegenPrice = register_cvar("customshop_armorregen_price", "2000")
		CurrencySymbol = register_cvar("customshop_currency_symbol", "$")
		NoRecoilPrice = register_cvar("customshop_norecoil_price", "12000")
		AWPPrice = register_cvar("customshop_awp_price", "4750")
		GoldenAKPrice = register_cvar("customshop_goldenak_price", "16000")
	}
	
	HealthAmount = register_cvar("customshop_health_amount", "50")
	ArmorAmount = register_cvar("customshop_armor_amount", "100")
	BomberAmount = register_cvar("customshop_bomber_amount", "20")
	FasterSpeedAmount = register_cvar("customshop_fasterspeed_amount", "300.0")
	LowGravityAmount = register_cvar("customshop_lowgravity_amount", "0.5")
	DrugsSpeedAmount = register_cvar("customshop_drugs_speedamount", "300.0")
	DrugsHealthAmount = register_cvar("customshop_drugs_healthamount", "200")
	TransparencyAmount = register_cvar("customshop_transparency_amount", "75")
	InvisibilityTime = register_cvar("customshop_invisibility_time", "15.0")
	GodModeTime = register_cvar("customshop_godmode_time", "5.0")
	HealthRegenAmount = register_cvar("customshop_healthregen_amount", "1")
	HealthRegenTime = register_cvar("customshop_healthregen_time", "0.5")
	HealthRegenMax = register_cvar("customshop_healthregen_max", "150")
	ArmorRegenAmount = register_cvar("customshop_armorregen_amount", "10")
	ArmorRegenTime = register_cvar("customshop_armorregen_time", "0.5")
	ArmorRegenMax = register_cvar("customshop_armorregen_max", "150")
	InfoMessageEnabled = register_cvar("customshop_infomessage_enabled", "1")
	InfoMessageTime = register_cvar("customshop_infomessage_time", "90.0")
	ShopEquip = register_cvar("customshop_buyequip", "1")
	TeamOnly = register_cvar("customshop_teamonly", "0")
	
	HealthLimit = register_cvar("customshop_health_limit", "5")
	ArmorLimit = register_cvar("customshop_armor_limit", "8")
	UnlimitedClipLimit = register_cvar("customshop_unlclip_limit", "3")
	UnlimitedAmmoLimit = register_cvar("customshop_unlammo_limit", "5")
	AllGrenadesLimit = register_cvar("customshop_allgrenades_limit", "10")
	BomberLimit = register_cvar("customshop_bomber_limit", "3")
	SilentFootstepsLimit = register_cvar("customshop_silentsteps_limit", "1")
	FasterSpeedLimit = register_cvar("customshop_fasterspeed_limit", "1")
	LowGravityLimit = register_cvar("customshop_lowgravity_limit", "1")
	ChameleonLimit = register_cvar("customshop_chameleon_limit", "1")
	DrugsLimit = register_cvar("customshop_drugs_limit", "2")
	TransparencyLimit = register_cvar("customshop_transparency_limit", "1")
	InvisibilityLimit = register_cvar("customshop_invisibility_limit", "3")
	DoubleDamageLimit = register_cvar("customshop_doubledamage_limit", "1")
	GodModeLimit = register_cvar("customshop_godmode_limit", "1")
	HealthRegenLimit = register_cvar("customshop_healthregen_limit", "2")
	ArmorRegenLimit = register_cvar("customshop_armorregen_limit", "2")
	NoRecoilLimit = register_cvar("customshop_norecoil_limit", "1")
	AWPLimit = register_cvar("customshop_awp_limit", "1")
	GoldenAKLimit = register_cvar("customshop_goldenak_limit", "1")
	GoldenAKBullets = register_cvar("customshop_goldenak_bullets", "1")
	GoldenAKDamage = register_cvar("customshop_goldenak_damage", "5")
	GoldenAKAmmo = register_cvar("customshop_goldenak_ammo", "500")
	
	if(get_pcvar_num(ShopEquip) == 1) register_clcmd("buyequip", "cshop_main")
	if(get_pcvar_num(InfoMessageEnabled) == 1) set_task(get_pcvar_float(InfoMessageTime), "infoMessage", 1111, "", 0, "b", 0)
	
	gmsg_SetFOV = get_user_msgid("SetFOV")
	g_vault = nvault_open("CutomShop")
	activity = get_pcvar_num(get_cvar_pointer("amx_show_activity"))
	hudinfo = CreateHudSyncObj()
}

public client_putinserver(id)
{
	cshop_speed[id] = false
	cshop_ddamage[id] = false
	cshop_healthregen[id] = false
	cshop_armorregen[id] = false
	cshop_norecoil[id] = false
	cshop_goldenak[id] = false
	
	if(get_pcvar_num(HUDEnabled) == 1) set_task(1.0, "hud_bar", id, _, _, "b")
	LoadData(id)
}

public client_disconnect(id)
	if(use_points && get_pcvar_num(SavePoints) == 1) SaveData(id)
	
public hud_bar(id)
{
	if(is_user_alive(id))
	{
		set_hudmessage(get_pcvar_num(HUDRed), get_pcvar_num(HUDGreen), get_pcvar_num(HUDBlue), get_pcvar_float(HUDX), get_pcvar_float(HUDY), 0, 6.0, 2.5)
		ShowSyncHudMsg(id, hudinfo, "%L: %i", LANG_SERVER, "CSHOP_POINTS", points[id])
	}
}

public SaveData(id)
{
	new name[32]
	get_user_name(id, name, 31)
	new vaultkey[64], vaultdata[256]
    
	format(vaultkey, 63, "%s", name)
	format(vaultdata, 255, "%i", points[id])
	nvault_set(g_vault, vaultkey, vaultdata)
    
	return PLUGIN_CONTINUE
}

LoadData(id)
{
	new name[32]
	get_user_name(id, name, 31)
	new vaultkey[64], vaultdata[256]
    
	format(vaultkey, 63, "%s", name)
	format(vaultdata, 255, "%i", points[id])
	nvault_get(g_vault, vaultkey, vaultdata, 255)
	
	new points_user[10]
	parse(vaultdata, points_user, 9)
	
	new points_set = str_to_num(points_user)
	points[id] = points_set
    
	return PLUGIN_CONTINUE
}

public player_spawn(id)
{
	cshop_speed[id] = false
	cshop_ddamage[id] = false
	cshop_healthregen[id] = false
	cshop_armorregen[id] = false
	cshop_norecoil[id] = false
	cshop_goldenak[id] = false
	if(is_user_alive(id))
	{
		set_user_footsteps(id, 0)
		set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255)
	}
	if(is_user_connected(id)) cs_reset_user_model(id)
	
	for(new i = 0; i < MAX_ITEMS + 1; i++)
		set_user_limit(id, i, 0)
}

public change_weapon(id)
{
	weapon[id] = get_user_weapon(id)
	if(cshop_speed[id]) set_user_maxspeed(id, get_pcvar_float(FasterSpeedAmount))
	
	if(cshop_goldenak[id] && weapon[id] == CSW_AK47)
		set_goldenak(id)
}

public set_goldenak(id)
{
	if(cshop_goldenak[id] && weapon[id] == CSW_AK47)
	{
		set_pev(id, pev_viewmodel2, mGoldenAKv)
		set_pev(id, pev_weaponmodel2, mGoldenAKp)
	}
}

public goldenak_bullets(id) // Credits to AlejandroSk [ https://forums.alliedmods.net/showthread.php?p=827532 ]
{
	if(cshop_goldenak[id] && get_pcvar_num(GoldenAKBullets) == 1)
	{
		new clip, ammo
		new wpnid = get_user_weapon(id, clip, ammo)
		new pteam[16]
		
		get_user_team(id, pteam, 15)
		
		if((bullets[id] > clip) && (wpnid == CSW_AK47))
		{
			new vec1[3], vec2[3]
			get_user_origin(id, vec1, 1)
			get_user_origin(id, vec2, 4)
			
			message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
			write_byte(0)
			write_coord(vec1[0])
			write_coord(vec1[1])
			write_coord(vec1[2])
			write_coord(vec2[0])
			write_coord(vec2[1])
			write_coord(vec2[2])
			write_short(GoldenBullet)
			write_byte(1)
			write_byte(5)
			write_byte(2)
			write_byte(10)
			write_byte(0)
			write_byte(255)
			write_byte(215)
			write_byte(0)
			write_byte(200)
			write_byte(150)
			message_end()
		}
		
		bullets[id] = clip
	}
}

public infoMessage()
	ColorChat(0, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_INFO", PLUGIN_NAME, PLUGIN_AUTHOR)

public cmd_points(id)
{
	if(!use_points) ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_NOPOINTS")	
	else ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_YOURPOINTS", points[id])
	
	return PLUGIN_HANDLED
}

public cmd_givepoints(id, level, cid)
{
	if(!cmd_access(id, level, cid, 3))
		return PLUGIN_HANDLED

	new arg[32], arg2[8], name[32], name2[32], g_players[32], num, player
	read_argv(1, arg, 31)
	read_argv(2, arg2, 7)
	get_players(g_players, num)
	get_user_name(id, name, 31)
	
	new amount = str_to_num(arg2)	
	new count = 0

	if(arg[0] == '@')
	{
		for(new i = 0; i < num; i++)
		{
			player = g_players[i]
			
			if((equali(arg, "@T") && get_user_team(player) == 1) || (equali(arg, "@CT") && get_user_team(player) == 2) || equali(arg, "@ALL"))
			{
				points[player] += amount
				count++
			}
		}
		
		if(count == 0)
		{
			ColorChat(id, RED, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_NOPLAYERS")
			client_print(id, print_console, "%s %L", szPrefix, LANG_SERVER, "CSHOP_NOPLAYERS")
			return PLUGIN_HANDLED
		}
		
		if(equali(arg, "@T")) formatex(name2, 31, "%L", LANG_SERVER, "CSHOP_ALL_T")
		else if(equali(arg, "@CT")) formatex(name2, 31, "%L", LANG_SERVER, "CSHOP_ALL_CT")
		else formatex(name2, 31, "%L", LANG_SERVER, "CSHOP_ALL_PLR")
	}
	else
	{
		player = cmd_target(id, arg, 0)
		if(!player) return PLUGIN_HANDLED
		
		get_user_name(player, name2, 31)
		
		if(amount == 0)
		{
			ColorChat(0, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_TOOKALL", name, name2)
			client_print(id, print_console, "%s %L", szPrefix, LANG_SERVER, "CSHOP_TOOKALL_CONSOLE", name2)
			log_amx("%s %L", szPrefix, LANG_SERVER, "CSHOP_TOOKALL_LOG", name, name2)
			
			points[player] = 0
			return PLUGIN_HANDLED
		}
		
		points[player] += amount
	}
	
	switch(activity)
	{
		case 1: ColorChat(0, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_GIVEPOINTS", LANG_SERVER, (amount >= 0) ? "CSHOP_GAVE" : "CSHOP_TOOK", abs(amount), LANG_SERVER, (amount >= 0) ? "CSHOP_TO" : "CSHOP_FROM", name2)
		case 2: ColorChat(0, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_GIVEPOINTS", name, LANG_SERVER, (amount >= 0) ? "CSHOP_GAVE" : "CSHOP_TOOK", abs(amount), LANG_SERVER, (amount >= 0) ? "CSHOP_TO" : "CSHOP_FROM", name2)
	}
	
	client_print(id, print_console, "%s %L", szPrefix, LANG_SERVER, "CSHOP_GIVEPOINTS_CONSOLE", LANG_SERVER, (amount >= 0) ? "CSHOP_GAVE" : "CSHOP_TOOK", abs(amount), LANG_SERVER, (amount >= 0) ? "CSHOP_TO" : "CSHOP_FROM", name2)
	log_amx("%s %L", szPrefix, LANG_SERVER, "CSHOP_GIVEPOINTS_LOG", name, LANG_SERVER, (amount >= 0) ? "CSHOP_GAVE" : "CSHOP_TOOK", abs(amount), LANG_SERVER, (amount >= 0) ? "CSHOP_TO" : "CSHOP_FROM", name2)
	
	return PLUGIN_HANDLED
}
	
public cshop_main(id)
{
	if(get_pcvar_num(VIPOnly) == 1)
	{
		if(!(user_has_flag(id, FlagAccess)))
		{
			ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_NOACCESS")
			client_cmd(id, "spk %s", sNo)
			return PLUGIN_HANDLED
		}
	}
	
	new shop_team = get_pcvar_num(TeamOnly)
	new team = get_user_team(id)
	
	if(shop_team != 0)
	{
		if(shop_team != team)
		{
			ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_TEAMONLY", (shop_team == 1) ? "T" : (shop_team == 2) ? "CT" : "Spectator")
			client_cmd(id, "spk %s", sNo)
			return PLUGIN_HANDLED
		}
	}
	
	if(!is_user_alive(id))
	{
		ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_NOTALIVE")
		client_cmd(id, "spk %s", sNo)
		return PLUGIN_HANDLED
	}
	
	new menu_title[200], items[30], symbol[20]
	new amount = use_points ? points[id] : cs_get_user_money(id)
	get_pcvar_string(DisabledItems, items, charsmax(items))
	get_pcvar_string(CurrencySymbol, symbol, charsmax(symbol))
	
	formatex(menu_title, charsmax(menu_title), "\yOciXCrom's \rCustom Shop^n\w%L: \r%i \d| \w%L:\d", LANG_SERVER, use_points ? "CSHOP_POINTS" : "CSHOP_MONEY", amount, LANG_SERVER, "CSHOP_PAGE")
	new customshop = menu_create(menu_title, "cshop_handler")
	
	new item[80], close[15], back[15], next[15]
	
	if(contain(items, "a") == -1) // Item "a": +50 Health
	{
		formatex(item, charsmax(item), "%s+%i %L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(HealthPrice)) ? "" : "\d", get_pcvar_num(HealthAmount), LANG_SERVER, "CSHOP_HEALTH", get_pcvar_num(HealthPrice), symbol, get_user_limit(id, 0), itemlimit(0))
		menu_additem(customshop, item, "0", 0)
	}
	
	if(contain(items, "b") == -1) // Item "b": +50 Armor
	{
		formatex(item, charsmax(item), "%s+%i %L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(ArmorPrice)) ? "" : "\d", get_pcvar_num(ArmorAmount), LANG_SERVER, "CSHOP_ARMOR", get_pcvar_num(ArmorPrice), symbol, get_user_limit(id, 1), itemlimit(1))
		menu_additem(customshop, item, "1", 0)
	}	
	
	if(contain(items, "c") == -1) // Item "c": Unlimited Clip
	{
		formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(UnlimitedClipPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_UNLCLIP", get_pcvar_num(UnlimitedClipPrice), symbol, get_user_limit(id, 2), itemlimit(2))
		menu_additem(customshop, item, "2", 0)
	}
	
	if(contain(items, "d") == -1) // Item "d": Unlimited Ammo
	{
		formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(UnlimitedAmmoPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_UNLAMMO", get_pcvar_num(UnlimitedAmmoPrice), symbol, get_user_limit(id, 3), itemlimit(3))
		menu_additem(customshop, item, "3", 0)
	}	
	
	if(contain(items, "e") == -1) // Item "e": All Grenades
	{
		formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(AllGrenadesPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_ALLGRENADES", get_pcvar_num(AllGrenadesPrice), symbol, get_user_limit(id, 4), itemlimit(4))
		menu_additem(customshop, item, "4", 0)
	}	
	
	if(contain(items, "f") == -1) // Item "f": Bomber
	{
		formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(BomberPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_BOMBER", get_pcvar_num(BomberPrice), symbol, get_user_limit(id, 5), itemlimit(5))
		menu_additem(customshop, item, "5", 0)
	}	
	
	if(contain(items, "g") == -1) // Item "g": Silent Footsteps
	{
		formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(SilentFootstepsPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_SILENTSTEPS", get_pcvar_num(SilentFootstepsPrice), symbol, get_user_limit(id, 6), itemlimit(6))
		menu_additem(customshop, item, "6", 0)
	}	
	
	if(contain(items, "h") == -1) // Item "h": Faster Speed
	{
		formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(FasterSpeedPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_FASTERSPEED", get_pcvar_num(FasterSpeedPrice), symbol, get_user_limit(id, 7), itemlimit(7))
		menu_additem(customshop, item, "7", 0)
	}	
	
	if(contain(items, "i") == -1) // Item "i": Low Gravity
	{
		formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(LowGravityPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_LOWGRAVITY", get_pcvar_num(LowGravityPrice), symbol, get_user_limit(id, 8), itemlimit(8))
		menu_additem(customshop, item, "8", 0)
	}
	
	if(contain(items, "j") == -1) // Item "j": Chameleon
	{
		formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(ChameleonPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_CHAMELEON", get_pcvar_num(ChameleonPrice), symbol, get_user_limit(id, 9), itemlimit(9))
		menu_additem(customshop, item, "9", 0)
	}	
	
	if(contain(items, "k") == -1) // Item "k": Drugs (Speed + Health)
	{
		formatex(item, charsmax(item), "%s%L (%L) \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(DrugsPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_DRUGS", LANG_SERVER, "CSHOP_DRUGS2", get_pcvar_num(DrugsPrice), symbol, get_user_limit(id, 10), itemlimit(10))
		menu_additem(customshop, item, "10", 0)
	}	
	
	if(contain(items, "l") == -1) // Item "l": Transparency
	{
		formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(TransparencyPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_TRANSPARENCY", get_pcvar_num(TransparencyPrice), symbol, get_user_limit(id, 11), itemlimit(11))
		menu_additem(customshop, item, "11", 0)
	}	
	
	if(contain(items, "m") == -1) // Item "m": Invisibility (15 Seconds)
	{
		formatex(item, charsmax(item), "%s%L (%i %L) \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(InvisibilityPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_INVISIBILITY", get_pcvar_num(InvisibilityTime), LANG_SERVER, "CSHOP_SECONDS", get_pcvar_num(InvisibilityPrice), symbol, get_user_limit(id, 12), itemlimit(12))
		menu_additem(customshop, item, "12", 0)
	}	
	
	if(contain(items, "n") == -1) // Item "n": Double Damage
	{
		formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(DoubleDamagePrice)) ? "" : "\d", LANG_SERVER, "CSHOP_DDAMAGE", get_pcvar_num(DoubleDamagePrice), symbol, get_user_limit(id, 13), itemlimit(13))
		menu_additem(customshop, item, "13", 0)
	}	
	
	if(contain(items, "o") == -1) // Item "o": GodMode (5 Seconds)
	{
		formatex(item, charsmax(item), "%s%L (%i %L) \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(GodModePrice)) ? "" : "\d", LANG_SERVER, "CSHOP_GODMODE", get_pcvar_num(GodModeTime), LANG_SERVER, "CSHOP_SECONDS", get_pcvar_num(InvisibilityPrice), symbol, get_user_limit(id, 14), itemlimit(14))
		menu_additem(customshop, item, "14", 0)
	}
	
	if(contain(items, "p") == -1) // Item "p": Health Regeneration
	{
		formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(HealthRegenPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_HEALTHREGEN", get_pcvar_num(HealthRegenPrice), symbol, get_user_limit(id, 15), itemlimit(15))
		menu_additem(customshop, item, "15", 0)
	}	
	
	if(contain(items, "q") == -1) // Item "q": Armor Regeneration
	{
		formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(ArmorRegenPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_ARMORREGEN", get_pcvar_num(ArmorRegenPrice), symbol, get_user_limit(id, 16), itemlimit(16))
		menu_additem(customshop, item, "16", 0)
	}
	
	if(contain(items, "r") == -1) // Item "r": No Recoil
	{
		formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(NoRecoilPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_NORECOIL", get_pcvar_num(NoRecoilPrice), symbol, get_user_limit(id, 17), itemlimit(17))
		menu_additem(customshop, item, "17", 0)
	}
	
	if(contain(items, "s") == -1) // Item "s": AWP
	{
		formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(AWPPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_AWP", get_pcvar_num(AWPPrice), symbol, get_user_limit(id, 18), itemlimit(18))
		menu_additem(customshop, item, "18", 0)
	}
	
	if(contain(items, "t") == -1) // Item "t": Golden AK
	{
		formatex(item, charsmax(item), "%s%L \r[\y%i%s\r] [\y%i\r/\y%i\r]", (amount >= get_pcvar_num(GoldenAKPrice)) ? "" : "\d", LANG_SERVER, "CSHOP_GOLDENAK", get_pcvar_num(GoldenAKPrice), symbol, get_user_limit(id, 19), itemlimit(19))
		menu_additem(customshop, item, "19", 0)
	}
	
	formatex(close, charsmax(close), "%L", LANG_SERVER, "CSHOP_EXIT")
	formatex(back, charsmax(back), "%L", LANG_SERVER, "CSHOP_BACK")
	formatex(next, charsmax(next), "%L", LANG_SERVER, "CSHOP_NEXT")
	
	menu_setprop(customshop, MPROP_EXITNAME, close)
	menu_setprop(customshop, MPROP_BACKNAME, back)
	menu_setprop(customshop, MPROP_NEXTNAME, next)
	
	menu_display(id, customshop, 0)
	return PLUGIN_HANDLED
}

public cshop_handler(id, customshop, item)
{
	if(!is_user_alive(id) || item == MENU_EXIT)
	{
		menu_destroy(customshop)
		return PLUGIN_HANDLED
	}
	
	new data[6], iName[64], access, callback
	menu_item_getinfo(customshop, item, access, data, charsmax(data), iName, charsmax(iName), callback)

	new key = str_to_num(data)
	
	check_cvars(key)
	buy_item(id, key, cvar, g_itemLanguage[key])
	
	menu_destroy(customshop)
	return PLUGIN_HANDLED
}

stock buy_item(id, item, price, const msg[])
{
	if(get_user_limit(id, item) == itemlimit(item))
	{
		ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_LIMITREACHED", itemlimit(item))
		client_cmd(id, "spk %s", sNo)
		return
	}
	
	new amount = (use_points) ? points[id] : cs_get_user_money(id)
	
	new text[50]
	formatex(text, charsmax(text), "%s", msg)
	
	new symbol[20]
	get_pcvar_string(CurrencySymbol, symbol, charsmax(symbol))
	
	if(amount >= price)
	{
		if(item == 2 || item == 3)
		{
			buy_unlimited(id, item, price, text, symbol)
			return
		}
		else
		{
			switch(item)
			{
				case 0: set_user_health(id, get_user_health(id) + get_pcvar_num(HealthAmount))
				case 1: set_user_armor(id, get_user_armor(id) + get_pcvar_num(ArmorAmount))
				case 4:
				{
					give_item(id, "weapon_hegrenade")
					give_item(id, "weapon_flashbang")
					give_item(id, "weapon_flashbang")
					give_item(id, "weapon_smokegrenade")
				}
				case 5:
				{
					give_item(id, "weapon_hegrenade")
					cs_set_user_bpammo(id, CSW_HEGRENADE, get_pcvar_num(BomberAmount))
				}
				case 6: set_user_footsteps(id, 1)
				case 7:
				{
					cshop_speed[id] = true
					set_user_maxspeed(id, get_pcvar_float(FasterSpeedAmount))
				}
				case 8: set_user_gravity(id, get_pcvar_float(LowGravityAmount))
				case 9:
				{
					switch(get_user_team(id))
					{
						case 1: cs_set_user_model(id, g_playerModels[random_num(4, 7)])
						case 2: cs_set_user_model(id, g_playerModels[random_num(0, 3)])
					}
				}
				case 10:
				{
					set_user_health(id, get_pcvar_num(DrugsHealthAmount))
					set_user_maxspeed(id, get_pcvar_float(DrugsSpeedAmount))
					drug_player(id)
				}
				case 11: set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, get_pcvar_num(TransparencyAmount))
				case 12:
				{
					set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0)
					set_task(get_pcvar_float(InvisibilityTime), "NoMoreInvis", id)
				}
				case 13: cshop_ddamage[id] = true
				case 14:
				{
					set_user_godmode(id, 1)
					set_task(get_pcvar_float(GodModeTime), "NoMoreGod", id)
				}
				case 15:
				{
					cshop_healthregen[id] = true
					set_task(get_pcvar_float(HealthRegenTime), "healthRegenTicker", id, "", 0, "b", 0)
				}
				case 16:
				{
					cshop_armorregen[id] = true
					set_task(get_pcvar_float(ArmorRegenTime), "armorRegenTicker", id, "", 0, "b", 0)
				}
				case 17: cshop_norecoil[id] = true
				case 18:
				{
					give_item(id, "weapon_awp")
					cs_set_user_bpammo(id, CSW_AWP, 30)
				}
				case 19:
				{
					if(!user_has_weapon(id, CSW_AK47))
					{
						give_item(id, "weapon_ak47")
						cs_set_user_bpammo(id, CSW_AK47, get_pcvar_num(GoldenAKAmmo))
					}
					
					cshop_goldenak[id] = true
					set_goldenak(id)
				}
			}
		}
		
		set_user_limit(id, item, get_user_limit(id, item) + 1)
		player_charge(id, price)
		ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, msg, price, symbol)
		emit_sound(id, CHAN_ITEM, g_itemSounds[item], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	}
	else notenough(id)
}

public check_cvars(item)
{
	switch(item)
	{
		case 0: cvar = get_pcvar_num(HealthPrice)
		case 1: cvar = get_pcvar_num(ArmorPrice)
		case 2: cvar = get_pcvar_num(UnlimitedClipPrice)
		case 3: cvar = get_pcvar_num(UnlimitedAmmoPrice)
		case 4: cvar = get_pcvar_num(AllGrenadesPrice)
		case 5: cvar = get_pcvar_num(BomberPrice)
		case 6: cvar = get_pcvar_num(SilentFootstepsPrice)
		case 7: cvar = get_pcvar_num(FasterSpeedPrice)
		case 8: cvar = get_pcvar_num(LowGravityPrice)
		case 9: cvar = get_pcvar_num(ChameleonPrice)
		case 10: cvar = get_pcvar_num(DrugsPrice)
		case 11: cvar = get_pcvar_num(TransparencyPrice)
		case 12: cvar = get_pcvar_num(InvisibilityPrice)
		case 13: cvar = get_pcvar_num(DoubleDamagePrice)
		case 14: cvar = get_pcvar_num(GodModePrice)
		case 15: cvar = get_pcvar_num(HealthRegenPrice)
		case 16: cvar = get_pcvar_num(ArmorRegenPrice)
		case 17: cvar = get_pcvar_num(NoRecoilPrice)
		case 18: cvar = get_pcvar_num(AWPPrice)
		case 19: cvar = get_pcvar_num(GoldenAKPrice)
	}
}

stock buy_unlimited(id, item, price, msg[], symbol[20])
{
	if(weapon[id] == CSW_KNIFE || weapon[id] == CSW_HEGRENADE || weapon[id] == CSW_FLASHBANG || weapon[id] == CSW_SMOKEGRENADE || weapon[id] == CSW_C4)
	{
		cantactivateitem(id, item)
		return
	}
	else switch(item)
	{
		case 2:
		{
			cs_set_weapon_ammo(get_pdata_cbase(id, m_pActiveItem), 97280)
			cs_set_user_bpammo(id, weapon[id], 0)
		}
		case 3: cs_set_user_bpammo(id, weapon[id], 99999)		
	}
	
	set_user_limit(id, item, get_user_limit(id, item) + 1)
	player_charge(id, price)
	ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_BOUGHT", LANG_SERVER, msg, price, symbol)
	emit_sound(id, CHAN_ITEM, g_itemSounds[item], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}

stock itemlimit(item)
{
	new limit

	switch(item)
	{
		case 0: limit = get_pcvar_num(HealthLimit)
		case 1: limit = get_pcvar_num(ArmorLimit)
		case 2: limit = get_pcvar_num(UnlimitedClipLimit)
		case 3: limit = get_pcvar_num(UnlimitedAmmoLimit)
		case 4: limit = get_pcvar_num(AllGrenadesLimit)
		case 5: limit = get_pcvar_num(BomberLimit)
		case 6: limit = get_pcvar_num(SilentFootstepsLimit)
		case 7: limit = get_pcvar_num(FasterSpeedLimit)
		case 8: limit = get_pcvar_num(LowGravityLimit)
		case 9: limit = get_pcvar_num(ChameleonLimit)
		case 10: limit = get_pcvar_num(DrugsLimit)
		case 11: limit = get_pcvar_num(TransparencyLimit)
		case 12: limit = get_pcvar_num(InvisibilityLimit)
		case 13: limit = get_pcvar_num(DoubleDamageLimit)
		case 14: limit = get_pcvar_num(GodModeLimit)
		case 15: limit = get_pcvar_num(HealthRegenLimit)
		case 16: limit = get_pcvar_num(ArmorRegenLimit)
		case 17: limit = get_pcvar_num(NoRecoilLimit)
		case 18: limit = get_pcvar_num(AWPLimit)
		case 19: limit = get_pcvar_num(GoldenAKLimit)
	}
	
	return limit
}

stock set_user_limit(id, item, limit)
	userlimit[id][item] = limit

stock get_user_limit(id, item)
	return userlimit[id][item]

stock notenough(id)
{
	ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_NOTENOUGH", LANG_SERVER, use_points ? "CSHOP_POINTS_SMALL" : "CSHOP_MONEY_SMALL")
	client_cmd(id, "spk %s", sNo)
}

stock cantactivateitem(id, item)
{
	ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_CANNOT_ACTIVATE", LANG_SERVER, (item == 2) ? "CSHOP_UNLCLIP" : "CSHOP_UNLAMMO")
	client_cmd(id, "spk %s", sNo)
}

public NoMoreInvis(id)
{
	set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255)
	ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_NOMOREINVIS")
	client_cmd(id, "spk %s", sOver)
}

public NoMoreGod(id)
{
	if(is_user_alive(id)) set_user_godmode(id, 0)
	ColorChat(id, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_NOMOREGOD")
	client_cmd(id, "spk %s", sOver)
}

public player_damage(victim, inflictor, attacker, Float:damage, damage_bits)
{
	if(is_user_alive(attacker) && attacker != victim)
	{
		if(cshop_goldenak[attacker])
			SetHamParamFloat(4, damage * get_pcvar_num(GoldenAKDamage))
		else if(cshop_ddamage[attacker])
			SetHamParamFloat(4, damage * 2)
	}
}

public player_prethink(id)
{
	if(!is_user_alive(id) || !cshop_norecoil[id])
		return
	
	set_pev(id, pev_punchangle, {0.0, 0.0, 0.0})
}

stock player_charge(id, price)
{
	if(use_points) points[id] -= price
	else cs_set_user_money(id, cs_get_user_money(id) - price)
}

stock drug_player(id)
{
	message_begin(MSG_ONE, gmsg_SetFOV, {0, 0, 0}, id)
	write_byte(180)
	message_end()
}

public player_killed()
{	
	new attacker = read_data(1)
	new victim = read_data(2)
	
	if(!use_points || !is_user_connected(attacker) || !is_user_connected(victim) || attacker == victim)
		return HAM_IGNORED
	
	if(get_pcvar_num(VIPOnly) == 1)
	{
		if(!(user_has_flag(attacker, FlagAccess)))
            return HAM_IGNORED
    }
	
	new headshot = read_data(3)

	new wep[32]
	read_data(4, wep, 31)
	
	new team_attacker = get_user_team(attacker)
	new team_victim = get_user_team(victim)
	
	if(team_attacker == team_victim)
	{
		if(get_pcvar_num(TeamKillPoints) == 0)
			return HAM_IGNORED
	}
	
	new reward
	
	if(equali(wep, "knife")) reward = get_pcvar_num(KnifeReward)
	else if(headshot) reward = get_pcvar_num(HeadshotReward)
	else reward = get_pcvar_num(NormalReward)
	
	if(get_pcvar_num(VIPBonus) == 1 && user_has_flag(attacker, FlagBonus)) reward += get_pcvar_num(BonusReward)
	points[attacker] += reward
	
	if(get_pcvar_num(KillMessage) == 1)
	{
		new name_victim[32]
		get_user_name(victim, name_victim, 31)
		
		ColorChat(attacker, TEAM_COLOR, "%s ^1%L", szPrefix, LANG_SERVER, "CSHOP_KILL", reward, name_victim)
	}
	
	return HAM_IGNORED
}

public healthRegenTicker(id)
{
	if(!is_user_alive(id) || !cshop_healthregen[id]) remove_task(id)
	
	new health = get_user_health(id)
	new healthamount = get_pcvar_num(HealthRegenAmount)
	new healthmax = get_pcvar_num(HealthRegenMax)
	
	if(cshop_healthregen[id] && is_user_alive(id))
	{
		if(health < healthmax)
		{
			if(health + healthamount > healthmax) set_user_health(id, healthmax)
			else set_user_health(id, health + healthamount)
		}
	}
}

public armorRegenTicker(id)
{
	if(!is_user_alive(id) || !cshop_armorregen[id]) remove_task(id)
	
	new armor = get_user_armor(id)
	new armoramount = get_pcvar_num(ArmorRegenAmount)
	new armormax = get_pcvar_num(ArmorRegenMax)
		
	if(cshop_armorregen[id] && is_user_alive(id))
	{
		if(armor < armormax)
		{
			if(armor + armoramount > armormax) set_user_armor(id, armormax)
			else set_user_armor(id, armor + armoramount)
		}
	}
}

public plugin_precache()
{
	for(new i = 0; i < sizeof g_itemSounds; i++)
		precache_sound(g_itemSounds[i])
	
	precache_model(mGoldenAKp)
	precache_model(mGoldenAKv)
	
	GoldenBullet = precache_model("sprites/dot.spr")
}

stock user_has_flag(id, cvar)
{
	new flags[32]
	get_flags(get_user_flags(id), flags, charsmax(flags))
	
	new vip_flag[2]
	get_pcvar_string(cvar, vip_flag, charsmax(vip_flag))
	
	return (contain(flags, vip_flag) != -1) ? true : false
}

/* ======================================================================================================= */
/* ColorChat */
/* ======================================================================================================= */
ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
{
	if( !get_playersnum() ) return;
	
	new message[256];

	switch(type)
	{
		case NORMAL: // clients scr_concolor cvar color
		{
			message[0] = 0x01;
		}
		case GREEN: // Green
		{
			message[0] = 0x04;
		}
		default: // White, Red, Blue
		{
			message[0] = 0x03;
		}
	}

	vformat(message[1], 251, msg, 4);

	replace_all(message, 191, "!n", "^x01")
	replace_all(message, 191, "!t", "^x03")
	replace_all(message, 191, "!g", "^x04")
	
	// Make sure message is not longer than 192 character. Will crash the server.
	message[192] = '^0';

	new team, ColorChange, index, MSG_Type;
	
	if(id)
	{
		MSG_Type = MSG_ONE;
		index = id;
	} else {
		index = FindPlayer();
		MSG_Type = MSG_ALL;
	}
	
	team = get_user_team(index);
	ColorChange = ColorSelection(index, MSG_Type, type);

	ShowColorMessage(index, MSG_Type, message);
		
	if(ColorChange)
	{
		Team_Info(index, MSG_Type, TeamName[team]);
	}
}

ShowColorMessage(id, type, message[])
{
	static bool:saytext_used;
	static get_user_msgid_saytext;
	if(!saytext_used)
	{
		get_user_msgid_saytext = get_user_msgid("SayText");
		saytext_used = true;
	}
	message_begin(type, get_user_msgid_saytext, _, id);
	write_byte(id)		
	write_string(message);
	message_end();	
}

Team_Info(id, type, team[])
{
	static bool:teaminfo_used;
	static get_user_msgid_teaminfo;
	if(!teaminfo_used)
	{
		get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
		teaminfo_used = true;
	}
	message_begin(type, get_user_msgid_teaminfo, _, id);
	write_byte(id);
	write_string(team);
	message_end();

	return 1;
}

ColorSelection(index, type, Color:Type)
{
	switch(Type)
	{
		case RED:
		{
			return Team_Info(index, type, TeamName[1]);
		}
		case BLUE:
		{
			return Team_Info(index, type, TeamName[2]);
		}
		case GREY:
		{
			return Team_Info(index, type, TeamName[0]);
		}
	}

	return 0;
}

FindPlayer()
{
	new i = -1;

	while(i <= get_maxplayers())
	{
		if(is_user_connected(++i))
			return i;
	}

	return -1;
}
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 10 guests