#include <amxmodx>
#include <codmod>
#include <hamsandwich>
#include <fakemeta>
#include <fakemeta_util>
#include <ColorChat>
#include <cstrike>
#include <fun>
#include <engine>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Krupek"
#define MAX 32
#define DMG_HEGRENADE (1<<24)
#define DMG_BULLET (1<<1)
new gold_sell;
new bool:a_odpornosc_he[33];
new bool:a_odpornosc_fb[33];
new bool:a_skoki[33];
new bool:a_bezlik[33];
new bool:a_wampir[33];
new bool:a_dmg[33];
new bool:a_teleport[33];
new bool:a_long[33];
new bool:a_przeladowanie[33];
new bool:a_latarka[MAX+1];
new bool:flashlight[MAX+1];
new bool:flashbattery[MAX+1];
new player_b_froglegs[33];
new skoki[33];
new bool:uzyl[33];
native cod_get_user_gold(id);
native cod_set_user_gold(id, wartosc);
native cod_get_perk_durability(id);
native cod_set_perk_durability(id, wytrzymalosc);
new const max_clip[31] = { -1, 13, -1, 10, 1, 7, 1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 };
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /cos", "cmd_menu");
RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
register_forward(FM_CmdStart, "fwCmdStart_MultiJump");
register_forward(FM_PlayerPreThink,"PreThink");
register_forward(FM_PlayerPreThink, "Prethink_froglegs");
register_forward(FM_CmdStart, "CmdStart");
register_event("CurWeapon","CurWeapon","be", "1=1");
register_event("DeathMsg", "DeathMsg", "ade");
register_event("Flashlight","Flashlight","b");
register_event("ResetHUD", "ResetHUD", "abe");
register_message(get_user_msgid("ScreenFade"), "messageScreenFade");
register_cvar("cod_mag_render", "30");
gold_sell = register_cvar("cod_gold_sellperk", "3");
}
public client_disconnect(id)
{
a_odpornosc_he[id]=false
a_odpornosc_fb[id]=false
a_skoki[id]=false
a_bezlik[id]=false
a_wampir[id]=false
a_dmg[id]=false
a_latarka[id]=false
a_long[id]=false
a_przeladowanie[id]=false
}
public ResetHUD(id)
{
uzyl[id] = false;
}
public cmd_menu(id)
{
if(is_user_alive(id))
{
Menu(id);
}
else
{
ColorChat(id, GREEN, "[COD:MW3]^x01 Aby uzywac /zloto musisz byc zywy!");
}
return PLUGIN_HANDLED;
}
stock Menu(id)
{
new testmenu = menu_create("Widzisz menu?", "Menu_2");
menu_additem(testmenu, "Umiejetnosci");
menu_additem(testmenu, "Targowisko");
menu_additem(testmenu, "Co to Zloto?\r [\y #Skrot\r ]");
menu_setprop(testmenu, MPROP_EXITNAME, "Wyjscie");
menu_display(id, testmenu);
return PLUGIN_HANDLED;
}
public Menu_2(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
switch(item)
{
case 0:Umiejetnosci(id)
case 1:Targowisko(id)
}
return PLUGIN_HANDLED;
}
public Umiejetnosci(id)
{
new tytul[25];
format(tytul, 24, "\rUmka");
new menu = menu_create(tytul, "Umiejetnosci_Handler");
menu_additem(menu, "HP za zabicie \d[ +10 ] \yKoszt: \r7 Zlota")
menu_additem(menu, "Wiekszy DMG \d[ +5 ] \yKoszt: \r13 Zlota")
menu_additem(menu, "Wytrzymalosc perku \d[ +50 ] \yKoszt: \r11 Zlota ")
menu_additem(menu, "Pancerz \d[ 400 Armoru ] \yKoszt: \r5 Zlota ")
menu_additem(menu, "Ciche chodzenie \yKoszt: \r6 Zlota ")
menu_additem(menu, "Odpornosc na HE \yKoszt: \r9 Zlota")
menu_additem(menu, "Odpornosc na FB \yKoszt: \r8 Zlota ")
menu_additem(menu, "Nieskonczona amunicja \yKoszt: \r21 Zlota")
menu_additem(menu, "Latarka \d[ Skill Maga ] \yKoszt: \r39 Zlota ")
menu_additem(menu, "Long Jumpy \d[ Skill Palladyna ] \yKoszt: \r38 Zlota ")
menu_additem(menu, "Wysokie skoki \d[ Skill Ninjy] \yKoszt: \r11 Zlota")
menu_additem(menu, "Teleport \d[ Skill Telegrafisty ] \yKoszt: \r27 Zlota ")
menu_additem(menu, "Podskok \d[ Skill Krecika ] \yKoszt: \r11 Zlota ")
menu_display(id, menu);
}
public Umiejetnosci_Handler(id, menu, item)
{
if(!is_user_alive(id) || !is_user_connected(id))
return PLUGIN_CONTINUE;
new kasa = cod_get_user_gold(id)
if(item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_CONTINUE;
}
switch(item)
{
case 0:
{
if(kasa >= 7)
{
a_wampir[id]=true
cod_set_user_gold(id, kasa-7);
ColorChat(id, GREEN, "[COD:MW3]^x01 Kupiles HP za zabicie");
}
else
ColorChat(id, GREEN, "[COD:MW3]^x01 Zapomnij, masz za malo zlota!");
}
case 1:
{
if(kasa >= 13)
{
a_dmg[id]=true
cod_set_user_gold(id, kasa-13);
ColorChat(id, GREEN, "[COD:MW3]^x01 Kupiles dodatkowe dmg !");
}
else
ColorChat(id, GREEN, "[COD:MW3]^x01 Zapomnij, masz za malo zlota!");
}
case 2:
{
if(kasa >= 11)
{
cod_set_perk_durability(id, 100);
ColorChat(id, GREEN, "[COD:MW3]^x01 Twoj perk jest w pelni naprawiony!", cod_get_perk_durability(id));
cs_set_user_money(id, kasa-14000);
}
else
ColorChat(id, GREEN, "[COD:MW3]^x01 Zapomnij, masz za malo zlota!");
}
case 3:
{
if(kasa <= 5)
{
set_user_armor( id, get_user_armor( id ) + 400 );
cod_set_user_gold(id, kasa-5);
ColorChat(id, GREEN, "[COD:MW3]^x01 Kupiles 400 Kamizelki!");
}
else
ColorChat(id, GREEN, "[COD:MW3]^x01 Zapomnij, masz za malo zlota!");
}
case 4:
{
if(kasa >= 6)
{
set_user_footsteps(id, 1);
cod_set_user_gold(id, kasa-6);
ColorChat(id, GREEN, "[COD:MW3]^x01 Kupiles ciche buty!");
}
else
ColorChat(id, GREEN, "[COD:MW3]^x01 Zapomnij, masz za malo hajsu!");
}
case 5:
{
if(kasa <= 9)
{
a_odpornosc_he[id]=true
cod_set_user_gold(id, kasa-9);
ColorChat(id, GREEN, "[COD:MW3]^x01 Kupiles odpornosc na HE");
}
else
ColorChat(id, GREEN, "[COD:MW3]^x01 Zapomnij, masz za malo zlota!");
}
case 6:
{
if(kasa <= 9)
{
a_odpornosc_fb[id]=true
cod_set_user_gold(id, kasa-9);
ColorChat(id, GREEN, "[COD:MW3]^x01 Kupiles odpornosc na FB");
}
else
ColorChat(id, GREEN, "[COD:MW3]^x01 Zapomnij, masz za malo zlota!");
}
case 7:
{
if(kasa <= 21)
{
a_bezlik[id]=true
cod_set_user_gold(id, kasa-21);
ColorChat(id, GREEN, "[COD:MW3]^x01 Kupiles moc Nieskonczona amunicja");
}
else
ColorChat(id, GREEN, "[COD:MW3]^x01 Zapomnij, masz za malo zlota!");
}
case 8:
{
if(kasa <= 21)
{
a_latarka[id]=true
cod_set_user_gold(id, kasa-21);
ColorChat(id, GREEN, "[COD:MW3]^x01 Kupiles latarke");
}
else
ColorChat(id, GREEN, "[COD:MW3]^x01 Zapomnij, masz za malo zlota!");
}
case 9:
{
if(kasa <= 21)
{
a_long[id]=true
cod_set_user_gold(id, kasa-21);
ColorChat(id, GREEN, "[COD:MW3]^x01 Kupiles long jumpy");
}
else
ColorChat(id, GREEN, "[COD:MW3]^x01 Zapomnij, masz za malo zlota!");
}
case 10:
{
if(kasa <= 11)
{
set_user_gravity(id, 0.4);
cod_set_user_gold(id, kasa-11);
ColorChat(id, GREEN, "[COD:MW3]^x01 Kupiles wysokie skoki!");
}
else
ColorChat(id, GREEN, "[COD:MW3]^x01 Zapomnij, masz za malo zlota!");
}
case 11:
{
if(kasa <= 11)
{
a_teleport[id]=true
cod_set_user_gold(id, kasa-11);
ColorChat(id, GREEN, "[COD:MW3]^x01 Kupiles Teleport!");
}
else
ColorChat(id, GREEN, "[COD:MW3]^x01 Zapomnij, masz za malo zlota!");
}
case 12:
{
if(kasa <= 11)
{
a_skoki[id]=true
cod_set_user_gold(id, kasa-11);
ColorChat(id, GREEN, "[COD:MW3]^x01 Kupiles Podskok");
}
else
ColorChat(id, GREEN, "[COD:MW3]^x01 Zapomnij, masz za malo zlota!");
}
case 13:
{
if(kasa <= 11)
{
a_przeladowanie[id]=true
cod_set_user_gold(id, kasa-11);
ColorChat(id, GREEN, "[COD:MW3]^x01 Kupiles Szybsze Przeladowywanie");
}
else
ColorChat(id, GREEN, "[COD:MW3]^x01 Zapomnij, masz za malo zlota!");
}
}
return PLUGIN_CONTINUE;
}
public Targowisko(id)
{
new tytul[25];
format(tytul, 24, "\rUmka");
new menu = menu_create(tytul, "Targowisko_Handler");
menu_additem(menu, "Lekka Mikstura Leczeina \d[ +80 HP ] \yKoszt: \r2 Zlota")
menu_additem(menu, "Wieksza Mikstura Leczeina \d[ 150 HP ] \yKoszt: \r3 Zlota")
menu_additem(menu, "Mikstura Pelnego Wzmconienia \d[ FULL HP ] \yKoszt: \r4 Zlota")
menu_additem(menu, "Mikstrua Wytrzymalosci \d[ Napraw Przedmiotu ] \yKoszt: \r4 Zlota")
menu_additem(menu, "Kup losowa Rune \yKoszt: \r50 Zlota ")
menu_additem(menu, "Sprzedaj Przedmiot \yZysk: \r0-1 Zlota")
menu_additem(menu, "Sprzedaj Rune \yZysk: \r10-25 Zlota ")
menu_display(id, menu);
}
public Targowisko_Handler(id, menu, item)
{
if(!is_user_alive(id) || !is_user_connected(id))
return PLUGIN_CONTINUE;
new kasa = cod_get_user_gold(id)
if(item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_CONTINUE;
}
switch(item)
{
case 0:
{
if(kasa >= 2)
{
cod_set_user_gold(id, kasa-2);
set_user_health( id, get_user_health( id ) + 80 );
ColorChat(id, GREEN, "[COD:MW3]^x01 Kupiles 80 HP!");
}
else
ColorChat(id, GREEN, "[COD:MW3]^x01 Zapomnij, masz za malo zlota!");
}
case 1:
{
if(kasa >= 3)
{
cod_set_user_gold(id, kasa-3);
set_user_health( id, get_user_health( id ) + 150 );
ColorChat(id, GREEN, "[COD:MW3]^x01 Kupiles 150 HP!");
}
else
ColorChat(id, GREEN, "[COD:MW3]^x01 Zapomnij, masz za malo zlota!");
}
case 2:
{
if(kasa >= 4)
{
cod_set_user_gold(id, kasa-4);
set_user_health( id, get_user_health( id ) + 150 );
ColorChat(id, GREEN, "[COD:MW3]^x01 Kupiles FULL HP!");
}
else
ColorChat(id, GREEN, "[COD:MW3]^x01 Zapomnij, masz za malo zlota!");
}
case 3:
{
if(kasa >= 4)
{
new uszkodzenia_perku = cod_get_perk_durability(id);
if(uszkodzenia_perku+50>=100)
{
cod_set_perk_durability(id, 100);
ColorChat(id, GREEN, "[COD:MW3]^x01 Twoj perk jest w pelni naprawiony!", cod_get_perk_durability(id));
}
else
{
cod_set_perk_durability(id, uszkodzenia_perku+50);
ColorChat(id, GREEN, "[COD:MW3]^x01 Kupiles^x04 +50^x01 wytrzymalosci perku!");
ColorChat(id, GREEN, "[COD:MW3]^x01 Wytrzymalosc twojego perku wynosi^x04 %i", cod_get_perk_durability(id));
}
cod_set_user_gold(id, kasa-4);
}
else
ColorChat(id, GREEN, "[COD:MW3]^x01 Zapomnij, masz za malo zlota!");
}
case 4:
{
if(kasa >= 50)
{
cs_set_user_money(id, kasa-50);
cod_set_user_perk(id, -1, -1, 1);
ColorChat(id, GREEN, "[COD:MW3]^x01 Kupiles losowy perk!");
}
else
ColorChat(id, GREEN, "[COD:MW3]^x01 Zapomnij, masz za malo zlota!");
}
case 5:
{
sprzedaj_perk(id)
}
case 6:
{
sprzedaj_perk(id)
}
}
return PLUGIN_CONTINUE;
}
public sprzedaj_perk(id)
{
if(!is_user_alive(id) || !is_user_connected(id))
return PLUGIN_CONTINUE;
new kasa = cod_get_user_gold(id);
new cena = get_pcvar_num(gold_sell);
if(cod_get_user_perk(id))
{
cod_set_user_gold(id, kasa+cena);
ColorChat(id, GREEN, "[COD:MW3]^x01 Sprzedales swoj perk!");
cod_set_user_perk(id, 0, 0, 0);
}
else
{
ColorChat(id, GREEN, "[COD:MW3]^x01 Nie masz zadnego perku!");
}
return PLUGIN_CONTINUE;
}
/* Dmg i odpornosc ================================================================================ */
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
if(!is_user_connected(this))
return HAM_IGNORED;
if(a_odpornosc_he[this] && damagebits & DMG_HEGRENADE)
return HAM_SUPERCEDE;
if(a_dmg[idattacker] && get_user_team(this) != get_user_team(idattacker) && damagebits & DMG_BULLET)
cod_inflict_damage(idattacker, this, 5.0, 0.0, idinflictor, damagebits);
return HAM_IGNORED;
}
/* Skoki ========================================================================================== */
public fwCmdStart_MultiJump(id, uc_handle)
{
if(!is_user_alive(id) || !a_skoki[id])
return FMRES_IGNORED;
new flags = pev(id, pev_flags);
if((get_uc(uc_handle, UC_Buttons) & IN_JUMP) && !(flags & FL_ONGROUND) && !(pev(id, pev_oldbuttons) & IN_JUMP) && skoki[id])
{
skoki[id]--;
new Float:velocity[3];
pev(id, pev_velocity,velocity);
velocity[2] = random_float(265.0,285.0);
set_pev(id, pev_velocity,velocity);
}
else if(flags & FL_ONGROUND)
skoki[id] = 2;
return FMRES_IGNORED;
}
/* Wampir ========================================================================================= */
public DeathMsg()
{
new killer = read_data(1);
if(!is_user_connected(killer))
return PLUGIN_CONTINUE;
if(a_wampir[killer])
{
new cur_health = pev(killer, pev_health);
new Float:max_health = 100.0+cod_get_user_health(killer);
new Float:new_health = cur_health+30.0<max_health? cur_health+30.0: max_health;
set_pev(killer, pev_health, new_health);
}
return PLUGIN_CONTINUE;
}
/* Bezlik ========================================================================================= */
public CurWeapon(id)
{
if(!is_user_connected(id))
return;
if(!a_bezlik[id])
return;
set_user_clip(id, 2);
}
stock set_user_clip(id, ammo)
{
new weaponname[32], weaponid = -1, weapon = get_user_weapon(id, _, _);
get_weaponname(weapon, weaponname, 31);
while ((weaponid = engfunc(EngFunc_FindEntityByString, weaponid, "classname", weaponname)) != 0)
if (pev(weaponid, pev_owner) == id)
{
set_pdata_int(weaponid, 51, ammo, 4);
return weaponid;
}
return 0;
}
/* Latarka ======================================================================================== */
public PreThink(id)
{
if(!is_user_alive(id))
return FMRES_IGNORED;
if(flashlight[id] && flashbattery[id] && a_latarka[id])
{
static flashlight_r, flashlight_g, flashlight_b;
flashlight_r+= 1+random_num(0,2)
if (flashlight_r>250)
flashlight_r-=245
flashlight_g+= 1+random_num(-1,1)
if (flashlight_g>250)
flashlight_g-=245
flashlight_b+= -1+random_num(-1,1)
if (flashlight_b<5)
flashlight_b+=240
new origin[3];
get_user_origin(id, origin, 3);
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(27);
write_coord(origin[0]);
write_coord(origin[1]);
write_coord(origin[2]);
write_byte(8);
write_byte(flashlight_r);
write_byte(flashlight_g);
write_byte(flashlight_b);
write_byte(1);
write_byte(90);
message_end();
new traget, bodypart;
get_user_aiming(id, traget, bodypart)
if(get_user_team(id) != get_user_team(traget) && traget)
{
new data[2];
data[0] = traget;
data[1] = pev(traget, pev_renderamt);
if(data[1] < 255.0)
{
fm_set_rendering(traget, kRenderFxGlowShell, flashlight_r, flashlight_g, flashlight_b, kRenderNormal, 4)
remove_task(8752+traget);
set_task(7.5, "wylacz_rander", 8752+traget, data, 2)
}
}
}
return FMRES_HANDLED;
}
public wylacz_rander(data[2])
{
if(is_user_connected(data[0]) && is_user_alive(data[0]))
fm_set_rendering(data[0], kRenderFxNone, 0, 0, 0, kRenderTransAlpha, data[1])
}
public Flashlight(id)
{
if(flashlight[id])
flashlight[id] = 0;
else if(flashbattery[id] > 0)
flashlight[id] = 1;
if(!task_exists(2071+id))
set_task(flashlight[id]? 0.5: 1.0, "charge", 2071+id);
message_begin(MSG_ONE,get_user_msgid("Flashlight"),{0,0,0},id);
write_byte(flashlight[id]);
write_byte(flashbattery[id]);
message_end();
set_pev(id, pev_effects, pev(id, pev_effects) & ~EF_DIMLIGHT);
}
public charge(id)
{
id -= 2071
if(flashlight[id])
flashbattery[id]--;
else
flashbattery[id]++;
message_begin(MSG_ONE,get_user_msgid("FlashBat"),{0,0,0},id);
write_byte(flashbattery[id]);
message_end();
if(flashbattery[id] <= 0)
{
flashbattery[id] = 0;
flashlight[id] = 0;
message_begin(MSG_ONE,get_user_msgid("Flashlight"),{0,0,0},id);
write_byte(flashlight[id]);
write_byte(flashbattery[id]);
message_end();
}
else if(flashbattery[id] >= get_cvar_num("cod_mag_render"))
{
flashbattery[id] = get_cvar_num("cod_mag_render");
return;
}
set_task(flashlight[id]? 0.5: 1.0,"charge", 2071+id)
}
/* Long Jumpy ===================================================================================== */
public Prethink_froglegs(id)
{
if(!a_long[id])
return PLUGIN_CONTINUE
if (get_user_button(id) & IN_DUCK)
{
if (player_b_froglegs[id] == 1)
{
player_b_froglegs[id] = floatround(halflife_time())
}
else
{
if (floatround(halflife_time())-player_b_froglegs[id] >= 3.0)
{
new Float:fl_iNewVelocity[3]
VelocityByAim(id, 1000, fl_iNewVelocity)
fl_iNewVelocity[2] = 210.0
entity_set_vector(id, EV_VEC_velocity, fl_iNewVelocity)
player_b_froglegs[id] = 1
}
}
}
else
{
player_b_froglegs[id] = 1
}
}
/* Odpornosc na FB ================================================================================ */
public messageScreenFade(msgtype, msgid, id)
{
if(a_odpornosc_fb[id]) return PLUGIN_HANDLED;
return PLUGIN_CONTINUE;
}
/* Teleport ======================================================================================= */
public cod_class_skill_used(id)
{
if (!uzyl[id]==false)
{
client_print(id, print_center, "Teleport mozna uzywac co 10s");
return PLUGIN_CONTINUE;
}
if(uzyl[id] || !is_user_alive(id))
return PLUGIN_CONTINUE;
new Float:start[3], Float:view_ofs[3];
pev(id, pev_origin, start);
pev(id, pev_view_ofs, view_ofs);
xs_vec_add(start, view_ofs, start);
new Float:dest[3];
pev(id, pev_v_angle, dest);
engfunc(EngFunc_MakeVectors, dest);
global_get(glb_v_forward, dest);
xs_vec_mul_scalar(dest, 999.0, dest);
xs_vec_add(start, dest, dest);
engfunc(EngFunc_TraceLine, start, dest, 0, id, 0);
new Float:fDstOrigin[3];
get_tr2(0, TR_vecEndPos, fDstOrigin);
if(engfunc(EngFunc_PointContents, fDstOrigin) == CONTENTS_SKY)
return PLUGIN_CONTINUE;
new Float:fNormal[3];
get_tr2(0, TR_vecPlaneNormal, fNormal);
xs_vec_mul_scalar(fNormal, 50.0, fNormal);
xs_vec_add(fDstOrigin, fNormal, fDstOrigin);
set_pev(id, pev_origin, fDstOrigin);
uzyl[id] = true;
set_task ( 10.0, "ResetHUD", id )
}
/* Szybsze przeladoawnie ========================================================================== */
public CmdStart(id, uc_handle)
{
if(!is_user_alive(id) || !a_przeladowanie[id])
return FMRES_IGNORED;
new buttons = get_uc(uc_handle, UC_Buttons);
new oldbuttons = pev(id, pev_oldbuttons);
new clip, ammo, weapon = get_user_weapon(id, clip, ammo);
if(max_clip[weapon] == -1 || !ammo)
return FMRES_IGNORED;
if((buttons & IN_RELOAD && !(oldbuttons & IN_RELOAD) && !(buttons & IN_ATTACK)) || !clip)
{
cs_set_user_bpammo(id, weapon, ammo-(max_clip[weapon]-clip));
new new_ammo = (max_clip[weapon] > ammo)? clip+ammo: max_clip[weapon]
set_user_clip(id, new_ammo);
}
return FMRES_IGNORED;
}
/* ================================================================================================ */