#include <amxmodx>
#include <gamecms5>
#include <gamecms_present>
#include <fakemeta_util>
#include <cstrike>
new cpMaxMoney, cpMaxHealth;
public OnPresentCoreStopped()
pause("d");
public plugin_cfg()
{
cpMaxMoney = get_cvar_pointer("cms_present_maxmoney");
cpMaxHealth = get_cvar_pointer("cms_present_maxhealth");
set_cvar_num("cms_presents_std", 0);
new tmpName[128];
formatex(tmpName, charsmax(tmpName), "%L", LANG_PLAYER, "CMS_PRESENT_STD_DEALGE");
CmsAddPresent(-3, tmpName, -1, -3);
formatex(tmpName, charsmax(tmpName), "%L", LANG_PLAYER, "CMS_PRESENT_STD_MONEY1");
CmsAddPresent(-2, tmpName, -1, -3);
formatex(tmpName, charsmax(tmpName), "%L", LANG_PLAYER, "CMS_PRESENT_STD_AWP");
CmsAddPresent(-1, tmpName, -1, -3);
formatex(tmpName, charsmax(tmpName), "%L", LANG_PLAYER, "CMS_PRESENT_STD_AK");
CmsAddPresent(1, tmpName, -1, -3);
formatex(tmpName, charsmax(tmpName), "%L", LANG_PLAYER, "CMS_PRESENT_STD_M4");
CmsAddPresent(2, tmpName, -1, -3);
formatex(tmpName, charsmax(tmpName), "%L", LANG_PLAYER, "CMS_PRESENT_STD_MONEY2");
CmsAddPresent(3, tmpName, -1, -3);
formatex(tmpName, charsmax(tmpName), "%L", LANG_PLAYER, "CMS_PRESENT_STD_HP");
CmsAddPresent(4, tmpName, -1, -3);
}
public OnTakePresent(id, itemId)
{
switch(itemId)
{
case -3:
{
DropWeapons(id, "weapon_deagle", CSW_DEAGLE, 30, 2);
return PLUGIN_HANDLED;
}
case -2:
{
cs_set_user_money(id, min(cs_get_user_money(id) + 2000, get_pcvar_num(cpMaxMoney)));
return PLUGIN_HANDLED;
}
case -1:
{
DropWeapons(id, "weapon_awp", CSW_AWP, 30, 1);
return PLUGIN_HANDLED;
}
case 1:
{
DropWeapons(id, "weapon_ak47", CSW_AK47, 90, 1);
return PLUGIN_HANDLED;
}
case 2:
{
DropWeapons(id, "weapon_m4a1", CSW_M4A1, 90, 1);
return PLUGIN_HANDLED;
}
case 3:
{
cs_set_user_money(id, min(cs_get_user_money(id) + 500, get_pcvar_num(cpMaxMoney)));
client_cmd(id, "spk ^"buttons/bell1^"");
return PLUGIN_HANDLED;
}
case 4:
{
fm_set_user_health(id, min(get_user_health(id) + 20, get_pcvar_num(cpMaxHealth)));
client_cmd(0, "spk ^"buttons/bell1^"");
return PLUGIN_HANDLED;
}
}
return PLUGIN_CONTINUE;
}
stock DropWeapons(id, wpnName[], wpnID, iAmmo, wpnType)
{
#define PRIMARY_WEAPON ((1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|\
(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|\
(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90))
#define SECONDARY_WEAPON ((1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_P228)|(1<<CSW_DEAGLE))
new weapons[32], num, i;
get_user_weapons(id, weapons, num);
switch(wpnType)
{
case 1: wpnType = PRIMARY_WEAPON;
case 2: wpnType = SECONDARY_WEAPON;
}
static weap_name[32];
for(i = 0; i < num; i++)
{
if(wpnType & (1<<weapons[i]))
{
get_weaponname(weapons[i], weap_name, sizeof weap_name - 1);
engclient_cmd(id, "drop", weap_name);
}
}
fm_give_item(id, wpnName);
cs_set_user_bpammo(id, wpnID, iAmmo);
}