PDA

View Full Version : cerere plugin lider



^JoK3R^
29-08-2014, 02:02 PM
Salut tuturor ,am un plugin care cred ca o sa va dea batai de cap ... Am un shop cu credite si as vrea sa fie pe bani , uitati sursa : :)

#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <engine>
#include <fun>

#define PLUGIN "Furien Shop"
#define VERSION "2.0"
#define AUTHOR "DaNNe."

#define VIP_LEVEL ADMIN_LEVEL_H

// Pet
#define fm_precache_model(%1) engfunc(EngFunc_PrecacheModel,%1)
#define fm_precache_sound(%1) engfunc(EngFunc_PrecacheSound,%1)
#define fm_remove_entity(%1) engfunc(EngFunc_RemoveEntity, %1)
//#define fm_drop_to_floor(%1) engfunc(EngFunc_DropToFloor,%1)
#define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
#define fm_set_user_gravity(%1,%2) set_pev(%1,pev_gravity,%2)

#define PET_FLAG pev_flTimeStepSound
#define PET_KILLED 389

static const pet_model[] = "models/stukabat.mdl"
static const pet_sounds[][] = { "bullchicken/bc_die1.wav", "bullchicken/bc_die2.wav", "bullchicken/bc_die3.wav", "bullchicken/bc_idle1.wav", "bullchicken/bc_pain3.wav" }
static const pet_idle = 13
static const pet_run = 13
static const pet_die = 5
static const Float:pet_idle_speed = 0.3
static const Float:pet_run_speed = 10.0
static const Float:player_gravity = 0.65

// AT4
#define weapon_at4cs "weapon_m249"
#define CSW_AT4CS CSW_M249
#define TASK_CHECKRELOAD 111112
#define TASK_RELOAD 111113

new Float:g_lastfire[33], Float:g_lastaim[33], g_aiming[33],
g_smoke_id, g_spr_trail, g_spr_exp, is_reloading[33],
cvar_radius, cvar_maxdamage

new const AT4Model_V[] = "models/FurienShop/v_at4ex.mdl";
new const AT4Model_P[] = "models/FurienShop/p_at4ex.mdl";
new const AT4Model_W[] = "models/FurienShop/w_at4ex.mdl";
new const AT4Rocket[] = "models/FurienShop/s_rocket.mdl";

new const AT4Sound[][] = {
"weapons/at4-1.wav",
"weapons/at4_clipin1.wav",
"weapons/at4_clipin2.wav",
"weapons/at4_clipin3.wav",
"weapons/at4_draw.wav"
};

// Super Knifes
new SuperKnifeX2_Model[] = "models/FurienShop/v_superknife_x2.mdl";
new SuperKnifeX3_Model[] = "models/FurienShop/v_superknife_x3.mdl";
new SuperKnifeVIP_Model[] = "models/FurienShop/v_superknife_vip.mdl";

// Natives
native get_user_credits(id)
native set_user_credits(id, amount)

//Furien Detector
new DetectorSprite;
new PRIMARY_WEAPONS_BITSUM = (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);
new SECONDARY_WEAPONS_BITSUM = (1<<CSW_GLOCK18)|(1<<CSW_USP)|(1<<CSW_P228)|(1<<CSW_DEAGLE)|(1<<CSW_FIVESEVEN)|(1<<CSW_ELITE);

//Bools
new bool:HaveSuperKnifeX2[33], bool:HaveSuperKnifeX3[33], bool:HaveSuperKnifeVip[33], bool:HaveDetector[33], bool:HaveNoFlash[33], bool:HaveAT4[33]

//PET
new ItemPET[33], HavePET[33], PETAtSpawn[33]
new Float:item_leaptime[33]
new bool:g_has_speed[33]

new Prefix[] = "[FurienShop]";
new Menu;

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)

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

RegisterHam(Ham_Spawn, "player", "HAM_Spawn_Post");
RegisterHam(Ham_TakeDamage, "player", "HAM_TakeDamage");

register_event("CurWeapon", "EVENT_CurWeapon", "be", "1=1");
register_event("DeathMsg", "EVENT_Death", "a");
register_event("HLTV", "HLTV_EVENT_NewRound", "a", "1=0", "2=0");
register_message(get_user_msgid("ScreenFade"), "MSG_ScreenFade")

register_forward(FM_PlayerPreThink, "FWD_PreThink");
register_forward(FM_Think, "FWD_Think");

register_forward(FM_UpdateClientData, "AT4_UpdateClientData_POST", 1)
register_forward(FM_CmdStart, "AT4_CMDStart")
register_forward(FM_SetModel, "AT4_WorldModel")

register_think("at4ex_rocket", "AT4_Think")
register_touch("at4ex_rocket", "*", "AT4_Touch")

RegisterHam(Ham_Weapon_Reload, weapon_at4cs, "AT4_Reload")
RegisterHam(Ham_Item_AddToPlayer, weapon_at4cs, "AT4_AddToPlayer", 1)

cvar_radius = register_cvar("zp_at4cs_radius", "300.0")
cvar_maxdamage = register_cvar("zp_at4cs_maxdamage", "70.0")

register_clcmd("weapon_at4cs", "hook_weapon")
}

public plugin_precache() {
precache_model(SuperKnifeX2_Model);
precache_model(SuperKnifeX3_Model);
precache_model(SuperKnifeVIP_Model);
precache_model(AT4Model_V)
precache_model(AT4Model_P)
precache_model(AT4Model_W)
precache_model(AT4Rocket)
fm_precache_model(pet_model)

engfunc(EngFunc_PrecacheGeneric, "sprites/FurienShop/weapon_at4cs.txt")
engfunc(EngFunc_PrecacheGeneric, "sprites/FurienShop/at4cs.spr")

g_smoke_id = precache_model("sprites/FurienShop/rainsplash.spr")
g_spr_trail = precache_model("sprites/FurienShop/xbeam3.spr")
g_spr_exp = precache_model("sprites/FurienShop/zerogxplode.spr")
DetectorSprite = precache_model("sprites/FurienShop/Detector.spr")

new i;
for(i = 0; i < sizeof pet_sounds; i++)
fm_precache_sound(pet_sounds[i])

for(i = 0; i < sizeof(AT4Sound); i++)
engfunc(EngFunc_PrecacheSound, AT4Sound[i])


}

public plugin_natives() {
register_native("get_user_at4", "get_user_at4", 1)
register_native("set_user_at4", "set_user_at4", 1)
}

public HAM_Spawn_Post(id) {
if(is_user_connected(id)) {
HaveNoFlash[id] = false;
HaveDetector[id] = false;
HaveAT4[id] = false;
HaveSuperKnifeVip[id] = false;
set_user_at4(id, false)
drop_primary_weapons(id)
if(get_user_team(id) == 2) {
HaveSuperKnifeX2[id] = false;
HaveSuperKnifeX3[id] = false;
}
if(get_user_team(id) != 2) {
kill_pet(id)
HavePET[id] = 0
}
if(HavePET[id]) {
fm_set_user_gravity(id, player_gravity)
fm_set_user_health(id, get_user_health(id) + 250)
fm_set_user_armor(id, get_user_armor(id) + 350)
g_has_speed[id] = true
}
else if(PETAtSpawn[id]) {
create_pet(id)
PETAtSpawn[id] = 0
g_has_speed[id] = true
}
}
}

public HAM_TakeDamage(Victim, Inflictor, Attacker, Float:Damage) {
if(is_user_connected(Attacker)) {
if(get_user_weapon(Attacker) == CSW_KNIFE) {
if(HaveSuperKnifeX2[Attacker])
SetHamParamFloat(4, Damage * 2.0)
if(HaveSuperKnifeX3[Attacker])
SetHamParamFloat(4, Damage * 3.0)
if(HaveSuperKnifeVip[Attacker])
SetHamParamFloat(4, Damage * 3.0)
}
}
}

public EVENT_CurWeapon(id) {
if(get_user_weapon(id) == CSW_KNIFE) {
if(HaveSuperKnifeX2[id])
set_pev(id, pev_viewmodel2, SuperKnifeX2_Model)
if(HaveSuperKnifeX3[id])
set_pev(id, pev_viewmodel2, SuperKnifeX3_Model)
if(HaveSuperKnifeVip[id])
set_pev(id, pev_viewmodel2, SuperKnifeVIP_Model)
}
if(get_user_weapon(id) == CSW_AT4CS) {
if(HaveAT4[id]) {
set_pev(id, pev_viewmodel2, AT4Model_V)
set_pev(id, pev_weaponmodel2, AT4Model_P)
}
}
}

public HLTV_EVENT_NewRound() {
new entid = -1
while((entid = fm_find_ent_by_class(entid, "zp_bat"))) {
if(pev(entid,PET_FLAG) == PET_KILLED)
fm_remove_entity(entid)
}
remove_entity_name("at4ex_rocket")
}

public EVENT_Death() {
new Victim = read_data(2)
HaveSuperKnifeX2[Victim] = false;
HaveSuperKnifeX3[Victim] = false;

if(HavePET[Victim]) {
kill_pet(Victim)
HavePET[Victim] = 0
}

if(get_user_team(Victim) == 1)
HavePET[Victim] = 0
if(g_has_speed[Victim])
g_has_speed[Victim] = false
}

public MSG_ScreenFade(msgid, dest, id) {
if(HaveNoFlash[id]) {
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
}

public create_pet(id) {
if(!is_user_alive(id)) {
ColorChat(id, "!t%s!g PET-ul iti va aparea runda urmatoare !", Prefix)
PETAtSpawn[id] = 1
return PLUGIN_HANDLED
}
else {
ItemPET[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString,"info_target"))
set_pev(ItemPET[id],pev_classname,"zp_bat")

engfunc(EngFunc_SetModel,ItemPET[id],pet_model)

new Float:origin[3]
pev(id,pev_origin,origin)

set_pev(ItemPET[id],pev_origin,origin)
set_pev(ItemPET[id],pev_solid,SOLID_TRIGGER)
set_pev(ItemPET[id],pev_movetype,MOVETYPE_FLY)
set_pev(ItemPET[id],pev_owner,33)
set_pev(ItemPET[id],pev_nextthink,1.0)
set_pev(ItemPET[id],pev_sequence,0)
set_pev(ItemPET[id],pev_gaitsequence,0)
set_pev(ItemPET[id],pev_framerate,1.0)

set_pev(ItemPET[id], pev_renderfx, kRenderFxGlowShell)
set_pev(ItemPET[id], pev_rendercolor, Float:{0.0, 0.0, 200.0})

fm_set_user_gravity(id,player_gravity)

fm_set_user_health(id, get_user_health(id) + 250)
fm_set_user_armor(id, get_user_armor(id) + 350)

engfunc(EngFunc_EmitSound,ItemPET[id],CHAN_AUTO,pet_sounds[random_num(0,sizeof pet_sounds - 1)],1.0, 1.2, 0, PITCH_NORM)

HavePET[id] = 1
g_has_speed[id] = true
}
return PLUGIN_HANDLED
}

public kill_pet(id) {
if(pev_valid(ItemPET[id])) {
set_pev(ItemPET[id],pev_sequence,pet_die)
set_pev(ItemPET[id],pev_gaitsequence,pet_die)
set_pev(ItemPET[id],pev_framerate,1.0)

set_pev(ItemPET[id],PET_FLAG,PET_KILLED)

fm_drop_to_floor(ItemPET[id])

HavePET[id] = 0
g_has_speed[id] = false
}
ItemPET[id] = 0
}

public FWD_PreThink(id) {
if(is_user_connected(id) && is_user_alive(id)) {
if(get_user_team(id) == 2 && HaveDetector[id]) {
static Target, Body, Weapon;

get_user_aiming(id, Target, Body);
Weapon = get_user_weapon(id);

if((1<<Weapon) & PRIMARY_WEAPONS_BITSUM || (1<<Weapon) & SECONDARY_WEAPONS_BITSUM) {
static Origin[3];
get_user_origin(id, Origin, 3);

message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_BEAMENTPOINT);
write_short(id | 0x1000);
write_coord(Origin[0]);
write_coord(Origin[1]);
write_coord(Origin[2]);
write_short(DetectorSprite);
write_byte(0);
write_byte(10);
write_byte(1);
write_byte(5);
write_byte(0);
if(is_user_alive(Target) && get_user_team(Target) == 1) {
write_byte(150);
write_byte(0);
write_byte(0);
}
else {
write_byte(0);
write_byte(150);
write_byte(0);
}
write_byte(250);
write_byte(25);
message_end();
}
}
if(allowed_leap(id)) {
static Float:velocity[3]
velocity_by_aim(id, 500, velocity)
velocity[2] = 300.0
set_pev(id, pev_velocity, velocity)
item_leaptime[id] = get_gametime()
}
}
}

