#include <amxmodx>
#include <cstrike>
#include <fakemeta>

#define PLUGIN "Steroids"
#define VERSION "1.0"
#define AUTHOR "unknown._."

//CVAR
new cvar_on, cvar_cost, cvar_health, cvar_gravity

new name[18]

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_clcmd("say /tutorial", "steroids")
	cvar_on = register_cvar("amx_steroids", "1") // 開關
	cvar_cost = register_cvar("amx_steroids_cost", "3000") // 物品價錢
	cvar_health = register_cvar("amx_steroids_add", "150") //加幾多血的指令
	cvar_gravity = register_cvar("amx_gravity", "0.6") // 800*0.6 
}

public steroids(id)
{
	if (!get_pcvar_num(cvar_on))
	{
		client_print(id, print_chat,"管理員關閉了插件")
		return PLUGIN_HANDLED
	}
	new money = cs_get_user_money(id)
	new cost = get_pcvar_float(cvar_cost)

	if (money < cost)
	{
		client_print(id, print_chat,"這物品需要 %d 才能使用", get_pcvar_float(cvar_cost))
		return PLUGIN_HANDLED
	}

	cs_set_user_money(id, money - cost, 1)

	static Float:health
	pev(id, pev_health, health)
	new steroids = get_pcvar_num(cvar_health)
	set_pev(id, pev_health, floatmax(0.0, health + steroids))  //用fakemeta語言
	set_pev(id, pev_gravity, get_pcvar_float(cvar_gravity))

	get_user_name(id, name, 17)

	client_print(id, print_chat,"你已成功購買!")
	client_print(0, print_chat, "玩家 %s 購買了steroids", name)

	return PLUGIN_HANDLED
}

