// Bonus Box v2 - Ethereal Entegrasyonu
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#include <hlsdk_const>
#include <fakemeta>
#include <fun>
#include <engine>
#include <fakemeta_util>
#define PLUGIN "Bonus Box v2 + Ethereal"
#define VERSION "1.1"
#define AUTHOR "MegastorM"
#define TASK_BONUS 1234
new modell[] = { "models/supplybox.mdl" }
new const szPrefix[15] = "Nostalji Gamers"
new g_sprite
new Float:OriginZrtve[3], Float:Uglovi[3];
new bool:HasEthereal[33];
new const Model_Ethereal[] = "models/v_ethereal2.mdl";
new const Model_Ethereal_P[] = "models/p_ethereal.mdl";
new BoxTime;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("DeathMsg", "event_death", "ade");
register_touch("BonusBox", "player", "touchbox");
register_event("CurWeapon", "HookCurWeapon", "be", "1=1");
BoxTime = register_cvar("boxtime", "20.0");
}
public plugin_precache()
{
precache_model(modell)
g_sprite = precache_model("sprites/box_sprite.spr")
precache_sound("trbox/supplybox.wav")
precache_sound("trbox/touched.wav")
precache_model(Model_Ethereal);
precache_model(Model_Ethereal_P);
}
public client_putinserver(id) HasEthereal[id] = false;
public client_disconnected(id) HasEthereal[id] = false;
public event_death()
{
new Kurban = read_data(2);
if(is_user_connected(Kurban))
{
get_origin(Kurban);
switch(random_num(1, 4)) {
case 1: set_task(0.1,"create_bonusbox",TASK_BONUS);
}
}
HasEthereal[Kurban] = false;
}
public HookCurWeapon(id)
{
new weapon = read_data(2);
if(weapon == CSW_M4A1 && HasEthereal[id]) {
set_pev(id, pev_viewmodel2, Model_Ethereal);
set_pev(id, pev_weaponmodel2, Model_Ethereal_P);
cs_set_user_bpammo(id, CSW_M4A1, 999);
}
}
public kapa_noclip(id)
{
set_user_noclip(id, 0)
}
public get_origin(id)
{
pev(id, pev_origin, OriginZrtve)
pev(id, pev_angles, Uglovi)
Uglovi[0] = 0.0
}
public create_bonusbox()
{
new ent = create_entity("info_target")
set_task(get_pcvar_float(BoxTime), "remove_ent");
entity_set_origin(ent, OriginZrtve)
entity_set_string(ent, EV_SZ_classname, "BonusBox")
entity_set_model(ent, modell)
set_rendering ( ent, kRenderFxGlowShell, random_num(128,255),random_num(128,255),random_num(128,255), kRenderFxNone, 255 )
emit_sound(ent, CHAN_ITEM, "box/supplybox.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
entity_set_int(ent, EV_INT_solid, SOLID_BBOX)
entity_set_int(ent, EV_INT_movetype, MOVETYPE_PUSHSTEP)
entity_set_size(ent,Float:{-2.0,-2.0,-2.0},Float:{5.0,5.0,5.0})
drop_to_floor(ent)
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, OriginZrtve, 0)
write_byte(TE_BEAMCYLINDER)
engfunc(EngFunc_WriteCoord, OriginZrtve[0])
engfunc(EngFunc_WriteCoord, OriginZrtve[1])
engfunc(EngFunc_WriteCoord, OriginZrtve[2])
engfunc(EngFunc_WriteCoord, OriginZrtve[0])
engfunc(EngFunc_WriteCoord, OriginZrtve[1])
engfunc(EngFunc_WriteCoord, OriginZrtve[2]+385.0)
write_short(g_sprite)
write_byte(0)
write_byte(0)
write_byte(4)
write_byte(30)
write_byte(0)
write_byte(250)
write_byte(0)
write_byte(0)
write_byte(200)
write_byte(0)
message_end()
}
public touchbox(ent, id)
{
if (!is_user_alive(id) || !pev_valid(ent)) return FMRES_IGNORED;
new classname[32]
pev(ent, pev_classname, classname, 31)
if (!equal(classname, "BonusBox")) return FMRES_IGNORED;
switch(random_num(1, 4))
{
case 1: {
fm_set_user_health(id, get_user_health(id)+25)
client_print_color(id, id, "^4%s: ^1+25 Saglik Kazandin", szPrefix)
}
case 2: {
cs_set_user_money(id, cs_get_user_money(id)+2000)
client_print_color(id, id, "^4%s: +2000$ Kazandin.", szPrefix)
}
case 3: {
give_item(id, "weapon_hegrenade")
client_print_color(id, id, "^1[^3%s^1] ^4Kutudan ^3El Bombasi ^4Cikti", szPrefix);
}
case 4: {
give_item(id, "weapon_m4a1")
cs_set_user_bpammo(id, CSW_M4A1, 999)
client_print_color(id, id, "^1[^3%s^1] ^4Kutudan ^3Ethereal ^4Cikti!", szPrefix);
HasEthereal[id] = true;
client_cmd(id, "weapon_m4a1")
}
}
emit_sound(id, CHAN_ITEM, "box/touched.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
set_pev(ent, pev_effects, EF_NODRAW)
set_pev(ent, pev_solid, SOLID_NOT)
remove_ent(ent)
return FMRES_IGNORED
}
public remove_ent(ent)
{
if (pev_valid(ent)) engfunc(EngFunc_RemoveEntity, ent)
}