public FWD_Think(ent) {
for(new i = 0; i <= get_maxplayers(); i++) {
if(ent == ItemPET[i]) {
static Float:origin[3]
static Float:origin2[3]
static Float:velocity[3]
pev(ent,pev_origin,origin2)
get_offset_origin_body(i,Float:{50.0,0.0,0.0},orig in)

if(get_distance_f(origin,origin2) > 300.0)
set_pev(ent,pev_origin,origin)

else if(get_distance_f(origin,origin2) > 80.0) {
get_speed_vector(origin2,origin,250.0,velocity)
set_pev(ent,pev_velocity,velocity)
if(pev(ent,pev_sequence) != pet_run || pev(ent,pev_framerate) != pet_run_speed) {
set_pev(ent,pev_sequence,pet_run)
set_pev(ent,pev_gaitsequence,pet_run)
set_pev(ent,pev_framerate,pet_run_speed)
}
}

else if(get_distance_f(origin,origin2) < 75.0) {
if(pev(ent,pev_sequence) != pet_idle || pev(ent,pev_framerate) != pet_idle_speed) {
set_pev(ent,pev_sequence,pet_idle)
set_pev(ent,pev_gaitsequence,pet_idle)
set_pev(ent,pev_framerate,pet_idle_speed)
}
set_pev(ent,pev_velocity,Float:{0.0,0.0,0.0})
}
pev(i,pev_origin,origin)
origin[2] = origin2[2]
entity_set_aim(ent,origin)
set_pev(ent,pev_nextthink,1.0)
break
}
}
}

public allowed_leap(id) {
if(!HavePET[id])
return false

if(!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80)
return false

static buttons
buttons = pev(id, pev_button)

if(!is_user_bot(id) && (!(buttons & IN_JUMP) || !(buttons & IN_DUCK)))
return false

if(get_gametime() - item_leaptime[id] < 3)
return false

return true
}

public is_a_player(ent) {
if(ent > 0 && ent < 33)
return true

return false
}

public remove_pet(ent) {
if(pev_valid(ent))
fm_remove_entity(ent)
}

public CmdShop(id) {
if(!is_user_alive(id)) {
ColorChat(id, "!t%s!g Nu poti folosi shopul cat timp esti mort !", Prefix)
return;
}
switch(get_user_team(id)) {
case 1: FurienShop(id)
case 2: AntiFurienShop(id)
}
}

public FurienShop(id) {
if(is_user_alive(id) && get_user_team(id) == 1) {
new Title[128]
formatex(Title, sizeof(Title)-1, "\rCredite: \y%d\r^n\rFurien Shop:", get_user_credits(id))
Menu = menu_create(Title, "FurienHandler")

if(HaveSuperKnifeX2[id])
menu_additem(Menu, "\dSuper Knife [X2]\w - \rAi deja", "1", 0)
else {
if(get_user_credits(id) >= 10)
menu_additem(Menu, "\wSuper Knife\r [X2]\w - \r10 Credite", "1", 0)
else
menu_additem(Menu, "\dSuper Knife [X2]\w - \r10 Credite", "1", 0)
}

if(HaveSuperKnifeX3[id])
menu_additem(Menu, "\dSuper Knife [X3]\w - \rAi deja", "2", 0)
else {
if(get_user_credits(id) >= 20)
menu_additem(Menu, "\wSuper Knife\r [X3]\w - \r20 Credite", "2", 0)
else
menu_additem(Menu, "\dSuper Knife [X3]\w - \r20 Credite", "2", 0)
}

if(get_user_health(id) >= 250)
menu_additem(Menu, "\dHealth [+50]\w -\r Ai viata maxima", "3", 0)
else {
if(get_user_credits(id) >= 15)
menu_additem(Menu, "\wHealth \r[+50]\w - \r15 Credite", "3", 0)
else
menu_additem(Menu, "\dHealth [+50]\w - \r15 Credite", "3", 0)
}

if(get_user_armor(id) >= 250)
menu_additem(Menu, "\dArmor [+50]\w -\r Ai armura maxima", "4", 0)
else {
if(get_user_credits(id) >= 10)
menu_additem(Menu, "\wArmor \r[+50]\w - \r10 Credite", "4", 0)
else
menu_additem(Menu, "\dArmor [+50]\w - \r10 Credite", "4", 0)
}

if(HaveNoFlash[id])
menu_additem(Menu, "\dNo Flash\w - \rAi deja", "5", 0)
else {
if(get_user_credits(id) >= 5)
menu_additem(Menu, "\wNo Flash - \r5 Credite", "5", 0)
else
menu_additem(Menu, "\dNo Flash\w - \r5 Credite", "5", 0)
}

if(user_has_weapon(id, CSW_HEGRENADE))
menu_additem(Menu, "\dHe grenade\w - \rAi deja", "6", 0)
else {
if(get_user_credits(id) >= 25)
menu_additem(Menu, "\wHe grenade - \r25 Credite", "6", 0)
else
menu_additem(Menu, "\dHe grenade\w - \r25 Credite", "6", 0)
}

if(user_has_weapon(id, CSW_SMOKEGRENADE))
menu_additem(Menu, "\dFrost nade\w - \rAi deja", "7", 0)
else {
if(get_user_credits(id) >= 30)
menu_additem(Menu, "\wFrost nade - \r30 Credite", "7", 0)
else
menu_additem(Menu, "\dFrost nade\w - \r30 Credite", "7", 0)
}

if(get_user_flags(id) & VIP_LEVEL) {
if(HaveSuperKnifeVip[id])
menu_additem(Menu, "\dVip Pack\w - \rAi deja", "8", 0)
else {
if(get_user_credits(id) >= 100)
menu_additem(Menu, "\wVip Pack - \r100 Credite", "8", 0)
else
menu_additem(Menu, "\dVip Pack\w - \r100 Credite", "8", 0)
}
}
else
menu_additem(Menu, "\dVip Pack\w - \rDoar VIP", "8", 0)

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

public FurienHandler(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(HaveSuperKnifeX2[id]) {
ColorChat(id, "!t%s!g Ai deja!t SuperKnife [X2]!g !", Prefix);
return 1;
}
else {
new Credits = get_user_credits(id) - 10
if(Credits < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t SuperKnife [X2]!g !", Prefix);
return 1;
}
else {
HaveSuperKnifeX2[id] = true;
HaveSuperKnifeX3[id] = false;
HaveSuperKnifeVip[id] = false;
EVENT_CurWeapon(id);
set_user_credits(id, Credits);
ColorChat(id, "!t%s!g Ai cumparat!t SuperKnife [X2]!g !", Prefix);
}
}
}
case 2: {
if(HaveSuperKnifeX3[id]) {
ColorChat(id, "!t%s!g Ai deja!t SuperKnife [X3]!g !", Prefix);
return 1;
}
else {
new Credits = get_user_credits(id) - 20
if(Credits < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t SuperKnife [X3]!g !", Prefix);
return 1;
}
else {
HaveSuperKnifeX3[id] = true;
EVENT_CurWeapon(id);
set_user_credits(id, Credits);
ColorChat(id, "!t%s!g Ai cumparat!t SuperKnife [X3]!g !", Prefix);
}
}
}
case 3: {
if(get_user_health(id) >= 250) {
ColorChat(id, "!t%s!g Ai deja!t 250 health!g !", Prefix);
return 1;
}
else {
new Credits = get_user_credits(id) - 15
if(Credits < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t +50 Health!g !", Prefix);
return 1;
}
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)
set_user_credits(id, Credits)
ColorChat(id, "!t%s!g Ai cumparat!t +50 Health!g !", Prefix)
}
}
}
}
case 4: {
if(get_user_armor(id) >= 250) {
ColorChat(id, "!t%s!g Ai deja!t 250 armor!g !", Prefix);
return 1;
}
else {
new Credits = get_user_credits(id) - 10
if(Credits < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t +50 Armor!g !", Prefix);
return 1;
}
else {
if(get_user_armor(id) + 50 > 250)
fm_set_user_armor(id, 250);
else {
fm_set_user_armor(id, get_user_armor(id) + 50) ;
set_user_credits(id, Credits);
ColorChat(id, "!t%s!g Ai cumparat!t +50 Armor!g !", Prefix);
}
}
}
}
case 5: {
if(HaveNoFlash[id]) {
ColorChat(id, "!t%s!g Ai deja!t No Flash!g !", Prefix);
return 1;
}
else {
new Credits = get_user_credits(id) - 5
if(Credits < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t No Flash!g !", Prefix);
return 1;
}
else {
HaveNoFlash[id] = true;
set_user_credits(id, Credits);
ColorChat(id, "!t%s!g Ai cumparat!t No Flash!g !", Prefix);
}
}
}
case 6: {
if(user_has_weapon(id, CSW_HEGRENADE)) {
ColorChat(id, "!t%s!g Ai deja!t HE Grenade!g !", Prefix);
return 1;
}
else {
new Credits = get_user_credits(id) - 25
if(Credits < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t HE Grenade!g !", Prefix);
return 1;
}
else {
fm_give_item(id, "weapon_hegrenade");
set_user_credits(id, Credits);
ColorChat(id, "!t%s!g Ai cumparat!t HE Grenade!g !", Prefix);
}
}
}
case 7: {
if(user_has_weapon(id, CSW_SMOKEGRENADE)) {
ColorChat(id, "!t%s!g Ai deja!t Frost Nade!g !", Prefix);
return 1;
}
else {
new Credits = get_user_credits(id) - 30
if(Credits < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t Frost Nade!g !", Prefix);
return 1;
}
else {
fm_give_item(id, "weapon_smokegrenade");
set_user_credits(id, Credits);
ColorChat(id, "!t%s!g Ai cumparat!t Frost Nade!g !", Prefix);
}
}
}
case 8: {
if(get_user_flags(id) & VIP_LEVEL) {
if(HaveSuperKnifeVip[id]) {
ColorChat(id, "!t%s!g Ai deja!t VIP Pack!g !", Prefix);
return 1;
}
else {
new Credits = get_user_credits(id) - 100
if(Credits < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t VIP Pac!g !", Prefix);
return 1;
}
else {
HaveSuperKnifeVip[id] = true;
HaveSuperKnifeX2[id] = false;
HaveSuperKnifeX3[id] = false;
EVENT_CurWeapon(id);
fm_set_user_armor(id, 300);
fm_set_user_health(id, 300);
set_user_credits(id, Credits)
}
}
}
else {
ColorChat(id, "!t%s!g Acest item poate fi cumparat doar de catre!t membrii VIP!g !", Prefix);
return 1;
}
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}

public AntiFurienShop(id) {
if(is_user_alive(id) && get_user_team(id) == 2) {
new Title[128]
formatex(Title, sizeof(Title)-1, "\rCredite: \y%d\r^n\rAnti-Furien Shop:", get_user_credits(id))
Menu = menu_create(Title, "AntiFurienHandler")

if(HaveDetector[id])
menu_additem(Menu, "\dFurien Detector\w - \rAi deja", "1", 0)
else {
if(get_user_credits(id) >= 50)
menu_additem(Menu, "\wFurien Detector - \r50 Credite", "1", 0)
else
menu_additem(Menu, "\dFurien Detector\w - \r50 Credite", "1", 0)
}

if(cs_get_user_defuse(id))
menu_additem(Menu, "\dDefuse Kit\w - \rAi deja", "2", 0)
else {
if(get_user_credits(id) >= 2)
menu_additem(Menu, "\wDefuse Kit - \r2 Credite", "2", 0)
else
menu_additem(Menu, "\dDefuse Kit\w - \r2 Credite", "2", 0 )
}

if(get_user_health(id) >= 250)
menu_additem(Menu, "\dHealth [+50]\w -\r Ai viata maxima", "3", 0)
else {
if(get_user_credits(id) >= 15)
menu_additem(Menu, "\wHealth \r[+50]\w - \r15 Credite", "3", 0)
else
menu_additem(Menu, "\dHealth [+50]\w - \r15 Credite", "3", 0)
}

if(get_user_armor(id) >= 250)
menu_additem(Menu, "\dArmor [+50]\w -\r Ai armura maxima", "4", 0)
else {
if(get_user_credits(id) >= 10)
menu_additem(Menu, "\wArmor \r[+50]\w - \r10 Credite", "4", 0)
else
menu_additem(Menu, "\dArmor [+50]\w - \r10 Credite", "4", 0)
}

if(HaveNoFlash[id])
menu_additem(Menu, "\dNo Flash\w - \rAi deja", "5", 0)
else {
if(get_user_credits(id) >= 5)
menu_additem(Menu, "\wNo Flash - \r5 Credite", "5", 0)
else
menu_additem(Menu, "\dNo Flash\w - \r5 Credite", "5", 0)
}

if(user_has_weapon(id, CSW_SMOKEGRENADE))
menu_additem(Menu, "\dFrost nade\w - \rAi deja", "6", 0)
else {
if(get_user_credits(id) >= 30)
menu_additem(Menu, "\wFrost nade - \r30 Credite", "6", 0)
else
menu_additem(Menu, "\dFrost nade\w - \r30 Credite", "6", 0)
}

if(HavePET[id])
menu_additem(Menu, "\dPET\w - \rAi deja", "7", 0)
else {
if(get_user_credits(id) >= 30)
menu_additem(Menu, "\wPET - \r30 Credite", "7", 0)
else
menu_additem(Menu, "\dPET\w - \r30 Credite", "7", 0)
}

if(get_user_flags(id) & VIP_LEVEL) {
if(HaveAT4[id])
menu_additem(Menu, "\dBazooka\w - \rAi deja", "8", 0)
else {
if(get_user_credits(id) >= 100)
menu_additem(Menu, "\wBazooka - \r100 Credite", "8", 0)
else
menu_additem(Menu, "\dBazooka\w - \r100 Credite", "8", 0)
}
}
else
menu_additem(Menu, "\dBazooka\w - \rDoar VIP", "8", 0)

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

public AntiFurienHandler(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(HaveDetector[id]) {
ColorChat(id, "!t%s!g Ai deja!t Furien Detector!g !", Prefix);
return 1;
}
else {
new Credits = get_user_credits(id) - 50
if(Credits < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente !tcredite!g pentru cumpara!t Furien Detector!g !", Prefix);
return 1;
}
else {
HaveDetector[id] = true;
set_user_credits(id, Credits)
ColorChat(id, "!t%s!g Ai cumparat!t Furien Detector!g !", Prefix);
}
}
}
case 2: {
if(cs_get_user_defuse(id)) {
ColorChat(id, "!t%s!g Ai deja!t Defuse KIT!g !", Prefix);
return 1;
}
else {
new Credits = get_user_credits(id) - 2
if(Credits < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t Defuse KIT!g !", Prefix);
return 1;
}
else {
cs_set_user_defuse(id, 1)
set_user_credits(id, Credits)
ColorChat(id, "!t%s!g Ai cumparat!t Defuse KIT!g !", Prefix);
}
}
}
case 3: {
if(get_user_health(id) >= 250) {
ColorChat(id, "!t%s!g Ai deja!t 250 health!g !", Prefix);
return 1;
}
else {
new Credits = get_user_credits(id) - 15
if(Credits < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t +50 Health!g !", Prefix);
return 1;
}
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)
set_user_credits(id, Credits)
ColorChat(id, "!t%s!g Ai cumparat!t +50 Health!g !", Prefix)
}
}
}
}
case 4: {
if(get_user_armor(id) >= 250) {
ColorChat(id, "!t%s!g Ai deja!t 250 armor!g !", Prefix);
return 1;
}
else {
new Credits = get_user_credits(id) - 10
if(Credits < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t +50 Armor!g !", Prefix);
return 1;
}
else {
if(get_user_armor(id) + 50 > 250)
fm_set_user_armor(id, 250);
else {
fm_set_user_armor(id, get_user_armor(id) + 50) ;
set_user_credits(id, Credits);
ColorChat(id, "!t%s!g Ai cumparat!t +50 Armor!g !", Prefix);
}
}
}
}
case 5: {
if(HaveNoFlash[id]) {
ColorChat(id, "!t%s!g Ai deja!t No Flash!g !", Prefix);
return 1;
}
else {
new Credits = get_user_credits(id) - 5
if(Credits < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t No Flash!g !", Prefix);
return 1;
}
else {
HaveNoFlash[id] = true;
set_user_credits(id, Credits);
ColorChat(id, "!t%s!g Ai cumparat!t No Flash!g !", Prefix);
}
}
}
case 6: {
if(user_has_weapon(id, CSW_SMOKEGRENADE)) {
ColorChat(id, "!t%s!g Ai deja!t Frost Nade!g !", Prefix);
return 1;
}
else {
new Credits = get_user_credits(id) - 30
if(Credits < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t Frost Nade!g !", Prefix);
return 1;
}
else {
fm_give_item(id, "weapon_smokegrenade");
set_user_credits(id, Credits);
ColorChat(id, "!t%s!g Ai cumparat!t Frost Nade!g !", Prefix);
}
}
}
case 7: {
if(HavePET[id]) {
ColorChat(id, "!t%s!g Ai deja un!t PET!g !", Prefix);
return 1;
}
else {
new Credits = get_user_credits(id) - 30
if(Credits < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t PET", Prefix);
return 1;
}
else {
create_pet(id)
set_user_credits(id, Credits);
ColorChat(id, "!t%s!g Ai cumparat!t PET!g !", Prefix);
}
}
}
case 8: {
if(get_user_flags(id) & VIP_LEVEL) {
if(HaveAT4[id]) {
ColorChat(id, "!t%s!g Ai deja!t Bazooka!g !", Prefix);
return 1;
}
else {
new Credits = get_user_credits(id) - 100
if(Credits < 0) {
ColorChat(id, "!t%s!g Ai deja!t Bazooka!g !", Prefix)
return 1;
}
else {
set_user_at4(id, true)
set_user_credits(id, Credits);
ColorChat(id, "!t%s!g Ai cumparat!t Bazooka!g !", Prefix);
}
}
}
else {
ColorChat(id, "!t%s!g Acest item poate fi cumparat doar de catre!t membrii VIP!g !", Prefix);
return 1;
}
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}

public AT4_UpdateClientData_POST(id, sendweapons, cd_handle) {
if(is_user_connected(id) && is_user_alive(id)) {
if(get_user_weapon(id) == CSW_AT4CS && HaveAT4[id])
set_cd(cd_handle, CD_flNextAttack, halflife_time() + 0.001)
}
}

public AT4_AddToPlayer(ent, id) {
if(!is_valid_ent(ent) || !is_user_alive(id))
return HAM_IGNORED

if(entity_get_int(ent, EV_INT_impulse) == 61296) {
HaveAT4[id] = true
entity_set_int(id, EV_INT_impulse, 0)

return HAM_HANDLED
}

if(HaveAT4[id]) {
message_begin(MSG_ONE, get_user_msgid("WeaponList"), _, id)
write_string("weapon_at4cs"); // WeaponName
write_byte(3) // PrimaryAmmoID
write_byte(1) // PrimaryAmmoMaxAmount
write_byte(-1) // SecondaryAmmoID
write_byte(-1) // SecondaryAmmoMaxAmount
write_byte(0) // SlotID (0...N)
write_byte(4) // NumberInSlot (1...N)
write_byte(CSW_AT4CS) // WeaponID
write_byte(0) // Flags
message_end()
}
return HAM_HANDLED
}

public AT4_CMDStart(id, uc_handle, seed) {
if(is_user_connected(id) && is_user_alive(id)) {
if(get_user_weapon(id) == CSW_AT4CS && HaveAT4[id]) {
static CurButton
CurButton = get_uc(uc_handle, UC_Buttons)
if(CurButton & IN_ATTACK) {
static Float:CurTime
CurTime = get_gametime()

static at4cs
at4cs = fm_find_ent_by_owner(-1, weapon_at4cs, id)

if(cs_get_weapon_ammo(at4cs) > 0 && !is_reloading[id]) {
if(CurTime - 4.5 > g_lastfire[id]) {
set_weapon_anim(id, 1)
emit_sound(id, CHAN_WEAPON, AT4Sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)

create_rocket(id)

static Float:Punch_Angles[3]

Punch_Angles[0] = -20.0
Punch_Angles[1] = 0.0
Punch_Angles[2] = 0.0

set_pev(id, pev_punchangle, Punch_Angles)
cs_set_weapon_ammo(at4cs, cs_get_weapon_ammo(at4cs) - 1)

if(cs_get_weapon_ammo(at4cs) <= 0 && !is_reloading[id]) {
if(cs_get_user_bpammo(id, CSW_AT4CS) > 0) {
set_task(1.0, "at4cs_reload", id)
}
}
if(cs_get_user_zoom(id))
cs_set_user_zoom(id, CS_RESET_ZOOM, 1)

g_lastfire[id] = CurTime
}
}
else {
if(!is_reloading[id]) {
if(cs_get_user_bpammo(id, CSW_AT4CS) > 0) {
if(CurTime - 1.0 > g_lastfire[id]) {
at4cs_reload(id)
g_lastfire[id] = CurTime
}
}
}
}
}
if(CurButton & IN_ATTACK2) {
static Float:CurTime
CurTime = get_gametime()

if((CurTime - 0.5 > g_lastaim[id]) && !is_reloading[id]) {
if(!g_aiming[id]) {
cs_set_user_zoom(id, CS_SET_FIRST_ZOOM, 1)
g_aiming[id] = 1
}
else {
cs_set_user_zoom(id, CS_RESET_ZOOM, 1)
g_aiming[id] = 0
}
g_lastaim[id] = CurTime
}
}

CurButton &= ~IN_ATTACK
set_uc(uc_handle, UC_Buttons, CurButton)

CurButton &= ~IN_RELOAD
set_uc(uc_handle, UC_Buttons, CurButton)
}
}

return FMRES_HANDLED
}

public AT4_WorldModel(ent, const model[]) {
if(!is_valid_ent(ent))
return FMRES_IGNORED

static szClassName[33]
entity_get_string(ent, EV_SZ_classname, szClassName, charsmax(szClassName))

if(!equal(szClassName, "weaponbox"))
return FMRES_IGNORED

static iOwner
iOwner = entity_get_edict(ent, EV_ENT_owner)

if(equal(model, "models/w_m249.mdl")) {
static at4cs
at4cs = find_ent_by_owner(-1, "weapon_m249", ent)

if(!is_valid_ent(at4cs))
return FMRES_IGNORED;

if(HaveAT4[iOwner]) {
entity_set_int(at4cs, EV_INT_impulse, 61296)
HaveAT4[iOwner] = false;
entity_set_model(ent, AT4Model_W)

return FMRES_SUPERCEDE
}
}
return FMRES_IGNORED
}

public at4cs_reload(id) {
if(is_reloading[id])
return

is_reloading[id] = 1
set_weapon_anim(id, 3)

set_task(0.1, "checking_reload", id+TASK_CHECKRELOAD, _, _, "b")
set_task(4.0, "reload_complete", id+TASK_RELOAD)
}

public checking_reload(id) {
id -= TASK_CHECKRELOAD

if(cs_get_user_zoom(id))
cs_set_user_zoom(id, CS_RESET_ZOOM, 1)

if(get_user_weapon(id) != CSW_AT4CS || !HaveAT4[id]) {
remove_task(id+TASK_CHECKRELOAD)
remove_task(id+TASK_RELOAD)

is_reloading[id] = 0
}
}

public reload_complete(id) {
id -= TASK_RELOAD

if(!is_reloading[id])
return

remove_task(id+TASK_CHECKRELOAD)

static at4cs
at4cs = fm_find_ent_by_owner(-1, weapon_at4cs, id)

cs_set_weapon_ammo(at4cs, 1)
cs_set_user_bpammo(id, CSW_AT4CS, cs_get_user_bpammo(id, CSW_AT4CS) - 1)
is_reloading[id] = 0
}

public AT4_Reload(ent) {
static id
id = pev(ent, pev_owner)

if(is_user_connected(id) && is_user_alive(id)) {
if(get_user_weapon(id) == CSW_AT4CS && HaveAT4[id]) {

static Float:CurTime
CurTime = get_gametime()

if(!is_reloading[id]) {
if(cs_get_user_bpammo(id, CSW_AT4CS) > 0) {
if(CurTime - 1.0 > g_lastfire[id]) {
at4cs_reload(id)
g_lastfire[id] = CurTime
}
}
}
}
}
return HAM_SUPERCEDE
}

public AT4_Think(ent) {
if(!pev_valid(ent))
return

static Float:Origin[3]
pev(ent, pev_origin, Origin)

message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_SPRITE)
engfunc(EngFunc_WriteCoord, Origin[0])
engfunc(EngFunc_WriteCoord, Origin[1])
engfunc(EngFunc_WriteCoord, Origin[2])
write_short(g_smoke_id)
write_byte(2)
write_byte(200)
message_end()

if(pev(ent, pev_iuser4) == 0) {
static Victim
Victim = FindClosesEnemy(ent)

if(is_user_alive(Victim)) {
set_pev(ent, pev_iuser4, Victim)
}
}
else {
static Victim
Victim = pev(ent, pev_iuser4)

if(is_user_alive(Victim)) {
static Float:VicOrigin[3]
pev(Victim, pev_origin, VicOrigin)

turn_to_target(ent, Origin, Victim, VicOrigin)
hook_ent(ent, Victim, 500.0)
}
else {
set_pev(ent, pev_iuser4, 0)
}
}
set_pev(ent, pev_nextthink, halflife_time() + 0.075)
}

public AT4_Touch(rocket, touch) {
if(!pev_valid(rocket))
return

if(is_user_alive(touch) && pev(rocket, pev_owner) == touch)
return

static Float:Origin[3]
pev(rocket, pev_origin, Origin)

message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
write_byte(TE_EXPLOSION)
engfunc(EngFunc_WriteCoord, Origin[0])
engfunc(EngFunc_WriteCoord, Origin[1])
engfunc(EngFunc_WriteCoord, Origin[2])
write_short(g_spr_exp) // sprite index
write_byte(20) // scale in 0.1's
write_byte(30) // framerate
write_byte(0) // flags
message_end()

static owner, iVictim

iVictim = -1
owner = pev(rocket, pev_owner)

while((iVictim = find_ent_in_sphere(iVictim, Origin, get_pcvar_float(cvar_radius))) != 0) {
if((0 < iVictim < 32) && is_user_alive(iVictim) && iVictim != owner) {
new Float:MaxDamage, Float:Damage

MaxDamage = get_pcvar_float(cvar_maxdamage)
Damage = random_float(MaxDamage - random_float(0.0, 100.0), MaxDamage + random_float(0.0, 100.0))

ExecuteHam(Ham_TakeDamage, iVictim, 0, owner, 0, DMG_BULLET)

static health
health = get_user_health(iVictim)

if(health - Damage >= 1) {
fm_set_user_health(iVictim, health - floatround(Damage))
}
else {
death_message(owner, iVictim, 1)
}
}
}
engfunc(EngFunc_RemoveEntity, rocket)
}

public create_rocket(id) {
new ent, Float:Origin[3], Float:Angles[3], Float:Velocity[3]

ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
engfunc(EngFunc_GetAttachment, id, 0, Origin, Angles)
pev(id, pev_angles, Angles)

set_pev(ent, pev_origin, Origin)
set_pev(ent, pev_angles, Angles)
set_pev(ent, pev_solid, 2)
set_pev(ent, pev_movetype, 5)
set_pev(ent, pev_classname, "at4ex_rocket")
set_pev(ent, pev_owner, id)
engfunc(EngFunc_SetModel, ent, AT4Rocket)

set_pev(ent, pev_mins, {-1.0, -1.0, -1.0})
set_pev(ent, pev_maxs, {1.0, 1.0, 1.0})

velocity_by_aim(id, 1750, Velocity)
set_pev(ent, pev_velocity, Velocity)

message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW) // TE id
write_short(ent) // entity:attachment to follow
write_short(g_spr_trail) // sprite index
write_byte(25) // life in 0.1's
write_byte(2) // line width in 0.1's
write_byte(255) // r
write_byte(255) // g
write_byte(255) // b
write_byte(200) // brightness
message_end()

set_pev(ent, pev_iuser4, 0)
set_pev(ent, pev_nextthink, halflife_time() + 0.1)
}

public hook_weapon(id) {
engclient_cmd(id, weapon_at4cs)
}

public get_user_at4(id) {
return HaveAT4[id];
}

public set_user_at4(id, at4) {
if(at4) {
if(!HaveAT4[id]) {
drop_primary_weapons(id);
HaveAT4[id] = true;
is_reloading[id] = 0
g_aiming[id] = 0
fm_give_item(id, weapon_at4cs);
new Clip = fm_get_user_weapon_entity(id, CSW_AT4CS);
cs_set_weapon_ammo(Clip, 1);
cs_set_user_bpammo(id, CSW_AT4CS, 50)
}
}
else {
if(HaveAT4[id]) {
HaveAT4[id] = false;
}
}
}

//-------------------------------------------------------------------------//
//=============================| Stocks |=================================//
//-----------------------------------------------------------------------//
stock get_offset_origin_body(ent,const Float:offset[3],Float:origin[3]) {
if(!pev_valid(ent))
return 0;

new Float:angle[3]
pev(ent,pev_angles,angle)

pev(ent,pev_origin,origin)

origin[0] += floatcos(angle[1],degrees) * offset[0]
origin[1] += floatsin(angle[1],degrees) * offset[0]

origin[1] += floatcos(angle[1],degrees) * offset[1]
origin[0] += floatsin(angle[1],degrees) * offset[1]

return 1;
}

stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speed, Float:new_velocity[3]) {
new_velocity[0] = origin2[0] - origin1[0]
new_velocity[1] = origin2[1] - origin1[1]
new_velocity[2] = origin2[2] - origin1[2]
new Float:num = floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
new_velocity[0] *= num
new_velocity[1] *= num
new_velocity[2] *= num

return 1;
}

stock entity_set_aim(ent,const Float:origin2[3],bone=0) {
if(!pev_valid(ent))
return 0;

static Float:origin[3]
origin[0] = origin2[0]
origin[1] = origin2[1]
origin[2] = origin2[2]

static Float:ent_origin[3], Float:angles[3]

if(bone)
engfunc(EngFunc_GetBonePosition,ent,bone,ent_origi n,angles)
else
pev(ent,pev_origin,ent_origin)

origin[0] -= ent_origin[0]
origin[1] -= ent_origin[1]
origin[2] -= ent_origin[2]

static Float:v_length
v_length = vector_length(origin)

static Float:aim_vector[3]
aim_vector[0] = origin[0] / v_length
aim_vector[1] = origin[1] / v_length
aim_vector[2] = origin[2] / v_length

static Float:new_angles[3]
vector_to_angle(aim_vector,new_angles)

new_angles[0] *= -1

if(new_angles[1]>180.0) new_angles[1] -= 360
if(new_angles[1]<-180.0) new_angles[1] += 360
if(new_angles[1]==180.0 || new_angles[1]==-180.0) new_angles[1]=-179.999999

set_pev(ent,pev_angles,new_angles)
set_pev(ent,pev_fixangle,1)

return 1;
}


stock set_weapon_anim(id, anim) {
set_pev(id, pev_weaponanim, anim)

message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, _, id)
write_byte(anim)
write_byte(pev(id,pev_body))
message_end()
}

stock death_message(Killer, Victim, ScoreBoard) {
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)
ExecuteHamB(Ham_Killed, Victim, Killer, 2)
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)

make_deathmsg(Killer, Victim, 0, "")

if (ScoreBoard) {
message_begin(MSG_BROADCAST, get_user_msgid("ScoreInfo"))
write_byte(Killer) // id
write_short(pev(Killer, pev_frags)) // frags
write_short(cs_get_user_deaths(Killer)) // deaths
write_short(0) // class?
write_short(get_user_team(Killer)) // team
message_end()

message_begin(MSG_BROADCAST, get_user_msgid("ScoreInfo"))
write_byte(Victim) // id
write_short(pev(Victim, pev_frags)) // frags
write_short(cs_get_user_deaths(Victim)) // deaths
write_short(0) // class?
write_short(get_user_team(Victim)) // team
message_end()
}
}

stock FindClosesEnemy(entid) {
new Float:Dist
new Float:maxdistance = 300.0
new indexid = 0

for(new i = 1; i <= get_maxplayers(); i++){
if(is_user_alive(i) && is_valid_ent(i) && can_see_fm(entid, i)
&& pev(entid, pev_owner) != i && cs_get_user_team(pev(entid, pev_owner)) != cs_get_user_team(i)) {
Dist = entity_range(entid, i)
if(Dist <= maxdistance) {
maxdistance = Dist
indexid = i

return indexid
}
}
}
return 0
}

stock bool:can_see_fm(entindex1, entindex2) {
if (!entindex1 || !entindex2)
return false

if (pev_valid(entindex1) && pev_valid(entindex1)) {
new flags = pev(entindex1, pev_flags)
if (flags & EF_NODRAW || flags & FL_NOTARGET)
return false

new Float:lookerOrig[3]
new Float:targetBaseOrig[3]
new Float:targetOrig[3]
new Float:temp[3]

pev(entindex1, pev_origin, lookerOrig)
pev(entindex1, pev_view_ofs, temp)
lookerOrig[0] += temp[0]
lookerOrig[1] += temp[1]
lookerOrig[2] += temp[2]

pev(entindex2, pev_origin, targetBaseOrig)
pev(entindex2, pev_view_ofs, temp)
targetOrig[0] = targetBaseOrig [0] + temp[0]
targetOrig[1] = targetBaseOrig [1] + temp[1]
targetOrig[2] = targetBaseOrig [2] + temp[2]

engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) // checks the had of seen player
if (get_tr2(0, TraceResult:TR_InOpen) && get_tr2(0, TraceResult:TR_InWater)) {
return false
}
else {
new Float:flFraction
get_tr2(0, TraceResult:TR_flFraction, flFraction)
if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2)) {
return true
}
else {
targetOrig[0] = targetBaseOrig [0]
targetOrig[1] = targetBaseOrig [1]
targetOrig[2] = targetBaseOrig [2]
engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) // checks the body of seen player
get_tr2(0, TraceResult:TR_flFraction, flFraction)
if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2)) {
return true
}
else {
targetOrig[0] = targetBaseOrig [0]
targetOrig[1] = targetBaseOrig [1]
targetOrig[2] = targetBaseOrig [2] - 17.0
engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) // checks the legs of seen player
get_tr2(0, TraceResult:TR_flFraction, flFraction)
if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2)) {
return true
}
}
}
}
}
return false
}

stock turn_to_target(ent, Float:Ent_Origin[3], target, Float:Vic_Origin[3]) {
if(target) {
new Float:newAngle[3]
entity_get_vector(ent, EV_VEC_angles, newAngle)
new Float:x = Vic_Origin[0] - Ent_Origin[0]
new Float:z = Vic_Origin[1] - Ent_Origin[1]

new Float:radians = floatatan(z/x, radian)
newAngle[1] = radians * (180 / 3.14)
if (Vic_Origin[0] < Ent_Origin[0])
newAngle[1] -= 180.0

entity_set_vector(ent, EV_VEC_angles, newAngle)
}
}

stock hook_ent(ent, victim, Float:speed) {
static Float:fl_Velocity[3]
static Float:VicOrigin[3], Float:EntOrigin[3]

pev(ent, pev_origin, EntOrigin)
pev(victim, pev_origin, VicOrigin)

static Float:distance_f
distance_f = get_distance_f(EntOrigin, VicOrigin)

if (distance_f > 10.0) {
new Float:fl_Time = distance_f / speed

fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
}
else {
fl_Velocity[0] = 0.0
fl_Velocity[1] = 0.0
fl_Velocity[2] = 0.0
}

entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
}

stock drop_primary_weapons(Player) {
static weapons[32], num, i, weaponid;
num = 0;
get_user_weapons(Player, weapons, num);

for(i = 0; i < num; i++) {
weaponid = weapons [i];

if(((1<<weaponid) & PRIMARY_WEAPONS_BITSUM)) {
static wname[32];
get_weaponname(weaponid, wname, charsmax(wname));

engclient_cmd(Player, "drop", wname);
}
}
}

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();
}
}
}
}

Sa nu va insele titlul ,am dat edit sa nu mai fac alt topic degeaba pt. ca am facut rost de acel plugin pt. lider
Alte mentiuni : sa-mi scoateti sk 3x dmg , he-ul ia prea mult dmg :( (poate puteti rezolva si asta ,daca nu nu-i nimic)
No flashu vreau sa-mi ramana pana mor !

Preturi:
T=
sk -14000
no flash-3000
hp-3000 (+40 hp)
ap-3000 (+40- ap)
he-6000 (1he)
frost nade -4000 (1 buc.)
vip pack-10000

CT=
Furien detector- 8000
defuse kit- 500
hp-la fel ca la furien
ap-la fel ca la furien
no flash- la fel
frost nade- 3000
pet- 10000
bazooka-14000

Baftă Tiger ;)

Tiger
29-08-2014, 07:41 PM
Done. Testeaza-l ca nu l-am testat.


#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <engine>
#include <fun>

#define PLUGIN "Furien Shop"
#define VERSION "2.0"
#define AUTHOR "DaNNe."

#define VIP_LEVEL ADMIN_LEVEL_H

// Pet
#define fm_precache_model(%1) engfunc(EngFunc_PrecacheModel,%1)
#define fm_precache_sound(%1) engfunc(EngFunc_PrecacheSound,%1)
#define fm_remove_entity(%1) engfunc(EngFunc_RemoveEntity, %1)
//#define fm_drop_to_floor(%1) engfunc(EngFunc_DropToFloor,%1)
#define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
#define fm_set_user_gravity(%1,%2) set_pev(%1,pev_gravity,%2)

#define PET_FLAG pev_flTimeStepSound
#define PET_KILLED 389

static const pet_model[] = "models/stukabat.mdl"
static const pet_sounds[][] = { "bullchicken/bc_die1.wav", "bullchicken/bc_die2.wav", "bullchicken/bc_die3.wav", "bullchicken/bc_idle1.wav", "bullchicken/bc_pain3.wav" }
static const pet_idle = 13
static const pet_run = 13
static const pet_die = 5
static const Float:pet_idle_speed = 0.3
static const Float:pet_run_speed = 10.0
static const Float:player_gravity = 0.65

// AT4
#define weapon_at4cs "weapon_m249"
#define CSW_AT4CS CSW_M249
#define TASK_CHECKRELOAD 111112
#define TASK_RELOAD 111113

new Float:g_lastfire[33], Float:g_lastaim[33], g_aiming[33],
g_smoke_id, g_spr_trail, g_spr_exp, is_reloading[33],
cvar_radius, cvar_maxdamage

new const AT4Model_V[] = "models/FurienShop/v_at4ex.mdl";
new const AT4Model_P[] = "models/FurienShop/p_at4ex.mdl";
new const AT4Model_W[] = "models/FurienShop/w_at4ex.mdl";
new const AT4Rocket[] = "models/FurienShop/s_rocket.mdl";

new const AT4Sound[][] = {
"weapons/at4-1.wav",
"weapons/at4_clipin1.wav",
"weapons/at4_clipin2.wav",
"weapons/at4_clipin3.wav",
"weapons/at4_draw.wav"
};

// Super Knifes
new SuperKnifeX2_Model[] = "models/FurienShop/v_superknife_x2.mdl";
new SuperKnifeX3_Model[] = "models/FurienShop/v_superknife_x3.mdl";
new SuperKnifeVIP_Model[] = "models/FurienShop/v_superknife_vip.mdl";

//Furien Detector
new DetectorSprite;
new PRIMARY_WEAPONS_BITSUM = (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);
new SECONDARY_WEAPONS_BITSUM = (1<<CSW_GLOCK18)|(1<<CSW_USP)|(1<<CSW_P228)|(1<<CSW_DEAGLE)|(1<<CSW_FIVESEVEN)|(1<<CSW_ELITE);

//Bools
new bool:HaveSuperKnifeX2[33], bool:HaveSuperKnifeVip[33], bool:HaveDetector[33], bool:HaveNoFlash[33], bool:HaveAT4[33]

//PET
new ItemPET[33], HavePET[33], PETAtSpawn[33]
new Float:item_leaptime[33]
new bool:g_has_speed[33]

new Prefix[] = "[FurienShop]";
new Menu;

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)

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

RegisterHam(Ham_Spawn, "player", "HAM_Spawn_Post");
RegisterHam(Ham_TakeDamage, "player", "HAM_TakeDamage");

register_event("CurWeapon", "EVENT_CurWeapon", "be", "1=1");
register_event("DeathMsg", "EVENT_Death", "a");
register_event("HLTV", "HLTV_EVENT_NewRound", "a", "1=0", "2=0");
register_message(get_user_msgid("ScreenFade"), "MSG_ScreenFade")

register_forward(FM_PlayerPreThink, "FWD_PreThink");
register_forward(FM_Think, "FWD_Think");

register_forward(FM_UpdateClientData, "AT4_UpdateClientData_POST", 1)
register_forward(FM_CmdStart, "AT4_CMDStart")
register_forward(FM_SetModel, "AT4_WorldModel")

register_think("at4ex_rocket", "AT4_Think")
register_touch("at4ex_rocket", "*", "AT4_Touch")

RegisterHam(Ham_Weapon_Reload, weapon_at4cs, "AT4_Reload")
RegisterHam(Ham_Item_AddToPlayer, weapon_at4cs, "AT4_AddToPlayer", 1)

cvar_radius = register_cvar("zp_at4cs_radius", "300.0")
cvar_maxdamage = register_cvar("zp_at4cs_maxdamage", "70.0")

register_clcmd("weapon_at4cs", "hook_weapon")
}

public plugin_precache() {
precache_model(SuperKnifeX2_Model);
precache_model(SuperKnifeX3_Model);
precache_model(SuperKnifeVIP_Model);
precache_model(AT4Model_V)
precache_model(AT4Model_P)
precache_model(AT4Model_W)
precache_model(AT4Rocket)
fm_precache_model(pet_model)

engfunc(EngFunc_PrecacheGeneric, "sprites/FurienShop/weapon_at4cs.txt")
engfunc(EngFunc_PrecacheGeneric, "sprites/FurienShop/at4cs.spr")

g_smoke_id = precache_model("sprites/FurienShop/rainsplash.spr")
g_spr_trail = precache_model("sprites/FurienShop/xbeam3.spr")
g_spr_exp = precache_model("sprites/FurienShop/zerogxplode.spr")
DetectorSprite = precache_model("sprites/FurienShop/Detector.spr")

new i;
for(i = 0; i < sizeof pet_sounds; i++)
fm_precache_sound(pet_sounds[i])

for(i = 0; i < sizeof(AT4Sound); i++)
engfunc(EngFunc_PrecacheSound, AT4Sound[i])


}

public plugin_natives() {
register_native("get_user_at4", "get_user_at4", 1)
register_native("set_user_at4", "set_user_at4", 1)
}

public HAM_Spawn_Post(id) {
if(is_user_alive(id)) {
HaveDetector[id] = false;
HaveAT4[id] = false;
HaveSuperKnifeVip[id] = false;
set_user_at4(id, false)
drop_primary_weapons(id)
if(get_user_team(id) == 2) {
HaveSuperKnifeX2[id] = false;
}
if(get_user_team(id) != 2) {
kill_pet(id)
HavePET[id] = 0
}
if(HavePET[id]) {
fm_set_user_gravity(id, player_gravity)
fm_set_user_health(id, get_user_health(id) + 250)
fm_set_user_armor(id, get_user_armor(id) + 350)
g_has_speed[id] = true
}
else if(PETAtSpawn[id]) {
create_pet(id)
PETAtSpawn[id] = 0
g_has_speed[id] = true
}
}
}

public HAM_TakeDamage(Victim, Inflictor, Attacker, Float:Damage) {
if(is_user_connected(Attacker)) {
if(get_user_weapon(Attacker) == CSW_KNIFE) {
if(HaveSuperKnifeX2[Attacker])
SetHamParamFloat(4, Damage * 2.0)
if(HaveSuperKnifeVip[Attacker])
SetHamParamFloat(4, Damage * 3.0)
}
}
}

public EVENT_CurWeapon(id) {
if(get_user_weapon(id) == CSW_KNIFE) {
if(HaveSuperKnifeX2[id])
set_pev(id, pev_viewmodel2, SuperKnifeX2_Model)
if(HaveSuperKnifeVip[id])
set_pev(id, pev_viewmodel2, SuperKnifeVIP_Model)
}
if(get_user_weapon(id) == CSW_AT4CS) {
if(HaveAT4[id]) {
set_pev(id, pev_viewmodel2, AT4Model_V)
set_pev(id, pev_weaponmodel2, AT4Model_P)
}
}
}

public HLTV_EVENT_NewRound() {
new entid = -1
while((entid = fm_find_ent_by_class(entid, "zp_bat"))) {
if(pev(entid,PET_FLAG) == PET_KILLED)
fm_remove_entity(entid)
}
remove_entity_name("at4ex_rocket")
}

public EVENT_Death() {
new Victim = read_data(2)
HaveSuperKnifeX2[Victim] = false;
HaveNoFlash[Victim] = false;


if(HavePET[Victim]) {
kill_pet(Victim)
HavePET[Victim] = 0
}

if(get_user_team(Victim) == 1)
HavePET[Victim] = 0
if(g_has_speed[Victim])
g_has_speed[Victim] = false
}

public MSG_ScreenFade(msgid, dest, id) {
if(HaveNoFlash[id]) {
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
}

public create_pet(id) {
if(!is_user_alive(id)) {
ColorChat(id, "!t%s!g PET-ul iti va aparea runda urmatoare !", Prefix)
PETAtSpawn[id] = 1
return PLUGIN_HANDLED
}
else {
ItemPET[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString,"info_target"))
set_pev(ItemPET[id],pev_classname,"zp_bat")

engfunc(EngFunc_SetModel,ItemPET[id],pet_model)

new Float:origin[3]
pev(id,pev_origin,origin)

set_pev(ItemPET[id],pev_origin,origin)
set_pev(ItemPET[id],pev_solid,SOLID_TRIGGER)
set_pev(ItemPET[id],pev_movetype,MOVETYPE_FLY)
set_pev(ItemPET[id],pev_owner,33)
set_pev(ItemPET[id],pev_nextthink,1.0)
set_pev(ItemPET[id],pev_sequence,0)
set_pev(ItemPET[id],pev_gaitsequence,0)
set_pev(ItemPET[id],pev_framerate,1.0)

set_pev(ItemPET[id], pev_renderfx, kRenderFxGlowShell)
set_pev(ItemPET[id], pev_rendercolor, Float:{0.0, 0.0, 200.0})

fm_set_user_gravity(id,player_gravity)

fm_set_user_health(id, get_user_health(id) + 250)
fm_set_user_armor(id, get_user_armor(id) + 350)

engfunc(EngFunc_EmitSound,ItemPET[id],CHAN_AUTO,pet_sounds[random_num(0,sizeof pet_sounds - 1)],1.0, 1.2, 0, PITCH_NORM)

HavePET[id] = 1
g_has_speed[id] = true
}
return PLUGIN_HANDLED
}

public kill_pet(id) {
if(pev_valid(ItemPET[id])) {
set_pev(ItemPET[id],pev_sequence,pet_die)
set_pev(ItemPET[id],pev_gaitsequence,pet_die)
set_pev(ItemPET[id],pev_framerate,1.0)

set_pev(ItemPET[id],PET_FLAG,PET_KILLED)

fm_drop_to_floor(ItemPET[id])

HavePET[id] = 0
g_has_speed[id] = false
}
ItemPET[id] = 0
}

public FWD_PreThink(id) {
if(is_user_connected(id) && is_user_alive(id)) {
if(get_user_team(id) == 2 && HaveDetector[id]) {
static Target, Body, Weapon;

get_user_aiming(id, Target, Body);
Weapon = get_user_weapon(id);

if((1<<Weapon) & PRIMARY_WEAPONS_BITSUM || (1<<Weapon) & SECONDARY_WEAPONS_BITSUM) {
static Origin[3];
get_user_origin(id, Origin, 3);

message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_BEAMENTPOINT);
write_short(id | 0x1000);
write_coord(Origin[0]);
write_coord(Origin[1]);
write_coord(Origin[2]);
write_short(DetectorSprite);
write_byte(0);
write_byte(10);
write_byte(1);
write_byte(5);
write_byte(0);
if(is_user_alive(Target) && get_user_team(Target) == 1) {
write_byte(150);
write_byte(0);
write_byte(0);
}
else {
write_byte(0);
write_byte(150);
write_byte(0);
}
write_byte(250);
write_byte(25);
message_end();
}
}
if(allowed_leap(id)) {
static Float:velocity[3]
velocity_by_aim(id, 500, velocity)
velocity[2] = 300.0
set_pev(id, pev_velocity, velocity)
item_leaptime[id] = get_gametime()
}
}
}

public FWD_Think(ent) {
for(new i = 0; i <= get_maxplayers(); i++) {
if(ent == ItemPET[i]) {
static Float:origin[3]
static Float:origin2[3]
static Float:velocity[3]
pev(ent,pev_origin,origin2)
get_offset_origin_body(i,Float:{50.0,0.0,0.0},orig in)

if(get_distance_f(origin,origin2) > 300.0)
set_pev(ent,pev_origin,origin)

else if(get_distance_f(origin,origin2) > 80.0) {
get_speed_vector(origin2,origin,250.0,velocity)
set_pev(ent,pev_velocity,velocity)
if(pev(ent,pev_sequence) != pet_run || pev(ent,pev_framerate) != pet_run_speed) {
set_pev(ent,pev_sequence,pet_run)
set_pev(ent,pev_gaitsequence,pet_run)
set_pev(ent,pev_framerate,pet_run_speed)
}
}

else if(get_distance_f(origin,origin2) < 75.0) {
if(pev(ent,pev_sequence) != pet_idle || pev(ent,pev_framerate) != pet_idle_speed) {
set_pev(ent,pev_sequence,pet_idle)
set_pev(ent,pev_gaitsequence,pet_idle)
set_pev(ent,pev_framerate,pet_idle_speed)
}
set_pev(ent,pev_velocity,Float:{0.0,0.0,0.0})
}
pev(i,pev_origin,origin)
origin[2] = origin2[2]
entity_set_aim(ent,origin)
set_pev(ent,pev_nextthink,1.0)
break
}
}
}

public allowed_leap(id) {
if(!HavePET[id])
return false

if(!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80)
return false

static buttons
buttons = pev(id, pev_button)

if(!is_user_bot(id) && (!(buttons & IN_JUMP) || !(buttons & IN_DUCK)))
return false

if(get_gametime() - item_leaptime[id] < 3)
return false

return true
}

public is_a_player(ent) {
if(ent > 0 && ent < 33)
return true

return false
}

public remove_pet(ent) {
if(pev_valid(ent))
fm_remove_entity(ent)
}

public CmdShop(id) {
if(!is_user_alive(id)) {
ColorChat(id, "!t%s!g Nu poti folosi shopul cat timp esti mort !", Prefix)
return;
}
switch(get_user_team(id)) {
case 1: FurienShop(id)
case 2: AntiFurienShop(id)
}
}

public FurienShop(id) {
if(is_user_alive(id) && get_user_team(id) == 1) {
new Title[128]

new money = cs_get_user_money(id);

formatex(Title, sizeof(Title)-1, "\rMoney: \y%d\r^n\rFurien Shop:", money)
Menu = menu_create(Title, "FurienHandler")

if(HaveSuperKnifeX2[id])
menu_additem(Menu, "\dSuper Knife [X2]\w - \rAi deja", "1", 0)
else {
if(money >= 14000)
menu_additem(Menu, "\wSuper Knife\r [X2]\w - \r14000$", "1", 0)
else
menu_additem(Menu, "\dSuper Knife [X2]\w - \r14000$", "1", 0)
}

if(get_user_health(id) >= 250)
menu_additem(Menu, "\dHealth [+40]\w -\r Ai viata maxima", "2", 0)
else {
if(money >= 3000)
menu_additem(Menu, "\wHealth \r[+40]\w - \r3000$", "2", 0)
else
menu_additem(Menu, "\dHealth [+40]\w - \r3000$", "2", 0)
}

if(get_user_armor(id) >= 250)
menu_additem(Menu, "\dArmor [+40]\w -\r Ai armura maxima", "3", 0)
else {
if(money >= 3000)
menu_additem(Menu, "\wArmor \r[+40]\w - \r3000$", "3", 0)
else
menu_additem(Menu, "\dArmor [+40]\w - \r3000$", "3", 0)
}

if(HaveNoFlash[id])
menu_additem(Menu, "\dNo Flash\w - \rAi deja", "4", 0)
else {
if(money >= 3000)
menu_additem(Menu, "\wNo Flash - \r3000$", "4", 0)
else
menu_additem(Menu, "\dNo Flash\w - \r3000$", "4", 0)
}

if(user_has_weapon(id, CSW_HEGRENADE))
menu_additem(Menu, "\dHe grenade\w - \rAi deja", "5", 0)
else {
if(money >= 6000)
menu_additem(Menu, "\wHe grenade - \r6000$", "5", 0)
else
menu_additem(Menu, "\dHe grenade\w - \r6000$", "5", 0)
}

if(user_has_weapon(id, CSW_SMOKEGRENADE))
menu_additem(Menu, "\dFrost nade\w - \rAi deja", "6", 0)
else {
if(money >= 4000)
menu_additem(Menu, "\wFrost nade - \r4000$", "6", 0)
else
menu_additem(Menu, "\dFrost nade\w - \r4000$", "6", 0)
}

if(get_user_flags(id) & VIP_LEVEL) {
if(HaveSuperKnifeVip[id])
menu_additem(Menu, "\dVip Pack\w - \rAi deja", "7", 0)
else {
if(money >= 10000)
menu_additem(Menu, "\wVip Pack - \r10000$", "7", 0)
else
menu_additem(Menu, "\dVip Pack\w - \r10000$", "7", 0)
}
}
else
menu_additem(Menu, "\dVip Pack\w - \rDoar VIP", "7", 0)

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

public FurienHandler(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);

new money = cs_get_user_money(id);
switch(Key) {
case 1: {
if(HaveSuperKnifeX2[id]) {
ColorChat(id, "!t%s!g Ai deja!t SuperKnife [X2]!g !", Prefix);
return 1;
}
else {
money -= 14000;
if(money < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t SuperKnife [X2]!g !", Prefix);
return 1;
}
else {
HaveSuperKnifeX2[id] = true;
HaveSuperKnifeVip[id] = false;
EVENT_CurWeapon(id);
cs_set_user_money(id, money);
ColorChat(id, "!t%s!g Ai cumparat!t SuperKnife [X2]!g !", Prefix);
}
}
}
case 2: {
if(get_user_health(id) >= 250) {
ColorChat(id, "!t%s!g Ai deja!t 250 health!g !", Prefix);
return 1;
}
else {
money -= 3000;
if(money < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t +40 Health!g !", Prefix);
return 1;
}
else {
if(get_user_health(id) + 50 > 250)
fm_set_user_health(id, 250)
else {
fm_set_user_health(id, get_user_health(id) + 40)
cs_set_user_money(id, money);
ColorChat(id, "!t%s!g Ai cumparat!t +40 Health!g !", Prefix)
}
}
}
}
case 3: {
if(get_user_armor(id) >= 250) {
ColorChat(id, "!t%s!g Ai deja!t 250 armor!g !", Prefix);
return 1;
}
else {
money -= 3000
if(money < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t +40 Armor!g !", Prefix);
return 1;
}
else {
if(get_user_armor(id) + 50 > 250)
fm_set_user_armor(id, 250);
else {
fm_set_user_armor(id, get_user_armor(id) + 40) ;
cs_set_user_money(id, money);
ColorChat(id, "!t%s!g Ai cumparat!t +40 Armor!g !", Prefix);
}
}
}
}
case 4: {
if(HaveNoFlash[id]) {
ColorChat(id, "!t%s!g Ai deja!t No Flash!g !", Prefix);
return 1;
}
else {
money -= 3000
if(money < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t No Flash!g !", Prefix);
return 1;
}
else {
HaveNoFlash[id] = true;
cs_set_user_money(id, money);
ColorChat(id, "!t%s!g Ai cumparat!t No Flash!g !", Prefix);
}
}
}
case 5: {
if(user_has_weapon(id, CSW_HEGRENADE)) {
ColorChat(id, "!t%s!g Ai deja!t HE Grenade!g !", Prefix);
return 1;
}
else {
money -= 6000
if(money < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t HE Grenade!g !", Prefix);
return 1;
}
else {
fm_give_item(id, "weapon_hegrenade");
cs_set_user_money(id, money);
ColorChat(id, "!t%s!g Ai cumparat!t HE Grenade!g !", Prefix);
}
}
}
case 6: {
if(user_has_weapon(id, CSW_SMOKEGRENADE)) {
ColorChat(id, "!t%s!g Ai deja!t Frost Nade!g !", Prefix);
return 1;
}
else {
money -= 4000
if(money < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t Frost Nade!g !", Prefix);
return 1;
}
else {
fm_give_item(id, "weapon_smokegrenade");
cs_set_user_money(id, money);
ColorChat(id, "!t%s!g Ai cumparat!t Frost Nade!g !", Prefix);
}
}
}
case 8: {
if(get_user_flags(id) & VIP_LEVEL) {
if(HaveSuperKnifeVip[id]) {
ColorChat(id, "!t%s!g Ai deja!t VIP Pack!g !", Prefix);
return 1;
}
else {
money -= 10000
if(money < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t VIP Pac!g !", Prefix);
return 1;
}
else {
HaveSuperKnifeVip[id] = true;
HaveSuperKnifeX2[id] = false;
EVENT_CurWeapon(id);
fm_set_user_armor(id, 300);
fm_set_user_health(id, 300);
cs_set_user_money(id, money);
}
}
}
else {
ColorChat(id, "!t%s!g Acest item poate fi cumparat doar de catre!t membrii VIP!g !", Prefix);
return 1;
}
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}

public AntiFurienShop(id) {
if(is_user_alive(id) && get_user_team(id) == 2) {
new Title[128]

new money = cs_get_user_money(id);
formatex(Title, sizeof(Title)-1, "\rMoney: \y%d\r^n\rAnti-Furien Shop:", money)
Menu = menu_create(Title, "AntiFurienHandler")

if(HaveDetector[id])
menu_additem(Menu, "\dFurien Detector\w - \rAi deja", "1", 0)
else {
if(money >= 8000)
menu_additem(Menu, "\wFurien Detector - \r8000$", "1", 0)
else
menu_additem(Menu, "\dFurien Detector\w - \r8000$", "1", 0)
}

if(cs_get_user_defuse(id))
menu_additem(Menu, "\dDefuse Kit\w - \rAi deja", "2", 0)
else {
if(money >= 500)
menu_additem(Menu, "\wDefuse Kit - \r500$", "2", 0)
else
menu_additem(Menu, "\dDefuse Kit\w - \r500$", "2", 0 )
}

if(get_user_health(id) >= 250)
menu_additem(Menu, "\dHealth [+40]\w -\r Ai viata maxima", "3", 0)
else {
if(money >= 3000)
menu_additem(Menu, "\wHealth \r[+40]\w - \r3000$", "3", 0)
else
menu_additem(Menu, "\dHealth [+40]\w - \r3000$", "3", 0)
}

if(get_user_armor(id) >= 250)
menu_additem(Menu, "\dArmor [+40]\w -\r Ai armura maxima", "4", 0)
else {
if(money >= 3000)
menu_additem(Menu, "\wArmor \r[+40]\w - \r3000$", "4", 0)
else
menu_additem(Menu, "\dArmor [+40]\w - \r3000$", "4", 0)
}

if(HaveNoFlash[id])
menu_additem(Menu, "\dNo Flash\w - \rAi deja", "5", 0)
else {
if(money >= 3000)
menu_additem(Menu, "\wNo Flash - \r3000$", "5", 0)
else
menu_additem(Menu, "\dNo Flash\w - \r3000$", "5", 0)
}

if(user_has_weapon(id, CSW_SMOKEGRENADE))
menu_additem(Menu, "\dFrost nade\w - \rAi deja", "6", 0)
else {
if(money >= 3000)
menu_additem(Menu, "\wFrost nade - \r3000$", "6", 0)
else
menu_additem(Menu, "\dFrost nade\w - \r3000$", "6", 0)
}

if(HavePET[id])
menu_additem(Menu, "\dPET\w - \rAi deja", "7", 0)
else {
if(money >= 10000)
menu_additem(Menu, "\wPET - \r10000$", "7", 0)
else
menu_additem(Menu, "\dPET\w - \r10000$", "7", 0)
}

if(get_user_flags(id) & VIP_LEVEL) {
if(HaveAT4[id])
menu_additem(Menu, "\dBazooka\w - \rAi deja", "8", 0)
else {
if(money >= 14000)
menu_additem(Menu, "\wBazooka - \r14000$", "8", 0)
else
menu_additem(Menu, "\dBazooka\w - \r14000$", "8", 0)
}
}
else
menu_additem(Menu, "\dBazooka\w - \rDoar VIP", "8", 0)

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

public AntiFurienHandler(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);

new money = cs_get_user_money(id);

switch(Key) {
case 1: {
if(HaveDetector[id]) {
ColorChat(id, "!t%s!g Ai deja!t Furien Detector!g !", Prefix);
return 1;
}
else {
money -= 8000
if(money < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente !tcredite!g pentru cumpara!t Furien Detector!g !", Prefix);
return 1;
}
else {
HaveDetector[id] = true;
cs_set_user_money(id, money);
ColorChat(id, "!t%s!g Ai cumparat!t Furien Detector!g !", Prefix);
}
}
}
case 2: {
if(cs_get_user_defuse(id)) {
ColorChat(id, "!t%s!g Ai deja!t Defuse KIT!g !", Prefix);
return 1;
}
else {
money -= 500
if(money < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t Defuse KIT!g !", Prefix);
return 1;
}
else {
cs_set_user_defuse(id, 1)
cs_set_user_money(id, money);
ColorChat(id, "!t%s!g Ai cumparat!t Defuse KIT!g !", Prefix);
}
}
}
case 3: {
if(get_user_health(id) >= 250) {
ColorChat(id, "!t%s!g Ai deja!t 250 health!g !", Prefix);
return 1;
}
else {
money -= 3000
if(money < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t +40 Health!g !", Prefix);
return 1;
}
else {
if(get_user_health(id) + 50 > 250)
fm_set_user_health(id, 250)
else {
fm_set_user_health(id, get_user_health(id) + 40)
cs_set_user_money(id, money);
ColorChat(id, "!t%s!g Ai cumparat!t +40 Health!g !", Prefix)
}
}
}
}
case 4: {
if(get_user_armor(id) >= 250) {
ColorChat(id, "!t%s!g Ai deja!t 250 armor!g !", Prefix);
return 1;
}
else {
money -= 3000
if(money < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t +40 Armor!g !", Prefix);
return 1;
}
else {
if(get_user_armor(id) + 50 > 250)
fm_set_user_armor(id, 250);
else {
fm_set_user_armor(id, get_user_armor(id) + 40) ;
cs_set_user_money(id, money);
ColorChat(id, "!t%s!g Ai cumparat!t +40 Armor!g !", Prefix);
}
}
}
}
case 5: {
if(HaveNoFlash[id]) {
ColorChat(id, "!t%s!g Ai deja!t No Flash!g !", Prefix);
return 1;
}
else {
money -= 3000
if(money < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t No Flash!g !", Prefix);
return 1;
}
else {
HaveNoFlash[id] = true;
cs_set_user_money(id, money);
ColorChat(id, "!t%s!g Ai cumparat!t No Flash!g !", Prefix);
}
}
}
case 6: {
if(user_has_weapon(id, CSW_SMOKEGRENADE)) {
ColorChat(id, "!t%s!g Ai deja!t Frost Nade!g !", Prefix);
return 1;
}
else {
money -= 3000
if(money < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t Frost Nade!g !", Prefix);
return 1;
}
else {
fm_give_item(id, "weapon_smokegrenade");
cs_set_user_money(id, money);
ColorChat(id, "!t%s!g Ai cumparat!t Frost Nade!g !", Prefix);
}
}
}
case 7: {
if(HavePET[id]) {
ColorChat(id, "!t%s!g Ai deja un!t PET!g !", Prefix);
return 1;
}
else {
money -= 10000
if(money < 0) {
ColorChat(id, "!t%s!g Nu ai suficiente!t credite!g pentru a cumpara!t PET", Prefix);
return 1;
}
else {
create_pet(id)
cs_set_user_money(id, money);
ColorChat(id, "!t%s!g Ai cumparat!t PET!g !", Prefix);
}
}
}
case 8: {
if(get_user_flags(id) & VIP_LEVEL) {
if(HaveAT4[id]) {
ColorChat(id, "!t%s!g Ai deja!t Bazooka!g !", Prefix);
return 1;
}
else {
money -= 14000
if(money < 0) {
ColorChat(id, "!t%s!g Ai deja!t Bazooka!g !", Prefix)
return 1;
}
else {
set_user_at4(id, true)
cs_set_user_money(id, money);
ColorChat(id, "!t%s!g Ai cumparat!t Bazooka!g !", Prefix);
}
}
}
else {
ColorChat(id, "!t%s!g Acest item poate fi cumparat doar de catre!t membrii VIP!g !", Prefix);
return 1;
}
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}

public AT4_UpdateClientData_POST(id, sendweapons, cd_handle) {
if(is_user_connected(id) && is_user_alive(id)) {
if(get_user_weapon(id) == CSW_AT4CS && HaveAT4[id])
set_cd(cd_handle, CD_flNextAttack, halflife_time() + 0.001)
}
}

public AT4_AddToPlayer(ent, id) {
if(!is_valid_ent(ent) || !is_user_alive(id))
return HAM_IGNORED

if(entity_get_int(ent, EV_INT_impulse) == 61296) {
HaveAT4[id] = true
entity_set_int(id, EV_INT_impulse, 0)

return HAM_HANDLED
}

if(HaveAT4[id]) {
message_begin(MSG_ONE, get_user_msgid("WeaponList"), _, id)
write_string("weapon_at4cs"); // WeaponName
write_byte(3) // PrimaryAmmoID
write_byte(1) // PrimaryAmmoMaxAmount
write_byte(-1) // SecondaryAmmoID
write_byte(-1) // SecondaryAmmoMaxAmount
write_byte(0) // SlotID (0...N)
write_byte(4) // NumberInSlot (1...N)
write_byte(CSW_AT4CS) // WeaponID
write_byte(0) // Flags
message_end()
}
return HAM_HANDLED
}

public AT4_CMDStart(id, uc_handle, seed) {
if(is_user_connected(id) && is_user_alive(id)) {
if(get_user_weapon(id) == CSW_AT4CS && HaveAT4[id]) {
static CurButton
CurButton = get_uc(uc_handle, UC_Buttons)
if(CurButton & IN_ATTACK) {
static Float:CurTime
CurTime = get_gametime()

static at4cs
at4cs = fm_find_ent_by_owner(-1, weapon_at4cs, id)

if(cs_get_weapon_ammo(at4cs) > 0 && !is_reloading[id]) {
if(CurTime - 4.5 > g_lastfire[id]) {
set_weapon_anim(id, 1)
emit_sound(id, CHAN_WEAPON, AT4Sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)

create_rocket(id)

static Float:Punch_Angles[3]

Punch_Angles[0] = -20.0
Punch_Angles[1] = 0.0
Punch_Angles[2] = 0.0

set_pev(id, pev_punchangle, Punch_Angles)
cs_set_weapon_ammo(at4cs, cs_get_weapon_ammo(at4cs) - 1)

if(cs_get_weapon_ammo(at4cs) <= 0 && !is_reloading[id]) {
if(cs_get_user_bpammo(id, CSW_AT4CS) > 0) {
set_task(1.0, "at4cs_reload", id)
}
}
if(cs_get_user_zoom(id))
cs_set_user_zoom(id, CS_RESET_ZOOM, 1)

g_lastfire[id] = CurTime
}
}
else {
if(!is_reloading[id]) {
if(cs_get_user_bpammo(id, CSW_AT4CS) > 0) {
if(CurTime - 1.0 > g_lastfire[id]) {
at4cs_reload(id)
g_lastfire[id] = CurTime
}
}
}
}
}
if(CurButton & IN_ATTACK2) {
static Float:CurTime
CurTime = get_gametime()

if((CurTime - 0.5 > g_lastaim[id]) && !is_reloading[id]) {
if(!g_aiming[id]) {
cs_set_user_zoom(id, CS_SET_FIRST_ZOOM, 1)
g_aiming[id] = 1
}
else {
cs_set_user_zoom(id, CS_RESET_ZOOM, 1)
g_aiming[id] = 0
}
g_lastaim[id] = CurTime
}
}

CurButton &= ~IN_ATTACK
set_uc(uc_handle, UC_Buttons, CurButton)

CurButton &= ~IN_RELOAD
set_uc(uc_handle, UC_Buttons, CurButton)
}
}

return FMRES_HANDLED
}

public AT4_WorldModel(ent, const model[]) {
if(!is_valid_ent(ent))
return FMRES_IGNORED

static szClassName[33]
entity_get_string(ent, EV_SZ_classname, szClassName, charsmax(szClassName))

if(!equal(szClassName, "weaponbox"))
return FMRES_IGNORED

static iOwner
iOwner = entity_get_edict(ent, EV_ENT_owner)

if(equal(model, "models/w_m249.mdl")) {
static at4cs
at4cs = find_ent_by_owner(-1, "weapon_m249", ent)

if(!is_valid_ent(at4cs))
return FMRES_IGNORED;

if(HaveAT4[iOwner]) {
entity_set_int(at4cs, EV_INT_impulse, 61296)
HaveAT4[iOwner] = false;
entity_set_model(ent, AT4Model_W)

return FMRES_SUPERCEDE
}
}
return FMRES_IGNORED
}

public at4cs_reload(id) {
if(is_reloading[id])
return

is_reloading[id] = 1
set_weapon_anim(id, 3)

set_task(0.1, "checking_reload", id+TASK_CHECKRELOAD, _, _, "b")
set_task(4.0, "reload_complete", id+TASK_RELOAD)
}

public checking_reload(id) {
id -= TASK_CHECKRELOAD

if(cs_get_user_zoom(id))
cs_set_user_zoom(id, CS_RESET_ZOOM, 1)

if(get_user_weapon(id) != CSW_AT4CS || !HaveAT4[id]) {
remove_task(id+TASK_CHECKRELOAD)
remove_task(id+TASK_RELOAD)

is_reloading[id] = 0
}
}

public reload_complete(id) {
id -= TASK_RELOAD

if(!is_reloading[id])
return

remove_task(id+TASK_CHECKRELOAD)

static at4cs
at4cs = fm_find_ent_by_owner(-1, weapon_at4cs, id)

cs_set_weapon_ammo(at4cs, 1)
cs_set_user_bpammo(id, CSW_AT4CS, cs_get_user_bpammo(id, CSW_AT4CS) - 1)
is_reloading[id] = 0
}

public AT4_Reload(ent) {
static id
id = pev(ent, pev_owner)

if(is_user_connected(id) && is_user_alive(id)) {
if(get_user_weapon(id) == CSW_AT4CS && HaveAT4[id]) {

static Float:CurTime
CurTime = get_gametime()

if(!is_reloading[id]) {
if(cs_get_user_bpammo(id, CSW_AT4CS) > 0) {
if(CurTime - 1.0 > g_lastfire[id]) {
at4cs_reload(id)
g_lastfire[id] = CurTime
}
}
}
}
}
return HAM_SUPERCEDE
}

public AT4_Think(ent) {
if(!pev_valid(ent))
return

static Float:Origin[3]
pev(ent, pev_origin, Origin)

message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_SPRITE)
engfunc(EngFunc_WriteCoord, Origin[0])
engfunc(EngFunc_WriteCoord, Origin[1])
engfunc(EngFunc_WriteCoord, Origin[2])
write_short(g_smoke_id)
write_byte(2)
write_byte(200)
message_end()

if(pev(ent, pev_iuser4) == 0) {
static Victim
Victim = FindClosesEnemy(ent)

if(is_user_alive(Victim)) {
set_pev(ent, pev_iuser4, Victim)
}
}
else {
static Victim
Victim = pev(ent, pev_iuser4)

if(is_user_alive(Victim)) {
static Float:VicOrigin[3]
pev(Victim, pev_origin, VicOrigin)

turn_to_target(ent, Origin, Victim, VicOrigin)
hook_ent(ent, Victim, 500.0)
}
else {
set_pev(ent, pev_iuser4, 0)
}
}
set_pev(ent, pev_nextthink, halflife_time() + 0.075)
}

public AT4_Touch(rocket, touch) {
if(!pev_valid(rocket))
return

if(is_user_alive(touch) && pev(rocket, pev_owner) == touch)
return

static Float:Origin[3]
pev(rocket, pev_origin, Origin)

message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
write_byte(TE_EXPLOSION)
engfunc(EngFunc_WriteCoord, Origin[0])
engfunc(EngFunc_WriteCoord, Origin[1])
engfunc(EngFunc_WriteCoord, Origin[2])
write_short(g_spr_exp) // sprite index
write_byte(20) // scale in 0.1's
write_byte(30) // framerate
write_byte(0) // flags
message_end()

static owner, iVictim

iVictim = -1
owner = pev(rocket, pev_owner)

while((iVictim = find_ent_in_sphere(iVictim, Origin, get_pcvar_float(cvar_radius))) != 0) {
if((0 < iVictim < 32) && is_user_alive(iVictim) && iVictim != owner) {
new Float:MaxDamage, Float:Damage

MaxDamage = get_pcvar_float(cvar_maxdamage)
Damage = random_float(MaxDamage - random_float(0.0, 100.0), MaxDamage + random_float(0.0, 100.0))

ExecuteHam(Ham_TakeDamage, iVictim, 0, owner, 0, DMG_BULLET)

static health
health = get_user_health(iVictim)

if(health - Damage >= 1) {
fm_set_user_health(iVictim, health - floatround(Damage))
}
else {
death_message(owner, iVictim, 1)
}
}
}
engfunc(EngFunc_RemoveEntity, rocket)
}

public create_rocket(id) {
new ent, Float:Origin[3], Float:Angles[3], Float:Velocity[3]

ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
engfunc(EngFunc_GetAttachment, id, 0, Origin, Angles)
pev(id, pev_angles, Angles)

set_pev(ent, pev_origin, Origin)
set_pev(ent, pev_angles, Angles)
set_pev(ent, pev_solid, 2)
set_pev(ent, pev_movetype, 5)
set_pev(ent, pev_classname, "at4ex_rocket")
set_pev(ent, pev_owner, id)
engfunc(EngFunc_SetModel, ent, AT4Rocket)

set_pev(ent, pev_mins, {-1.0, -1.0, -1.0})
set_pev(ent, pev_maxs, {1.0, 1.0, 1.0})

velocity_by_aim(id, 1750, Velocity)
set_pev(ent, pev_velocity, Velocity)

message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW) // TE id
write_short(ent) // entity:attachment to follow
write_short(g_spr_trail) // sprite index
write_byte(25) // life in 0.1's
write_byte(2) // line width in 0.1's
write_byte(255) // r
write_byte(255) // g
write_byte(255) // b
write_byte(200) // brightness
message_end()

set_pev(ent, pev_iuser4, 0)
set_pev(ent, pev_nextthink, halflife_time() + 0.1)
}

public hook_weapon(id) {
engclient_cmd(id, weapon_at4cs)
}

public get_user_at4(id) {
return HaveAT4[id];
}

public set_user_at4(id, at4) {
if(at4) {
if(!HaveAT4[id]) {
drop_primary_weapons(id);
HaveAT4[id] = true;
is_reloading[id] = 0
g_aiming[id] = 0
fm_give_item(id, weapon_at4cs);
new Clip = fm_get_user_weapon_entity(id, CSW_AT4CS);
cs_set_weapon_ammo(Clip, 1);
cs_set_user_bpammo(id, CSW_AT4CS, 50)
}
}
else {
if(HaveAT4[id]) {
HaveAT4[id] = false;
}
}
}

//-------------------------------------------------------------------------//
//=============================| Stocks |=================================//
//-----------------------------------------------------------------------//
stock get_offset_origin_body(ent,const Float:offset[3],Float:origin[3]) {
if(!pev_valid(ent))
return 0;

new Float:angle[3]
pev(ent,pev_angles,angle)

pev(ent,pev_origin,origin)

origin[0] += floatcos(angle[1],degrees) * offset[0]
origin[1] += floatsin(angle[1],degrees) * offset[0]

origin[1] += floatcos(angle[1],degrees) * offset[1]
origin[0] += floatsin(angle[1],degrees) * offset[1]

return 1;
}

stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speed, Float:new_velocity[3]) {
new_velocity[0] = origin2[0] - origin1[0]
new_velocity[1] = origin2[1] - origin1[1]
new_velocity[2] = origin2[2] - origin1[2]
new Float:num = floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
new_velocity[0] *= num
new_velocity[1] *= num
new_velocity[2] *= num

return 1;
}

stock entity_set_aim(ent,const Float:origin2[3],bone=0) {
if(!pev_valid(ent))
return 0;

static Float:origin[3]
origin[0] = origin2[0]
origin[1] = origin2[1]
origin[2] = origin2[2]

static Float:ent_origin[3], Float:angles[3]

if(bone)
engfunc(EngFunc_GetBonePosition,ent,bone,ent_origi n,angles)
else
pev(ent,pev_origin,ent_origin)

origin[0] -= ent_origin[0]
origin[1] -= ent_origin[1]
origin[2] -= ent_origin[2]

static Float:v_length
v_length = vector_length(origin)

static Float:aim_vector[3]
aim_vector[0] = origin[0] / v_length
aim_vector[1] = origin[1] / v_length
aim_vector[2] = origin[2] / v_length

static Float:new_angles[3]
vector_to_angle(aim_vector,new_angles)

new_angles[0] *= -1

if(new_angles[1]>180.0) new_angles[1] -= 360
if(new_angles[1]<-180.0) new_angles[1] += 360
if(new_angles[1]==180.0 || new_angles[1]==-180.0) new_angles[1]=-179.999999

set_pev(ent,pev_angles,new_angles)
set_pev(ent,pev_fixangle,1)

return 1;
}


stock set_weapon_anim(id, anim) {
set_pev(id, pev_weaponanim, anim)

message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, _, id)
write_byte(anim)
write_byte(pev(id,pev_body))
message_end()
}

stock death_message(Killer, Victim, ScoreBoard) {
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)
ExecuteHamB(Ham_Killed, Victim, Killer, 2)
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)

make_deathmsg(Killer, Victim, 0, "")

if (ScoreBoard) {
message_begin(MSG_BROADCAST, get_user_msgid("ScoreInfo"))
write_byte(Killer) // id
write_short(pev(Killer, pev_frags)) // frags
write_short(cs_get_user_deaths(Killer)) // deaths
write_short(0) // class?
write_short(get_user_team(Killer)) // team
message_end()

message_begin(MSG_BROADCAST, get_user_msgid("ScoreInfo"))
write_byte(Victim) // id
write_short(pev(Victim, pev_frags)) // frags
write_short(cs_get_user_deaths(Victim)) // deaths
write_short(0) // class?
write_short(get_user_team(Victim)) // team
message_end()
}
}

stock FindClosesEnemy(entid) {
new Float:Dist
new Float:maxdistance = 300.0
new indexid = 0

for(new i = 1; i <= get_maxplayers(); i++){
if(is_user_alive(i) && is_valid_ent(i) && can_see_fm(entid, i)
&& pev(entid, pev_owner) != i && cs_get_user_team(pev(entid, pev_owner)) != cs_get_user_team(i)) {
Dist = entity_range(entid, i)
if(Dist <= maxdistance) {
maxdistance = Dist
indexid = i

return indexid
}
}
}
return 0
}

stock bool:can_see_fm(entindex1, entindex2) {
if (!entindex1 || !entindex2)
return false

if (pev_valid(entindex1) && pev_valid(entindex1)) {
new flags = pev(entindex1, pev_flags)
if (flags & EF_NODRAW || flags & FL_NOTARGET)
return false

new Float:lookerOrig[3]
new Float:targetBaseOrig[3]
new Float:targetOrig[3]
new Float:temp[3]

pev(entindex1, pev_origin, lookerOrig)
pev(entindex1, pev_view_ofs, temp)
lookerOrig[0] += temp[0]
lookerOrig[1] += temp[1]
lookerOrig[2] += temp[2]

pev(entindex2, pev_origin, targetBaseOrig)
pev(entindex2, pev_view_ofs, temp)
targetOrig[0] = targetBaseOrig [0] + temp[0]
targetOrig[1] = targetBaseOrig [1] + temp[1]
targetOrig[2] = targetBaseOrig [2] + temp[2]

engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) // checks the had of seen player
if (get_tr2(0, TraceResult:TR_InOpen) && get_tr2(0, TraceResult:TR_InWater)) {
return false
}
else {
new Float:flFraction
get_tr2(0, TraceResult:TR_flFraction, flFraction)
if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2)) {
return true
}
else {
targetOrig[0] = targetBaseOrig [0]
targetOrig[1] = targetBaseOrig [1]
targetOrig[2] = targetBaseOrig [2]
engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) // checks the body of seen player
get_tr2(0, TraceResult:TR_flFraction, flFraction)
if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2)) {
return true
}
else {
targetOrig[0] = targetBaseOrig [0]
targetOrig[1] = targetBaseOrig [1]
targetOrig[2] = targetBaseOrig [2] - 17.0
engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) // checks the legs of seen player
get_tr2(0, TraceResult:TR_flFraction, flFraction)
if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2)) {
return true
}
}
}
}
}
return false
}

stock turn_to_target(ent, Float:Ent_Origin[3], target, Float:Vic_Origin[3]) {
if(target) {
new Float:newAngle[3]
entity_get_vector(ent, EV_VEC_angles, newAngle)
new Float:x = Vic_Origin[0] - Ent_Origin[0]
new Float:z = Vic_Origin[1] - Ent_Origin[1]

new Float:radians = floatatan(z/x, radian)
newAngle[1] = radians * (180 / 3.14)
if (Vic_Origin[0] < Ent_Origin[0])
newAngle[1] -= 180.0

entity_set_vector(ent, EV_VEC_angles, newAngle)
}
}

stock hook_ent(ent, victim, Float:speed) {
static Float:fl_Velocity[3]
static Float:VicOrigin[3], Float:EntOrigin[3]

pev(ent, pev_origin, EntOrigin)
pev(victim, pev_origin, VicOrigin)

static Float:distance_f
distance_f = get_distance_f(EntOrigin, VicOrigin)

if (distance_f > 10.0) {
new Float:fl_Time = distance_f / speed

fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
}
else {
fl_Velocity[0] = 0.0
fl_Velocity[1] = 0.0
fl_Velocity[2] = 0.0
}

entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
}

stock drop_primary_weapons(Player) {
static weapons[32], num, i, weaponid;
num = 0;
get_user_weapons(Player, weapons, num);

for(i = 0; i < num; i++) {
weaponid = weapons [i];

if(((1<<weaponid) & PRIMARY_WEAPONS_BITSUM)) {
static wname[32];
get_weaponname(weaponid, wname, charsmax(wname));

engclient_cmd(Player, "drop", wname);
}
}
}

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();
}
}
}
}

^JoK3R^
29-08-2014, 07:47 PM
Cand vreau sa-mi cumpar bazooka imi spune ca o am deja ,dar nu e asa.