Salut ! As dori un plugin care sa inlocuiasca HeGrenade cu FireNade ; Smoke cu Frost Nade si Flash-ul cu SFNade .
Uita-ti niste coduri de la care sa porniti :
FireNade :
Spoiler
#define TASK_BURNING 6345
#define weapon_firenade "weapon_hegrenade"
#define CSW_FIRENADE CSW_HEGRENADE
enum FireNadeData {
FIRENADE_NAME = 0,
FIRENADE_LEVEL,
FIRENADE_DAMAGE,
FIRENADE_RADIUS,
FIRENADE_BURNDAMAGE
}
new WPN_FIRENADE[FireNadeData][] = {
/*Name*/ "Fire Grenade",
/*Level*/ "0",
/*Damage*/ "100",
/*Radius*/ "300",
/*Burn Damage*/ "4"
},
FireNadeModel_V[] = "models/Furien40/v_firenade.mdl",
FireNadeModel_P[] = "models/Furien40/p_firenade.mdl",
FireNadeModel_W[] = "models/Furien40/w_firenade.mdl",
FireNade_WeaponList[] = "weapon_hegrenade",
FireNade_Sound[][] = {
"weapons/hegrenade-1.wav",
"scientist/sci_fear8.wav",
"scientist/sci_pain1.wav",
"scientist/scream02.wav"
},
/*
FireNade_Generic[][] = {
"sprites/furien40_firenade.txt",
"sprites/Furien40/firenade.spr"
},
*/
FireNadeID, firenade_event,
firenade_trail, firenade_explode, firenade_gib, firenade_wave, firenade_fire, firenade_smoke;
FireNade_Init() {
FireNadeID = RegisterGrenade(WPN_FIRENADE[FIRENADE_NAME], WPN_TEAM_CT, WPN_ACCES_ALL, WPN_FIRENADE[FIRENADE_LEVEL], weapon_firenade, CSW_FIRENADE, FireNade_WeaponList)
if(FireNadeID) {
register_clcmd(FireNade_WeaponList, "Hook_FireNade");
register_message(MSGID_CurWeapon, "FireNade_CurWeapon")
register_event("CurWeapon", "FireNade_ViewModel", "be", "1=1");
register_event("WeapPickup", "FireNade_ViewModel","be", "1=19");
register_forward(FM_SetModel, "FireNade_WorldModel", 1);
register_forward(FM_UpdateClientData, "FireNade_UpdateClientData", 1);
register_forward(FM_PlaybackEvent, "FireNade_PlaybackEvent");
RegisterHam(Ham_Item_AddToPlayer, weapon_firenade, "FireNade_AddToPlayer");
RegisterHam(Ham_Item_Deploy , weapon_firenade, "FireNade_Deploy_Post", 1);
RegisterHam(Ham_Think, "grenade", "FireNade_Think")
}
}
FireNade_Precache() {
firenade_trail = engfunc(EngFunc_PrecacheModel, "sprites/ef_shockwave.spr")
firenade_explode = engfunc(EngFunc_PrecacheModel, "sprites/Furien40/fire_explode.spr")
firenade_gib = engfunc(EngFunc_PrecacheModel, "sprites/Furien40/fire_gib.spr")
firenade_wave = engfunc(EngFunc_PrecacheModel, "sprites/ef_shockwave.spr")
firenade_fire = engfunc(EngFunc_PrecacheModel, "sprites/Furien40/firenade_fire.spr")
firenade_smoke = engfunc(EngFunc_PrecacheModel, "sprites/black_smoke4.spr")
register_forward(FM_PrecacheEvent, "FireNade_PrecacheEvent_Post", 1);
precache_model(FireNadeModel_V);
precache_model(FireNadeModel_P);
precache_model(FireNadeModel_W);
for(new i = 0; i < sizeof(FireNade_Sound); i++)
engfunc(EngFunc_PrecacheSound, FireNade_Sound[i]);
/*for(new i = 0; i < sizeof(FireNade_Generic); i++)
engfunc(EngFunc_PrecacheGeneric, FireNade_Generic[i]);*/
}
FireNade_Natives() {
register_native("get_user_firenade", "get_user_firenade", 1);
register_native("set_user_firenade", "set_user_firenade", 1);
register_native("set_user_fire", "set_user_fire", 1);
register_native("firenade_id", "firenade_id", 1);
}
public FireNade_CurWeapon(msg_id, msg_dest, id) {
new Weapon = get_msg_arg_int(2);
if(is_user_alive(id) && Weapon == CSW_FIRENADE && get_user_weapon(id) == CSW_FIRENADE && get_user_firenade(id))
set_msg_arg_int(3, ARG_BYTE, -1)
}
public FireNade_ViewModel(id) {
if(is_user_alive(id) && get_user_weapon(id) == CSW_FIRENADE && get_user_firenade(id)) {
new VModel[128], PModel[128];
pev(id, pev_viewmodel2, VModel, 127),
pev(id, pev_weaponmodel2, PModel, 127);
if(!equal(VModel, FireNadeModel_V))
set_pev(id, pev_viewmodel2, FireNadeModel_V);
if(!equal(PModel, FireNadeModel_P))
set_pev(id, pev_weaponmodel2, FireNadeModel_P);
}
}
public FireNade_WorldModel(entity, model[]) {
if(is_valid_ent(entity)) {
static ClassName[33];
entity_get_string(entity, EV_SZ_classname, ClassName, charsmax(ClassName));
if(equal(ClassName, "grenade") && entity_get_int(entity, EV_INT_WeaponKey) == FireNadeID) {
entity_set_model(entity, FireNadeModel_W);
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW)
write_short(entity)
write_short(firenade_trail)
write_byte(5)
write_byte(5)
write_byte(200)
write_byte(0)
write_byte(0)
write_byte(200)
message_end()
}
}
return FMRES_IGNORED;
}
public FireNade_UpdateClientData(id, sendweapons, cd_handle) {
if(is_user_alive(id) && is_user_connected(id) && get_user_weapon(id) == CSW_FIRENADE && get_user_firenade(id))
set_cd(cd_handle, CD_flNextAttack, halflife_time() + 0.001);
return FMRES_IGNORED;
}
public FireNade_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2) {
if(is_user_connected(invoker) && eventid == firenade_event)
playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2);
return FMRES_IGNORED;
}
public FireNade_PrecacheEvent_Post(type, const name[]) {
if (equal("events/hegrenade.sc", name))
firenade_event = get_orig_retval();
return FMRES_IGNORED;
}
public FireNade_AddToPlayer(Weapon, id) {
if(pev_valid(Weapon) && is_user_alive(id) && entity_get_int(Weapon, EV_INT_WeaponKey) == FireNadeID)
WeaponList(id, CSW_FIRENADE, FireNade_WeaponList, 0)
else if(pev_valid(Weapon) && is_user_alive(id) && entity_get_int(id, EV_INT_WeaponKey) == FireNadeID) {
entity_set_int(Weapon, EV_INT_WeaponKey, FireNadeID)
ColorChat(id, "!t[!g%s!t]!g Damage:!t %s!g Radius:!t %s!g Burn Damage:!t %s", WPN_FIRENADE[FIRENADE_NAME], WPN_FIRENADE[FIRENADE_DAMAGE], WPN_FIRENADE[FIRENADE_RADIUS], WPN_FIRENADE[FIRENADE_BURNDAMAGE])
}
return HAM_IGNORED;
}
public FireNade_Deploy_Post(Weapon) {
if(pev_valid(Weapon)) {
new Owner = get_pdata_cbase(Weapon, 41, 4);
if(is_user_alive(Owner) && entity_get_int(Weapon, EV_INT_WeaponKey) == FireNadeID) {
set_pev(Owner, pev_viewmodel2, FireNadeModel_V);
set_pev(Owner, pev_weaponmodel2, FireNadeModel_P);
set_weapon_anim(Owner, 3)
set_pdata_float(Owner, 83, 0.7, 5);
set_pdata_float(Weapon, 48, 0.7, 4)
}
}
return HAM_IGNORED;
}
public FireNade_Think(FireNade) {
if(pev_valid(FireNade)) {
if(pev(FireNade, pev_dmgtime) < get_gametime() && entity_get_int(FireNade, EV_INT_WeaponKey) == FireNadeID) {
new Float:GrenadeOrigin[3], Victim = -1,
id = pev(FireNade, pev_owner)
pev(FireNade, pev_origin, GrenadeOrigin)
engfunc(EngFunc_EmitSound, FireNade, CHAN_WEAPON, FireNade_Sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_EXPLOSION)
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+75) // z axis
write_short(firenade_explode)
write_byte(22)
write_byte(17)
write_byte(TE_EXPLFLAG_NOSOUND)
message_end()
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_WORLDDECAL)
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0])
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1])
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2])
write_byte(random_num(46, 48))
message_end()
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_DLIGHT);
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]); // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]); // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]); // z
write_byte(floatround(str_to_float(WPN_FIRENADE[FIRENADE_RADIUS])/10.0)); // radius
write_byte(200) // red
write_byte(0) // green
write_byte(0) // blue
write_byte(15); // life
write_byte(15); // decay rate
message_end();
engfunc(EngFunc_MessageBegin, MSG_BROADCAST ,SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_SPRITETRAIL) // TE ID
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+100) // z axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z axis
write_short(firenade_gib) // Sprite Index
write_byte(100) // Count
write_byte(20) // Life
write_byte(2) // Scale
write_byte(50) // Velocity Along Vector
write_byte(10) // Rendomness of Velocity
message_end();
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+100.0) // z axis
write_short(firenade_wave) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(5) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(200) // red
write_byte(0) // green
write_byte(0) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+200.0) // z axis
write_short(firenade_wave) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(5) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(200) // red
write_byte(50) // green
write_byte(0) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+300.0) // z axis
write_short(firenade_wave) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(5) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(200) // red
write_byte(100) // green
write_byte(0) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
while((Victim = find_ent_in_sphere(Victim, GrenadeOrigin, str_to_float(WPN_FIRENADE[FIRENADE_RADIUS]))) != 0) {
if(is_user_connected(Victim) && is_user_alive(Victim) && get_user_team(id) != get_user_team(Victim)) {
new Float:VictimOrigin[3], Float:Distance, Float:DistanceRatio, Float:Damage;
pev(Victim, pev_origin, VictimOrigin);
Distance = get_distance_f(GrenadeOrigin, VictimOrigin);
DistanceRatio = floatdiv(Distance, str_to_float(WPN_FIRENADE[FIRENADE_RADIUS]));
Damage = str_to_float(WPN_FIRENADE[FIRENADE_DAMAGE]) - floatround(floatmul(str_to_float(WPN_FIRENADE[FIRENADE_DAMAGE]), DistanceRatio));
make_blood(Victim, floatround(Damage))
if(get_user_health(Victim) > Damage) {
ExecuteHam(Ham_TakeDamage, Victim, id, id, Damage, (1<<24));
new Parm[3];
Parm[0] = id, Parm[1] = Victim, Parm[2] = 15;
FireNade_Burning(Parm);
}
else
death_message(id, Victim, "firenade");
}
}
engfunc(EngFunc_RemoveEntity, FireNade);
return HAM_SUPERCEDE;
}
}
return HAM_IGNORED;
}
public FireNade_Burning(args[3]) {
new id = args[0],
victim = args[1]
if(is_user_connected(victim) && is_user_alive(victim) && get_user_team(id) != get_user_team(victim) && !(pev(victim, pev_flags) & FL_INWATER)) {
new Float:Origin[3]
pev(victim, pev_origin, Origin)
if(args[2] > 0) {
new Float:Damage = str_to_float(WPN_FIRENADE[FIRENADE_BURNDAMAGE])
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Origin, 0)
write_byte(TE_SPRITE) // TE id
engfunc(EngFunc_WriteCoord, Origin[0]) // x
engfunc(EngFunc_WriteCoord, Origin[1]) // y
engfunc(EngFunc_WriteCoord, Origin[2]) // z
write_short(firenade_fire) // sprite
write_byte(random_num(5, 10)) // scale
write_byte(200) // brightness
message_end()
if(get_user_health(victim) > Damage) {
args[2]--;
set_task(0.2, "FireNade_Burning", victim + TASK_BURNING, args, 3)
ExecuteHam(Ham_TakeDamage, victim, id, id, Damage, DMG_SLOWBURN);
}
else
death_message(id, victim, "firenade");
}
else {
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Origin, 0)
write_byte(TE_SMOKE) // TE id
engfunc(EngFunc_WriteCoord, Origin[0]) // x
engfunc(EngFunc_WriteCoord, Origin[1]) // y
engfunc(EngFunc_WriteCoord, Origin[2]-50.0) // z
write_short(firenade_smoke) // sprite
write_byte(random_num(15, 20)) // scale
write_byte(random_num(10, 20)) // framerate
message_end()
}
}
}
public Hook_FireNade(id) {
engclient_cmd(id, weapon_firenade);
return PLUGIN_HANDLED
}
public set_user_fire(attacker, victim) {
new Parm[3];
Parm[0] = attacker, Parm[1] = victim, Parm[2] = 15;
FireNade_Burning(Parm);
}
public get_user_firenade(id)
return get_weapon(id, weapon_firenade, CSW_FIRENADE, FireNadeID)
public set_user_firenade(id)
return set_weapon(id, WPN_GRENADE, FireNadeID)
public firenade_id()
return FireNadeID
#define weapon_firenade "weapon_hegrenade"
#define CSW_FIRENADE CSW_HEGRENADE
enum FireNadeData {
FIRENADE_NAME = 0,
FIRENADE_LEVEL,
FIRENADE_DAMAGE,
FIRENADE_RADIUS,
FIRENADE_BURNDAMAGE
}
new WPN_FIRENADE[FireNadeData][] = {
/*Name*/ "Fire Grenade",
/*Level*/ "0",
/*Damage*/ "100",
/*Radius*/ "300",
/*Burn Damage*/ "4"
},
FireNadeModel_V[] = "models/Furien40/v_firenade.mdl",
FireNadeModel_P[] = "models/Furien40/p_firenade.mdl",
FireNadeModel_W[] = "models/Furien40/w_firenade.mdl",
FireNade_WeaponList[] = "weapon_hegrenade",
FireNade_Sound[][] = {
"weapons/hegrenade-1.wav",
"scientist/sci_fear8.wav",
"scientist/sci_pain1.wav",
"scientist/scream02.wav"
},
/*
FireNade_Generic[][] = {
"sprites/furien40_firenade.txt",
"sprites/Furien40/firenade.spr"
},
*/
FireNadeID, firenade_event,
firenade_trail, firenade_explode, firenade_gib, firenade_wave, firenade_fire, firenade_smoke;
FireNade_Init() {
FireNadeID = RegisterGrenade(WPN_FIRENADE[FIRENADE_NAME], WPN_TEAM_CT, WPN_ACCES_ALL, WPN_FIRENADE[FIRENADE_LEVEL], weapon_firenade, CSW_FIRENADE, FireNade_WeaponList)
if(FireNadeID) {
register_clcmd(FireNade_WeaponList, "Hook_FireNade");
register_message(MSGID_CurWeapon, "FireNade_CurWeapon")
register_event("CurWeapon", "FireNade_ViewModel", "be", "1=1");
register_event("WeapPickup", "FireNade_ViewModel","be", "1=19");
register_forward(FM_SetModel, "FireNade_WorldModel", 1);
register_forward(FM_UpdateClientData, "FireNade_UpdateClientData", 1);
register_forward(FM_PlaybackEvent, "FireNade_PlaybackEvent");
RegisterHam(Ham_Item_AddToPlayer, weapon_firenade, "FireNade_AddToPlayer");
RegisterHam(Ham_Item_Deploy , weapon_firenade, "FireNade_Deploy_Post", 1);
RegisterHam(Ham_Think, "grenade", "FireNade_Think")
}
}
FireNade_Precache() {
firenade_trail = engfunc(EngFunc_PrecacheModel, "sprites/ef_shockwave.spr")
firenade_explode = engfunc(EngFunc_PrecacheModel, "sprites/Furien40/fire_explode.spr")
firenade_gib = engfunc(EngFunc_PrecacheModel, "sprites/Furien40/fire_gib.spr")
firenade_wave = engfunc(EngFunc_PrecacheModel, "sprites/ef_shockwave.spr")
firenade_fire = engfunc(EngFunc_PrecacheModel, "sprites/Furien40/firenade_fire.spr")
firenade_smoke = engfunc(EngFunc_PrecacheModel, "sprites/black_smoke4.spr")
register_forward(FM_PrecacheEvent, "FireNade_PrecacheEvent_Post", 1);
precache_model(FireNadeModel_V);
precache_model(FireNadeModel_P);
precache_model(FireNadeModel_W);
for(new i = 0; i < sizeof(FireNade_Sound); i++)
engfunc(EngFunc_PrecacheSound, FireNade_Sound[i]);
/*for(new i = 0; i < sizeof(FireNade_Generic); i++)
engfunc(EngFunc_PrecacheGeneric, FireNade_Generic[i]);*/
}
FireNade_Natives() {
register_native("get_user_firenade", "get_user_firenade", 1);
register_native("set_user_firenade", "set_user_firenade", 1);
register_native("set_user_fire", "set_user_fire", 1);
register_native("firenade_id", "firenade_id", 1);
}
public FireNade_CurWeapon(msg_id, msg_dest, id) {
new Weapon = get_msg_arg_int(2);
if(is_user_alive(id) && Weapon == CSW_FIRENADE && get_user_weapon(id) == CSW_FIRENADE && get_user_firenade(id))
set_msg_arg_int(3, ARG_BYTE, -1)
}
public FireNade_ViewModel(id) {
if(is_user_alive(id) && get_user_weapon(id) == CSW_FIRENADE && get_user_firenade(id)) {
new VModel[128], PModel[128];
pev(id, pev_viewmodel2, VModel, 127),
pev(id, pev_weaponmodel2, PModel, 127);
if(!equal(VModel, FireNadeModel_V))
set_pev(id, pev_viewmodel2, FireNadeModel_V);
if(!equal(PModel, FireNadeModel_P))
set_pev(id, pev_weaponmodel2, FireNadeModel_P);
}
}
public FireNade_WorldModel(entity, model[]) {
if(is_valid_ent(entity)) {
static ClassName[33];
entity_get_string(entity, EV_SZ_classname, ClassName, charsmax(ClassName));
if(equal(ClassName, "grenade") && entity_get_int(entity, EV_INT_WeaponKey) == FireNadeID) {
entity_set_model(entity, FireNadeModel_W);
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW)
write_short(entity)
write_short(firenade_trail)
write_byte(5)
write_byte(5)
write_byte(200)
write_byte(0)
write_byte(0)
write_byte(200)
message_end()
}
}
return FMRES_IGNORED;
}
public FireNade_UpdateClientData(id, sendweapons, cd_handle) {
if(is_user_alive(id) && is_user_connected(id) && get_user_weapon(id) == CSW_FIRENADE && get_user_firenade(id))
set_cd(cd_handle, CD_flNextAttack, halflife_time() + 0.001);
return FMRES_IGNORED;
}
public FireNade_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2) {
if(is_user_connected(invoker) && eventid == firenade_event)
playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2);
return FMRES_IGNORED;
}
public FireNade_PrecacheEvent_Post(type, const name[]) {
if (equal("events/hegrenade.sc", name))
firenade_event = get_orig_retval();
return FMRES_IGNORED;
}
public FireNade_AddToPlayer(Weapon, id) {
if(pev_valid(Weapon) && is_user_alive(id) && entity_get_int(Weapon, EV_INT_WeaponKey) == FireNadeID)
WeaponList(id, CSW_FIRENADE, FireNade_WeaponList, 0)
else if(pev_valid(Weapon) && is_user_alive(id) && entity_get_int(id, EV_INT_WeaponKey) == FireNadeID) {
entity_set_int(Weapon, EV_INT_WeaponKey, FireNadeID)
ColorChat(id, "!t[!g%s!t]!g Damage:!t %s!g Radius:!t %s!g Burn Damage:!t %s", WPN_FIRENADE[FIRENADE_NAME], WPN_FIRENADE[FIRENADE_DAMAGE], WPN_FIRENADE[FIRENADE_RADIUS], WPN_FIRENADE[FIRENADE_BURNDAMAGE])
}
return HAM_IGNORED;
}
public FireNade_Deploy_Post(Weapon) {
if(pev_valid(Weapon)) {
new Owner = get_pdata_cbase(Weapon, 41, 4);
if(is_user_alive(Owner) && entity_get_int(Weapon, EV_INT_WeaponKey) == FireNadeID) {
set_pev(Owner, pev_viewmodel2, FireNadeModel_V);
set_pev(Owner, pev_weaponmodel2, FireNadeModel_P);
set_weapon_anim(Owner, 3)
set_pdata_float(Owner, 83, 0.7, 5);
set_pdata_float(Weapon, 48, 0.7, 4)
}
}
return HAM_IGNORED;
}
public FireNade_Think(FireNade) {
if(pev_valid(FireNade)) {
if(pev(FireNade, pev_dmgtime) < get_gametime() && entity_get_int(FireNade, EV_INT_WeaponKey) == FireNadeID) {
new Float:GrenadeOrigin[3], Victim = -1,
id = pev(FireNade, pev_owner)
pev(FireNade, pev_origin, GrenadeOrigin)
engfunc(EngFunc_EmitSound, FireNade, CHAN_WEAPON, FireNade_Sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_EXPLOSION)
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+75) // z axis
write_short(firenade_explode)
write_byte(22)
write_byte(17)
write_byte(TE_EXPLFLAG_NOSOUND)
message_end()
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_WORLDDECAL)
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0])
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1])
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2])
write_byte(random_num(46, 48))
message_end()
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_DLIGHT);
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]); // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]); // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]); // z
write_byte(floatround(str_to_float(WPN_FIRENADE[FIRENADE_RADIUS])/10.0)); // radius
write_byte(200) // red
write_byte(0) // green
write_byte(0) // blue
write_byte(15); // life
write_byte(15); // decay rate
message_end();
engfunc(EngFunc_MessageBegin, MSG_BROADCAST ,SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_SPRITETRAIL) // TE ID
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+100) // z axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z axis
write_short(firenade_gib) // Sprite Index
write_byte(100) // Count
write_byte(20) // Life
write_byte(2) // Scale
write_byte(50) // Velocity Along Vector
write_byte(10) // Rendomness of Velocity
message_end();
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+100.0) // z axis
write_short(firenade_wave) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(5) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(200) // red
write_byte(0) // green
write_byte(0) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+200.0) // z axis
write_short(firenade_wave) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(5) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(200) // red
write_byte(50) // green
write_byte(0) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+300.0) // z axis
write_short(firenade_wave) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(5) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(200) // red
write_byte(100) // green
write_byte(0) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
while((Victim = find_ent_in_sphere(Victim, GrenadeOrigin, str_to_float(WPN_FIRENADE[FIRENADE_RADIUS]))) != 0) {
if(is_user_connected(Victim) && is_user_alive(Victim) && get_user_team(id) != get_user_team(Victim)) {
new Float:VictimOrigin[3], Float:Distance, Float:DistanceRatio, Float:Damage;
pev(Victim, pev_origin, VictimOrigin);
Distance = get_distance_f(GrenadeOrigin, VictimOrigin);
DistanceRatio = floatdiv(Distance, str_to_float(WPN_FIRENADE[FIRENADE_RADIUS]));
Damage = str_to_float(WPN_FIRENADE[FIRENADE_DAMAGE]) - floatround(floatmul(str_to_float(WPN_FIRENADE[FIRENADE_DAMAGE]), DistanceRatio));
make_blood(Victim, floatround(Damage))
if(get_user_health(Victim) > Damage) {
ExecuteHam(Ham_TakeDamage, Victim, id, id, Damage, (1<<24));
new Parm[3];
Parm[0] = id, Parm[1] = Victim, Parm[2] = 15;
FireNade_Burning(Parm);
}
else
death_message(id, Victim, "firenade");
}
}
engfunc(EngFunc_RemoveEntity, FireNade);
return HAM_SUPERCEDE;
}
}
return HAM_IGNORED;
}
public FireNade_Burning(args[3]) {
new id = args[0],
victim = args[1]
if(is_user_connected(victim) && is_user_alive(victim) && get_user_team(id) != get_user_team(victim) && !(pev(victim, pev_flags) & FL_INWATER)) {
new Float:Origin[3]
pev(victim, pev_origin, Origin)
if(args[2] > 0) {
new Float:Damage = str_to_float(WPN_FIRENADE[FIRENADE_BURNDAMAGE])
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Origin, 0)
write_byte(TE_SPRITE) // TE id
engfunc(EngFunc_WriteCoord, Origin[0]) // x
engfunc(EngFunc_WriteCoord, Origin[1]) // y
engfunc(EngFunc_WriteCoord, Origin[2]) // z
write_short(firenade_fire) // sprite
write_byte(random_num(5, 10)) // scale
write_byte(200) // brightness
message_end()
if(get_user_health(victim) > Damage) {
args[2]--;
set_task(0.2, "FireNade_Burning", victim + TASK_BURNING, args, 3)
ExecuteHam(Ham_TakeDamage, victim, id, id, Damage, DMG_SLOWBURN);
}
else
death_message(id, victim, "firenade");
}
else {
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Origin, 0)
write_byte(TE_SMOKE) // TE id
engfunc(EngFunc_WriteCoord, Origin[0]) // x
engfunc(EngFunc_WriteCoord, Origin[1]) // y
engfunc(EngFunc_WriteCoord, Origin[2]-50.0) // z
write_short(firenade_smoke) // sprite
write_byte(random_num(15, 20)) // scale
write_byte(random_num(10, 20)) // framerate
message_end()
}
}
}
public Hook_FireNade(id) {
engclient_cmd(id, weapon_firenade);
return PLUGIN_HANDLED
}
public set_user_fire(attacker, victim) {
new Parm[3];
Parm[0] = attacker, Parm[1] = victim, Parm[2] = 15;
FireNade_Burning(Parm);
}
public get_user_firenade(id)
return get_weapon(id, weapon_firenade, CSW_FIRENADE, FireNadeID)
public set_user_firenade(id)
return set_weapon(id, WPN_GRENADE, FireNadeID)
public firenade_id()
return FireNadeID
FrostNade:
Spoiler
#define FROSTNADE_CLASS "iceblock"
#define weapon_frostnade "weapon_smokegrenade"
#define CSW_FROSTNADE CSW_SMOKEGRENADE
enum FrostNadeData {
FROSTNADE_NAME = 0,
FROSTNADE_LEVEL,
FROSTNADE_DAMAGE,
FROSTNADE_RADIUS,
FROSTNADE_DURATION
}
new WPN_FROSTNADE[FrostNadeData][] = {
/*Name*/ "Frost Grenade",
/*Level*/ "0",
/*Damage*/ "100",
/*Radius*/ "300",
/*Duration*/ "5"
},
FrostNadeModel_V[] = "models/Furien40/v_frostnade.mdl",
FrostNadeModel_P[] = "models/Furien40/p_frostnade.mdl",
FrostNadeModel_W[] = "models/Furien40/w_frostnade.mdl",
FrostNadeModel_ICE[] = "models/Furien40/iceblock.mdl",
FrostNade_WeaponList[] = "weapon_smokegrenade",
FrostNade_Sound[][] = {
"Furien40/frostnova.wav",
"Furien40/impalehit.wav",
"Furien40/impalelaunch1.wav"
},
/*
FrostNade_Generic[][] = {
"sprites/furien40_frostnade.txt",
"sprites/Furien40/frostnade.spr"
},
*/
FrostNadeID, Float:Frozen[33], Float:LastSpeed[33], frostnade_event,
frostnade_trail, frostnade_explode, frostnade_gib, frostnade_wave;
FrostNade_Init() {
FrostNadeID = RegisterGrenade(WPN_FROSTNADE[FROSTNADE_NAME], WPN_TEAM_CT, WPN_ACCES_ALL, WPN_FROSTNADE[FROSTNADE_LEVEL], weapon_frostnade, CSW_FROSTNADE, FrostNade_WeaponList)
if(FrostNadeID) {
register_clcmd(FrostNade_WeaponList, "Hook_FrostNade");
register_message(MSGID_CurWeapon, "FrostNade_CurWeapon")
register_event("CurWeapon", "FrostNade_ViewModel", "be", "1=1");
register_event("WeapPickup", "FrostNade_ViewModel","be", "1=19");
register_event("DeathMsg", "FrostNade_Death", "a");
register_forward(FM_SetModel, "FrostNade_WorldModel", 1);
register_forward(FM_UpdateClientData, "FrostNade_UpdateClientData", 1);
register_forward(FM_PlaybackEvent, "FrostNade_PlaybackEvent");
register_forward(FM_CmdStart, "FrostNade_CmdStart");
RegisterHam(Ham_Item_AddToPlayer, weapon_frostnade, "FrostNade_AddToPlayer");
RegisterHam(Ham_Item_Deploy , weapon_frostnade, "FrostNade_Deploy_Post", 1);
RegisterHam(Ham_Think, "grenade", "FrostNade_Think")
register_think(FROSTNADE_CLASS, "FrostNade_IceThink");
}
}
FrostNade_Precache() {
frostnade_trail = engfunc(EngFunc_PrecacheModel, "sprites/ef_shockwave.spr")
frostnade_explode = engfunc(EngFunc_PrecacheModel, "sprites/Furien40/frost_explode.spr")
frostnade_gib = engfunc(EngFunc_PrecacheModel, "sprites/Furien40/frost_gib.spr")
frostnade_wave = engfunc(EngFunc_PrecacheModel, "sprites/ef_shockwave.spr")
register_forward(FM_PrecacheEvent, "FrostNade_PrecacheEvent_Post", 1);
precache_model(FrostNadeModel_V);
precache_model(FrostNadeModel_P);
precache_model(FrostNadeModel_W);
precache_model(FrostNadeModel_ICE);
for(new i = 0; i < sizeof(FrostNade_Sound); i++)
engfunc(EngFunc_PrecacheSound, FrostNade_Sound[i]);
/*for(new i = 0; i < sizeof(FrostNade_Generic); i++)
engfunc(EngFunc_PrecacheGeneric, FrostNade_Generic[i]);*/
}
FrostNade_Natives() {
register_native("get_user_frostnade", "get_user_frostnade", 1);
register_native("set_user_frostnade", "set_user_frostnade", 1);
register_native("set_user_frost", "set_user_frost", 1);
register_native("frostnade_id", "frostnade_id", 1);
}
public FrostNade_CurWeapon(msg_id, msg_dest, id) {
new Weapon = get_msg_arg_int(2);
if(is_user_alive(id) && Weapon == CSW_FROSTNADE && get_user_weapon(id) == CSW_FROSTNADE && get_user_frostnade(id))
set_msg_arg_int(3, ARG_BYTE, -1)
}
public FrostNade_ViewModel(id) {
if(is_user_alive(id) && get_user_weapon(id) == CSW_FROSTNADE && get_user_frostnade(id)) {
new VModel[128], PModel[128];
pev(id, pev_viewmodel2, VModel, 127),
pev(id, pev_weaponmodel2, PModel, 127);
if(!equal(VModel, FrostNadeModel_V))
set_pev(id, pev_viewmodel2, FrostNadeModel_V);
if(!equal(PModel, FrostNadeModel_P))
set_pev(id, pev_weaponmodel2, FrostNadeModel_P);
}
}
public FrostNade_Death() {
if(is_user_connected(read_data(2)))
Frozen[read_data(2)] = 0.0
}
public FrostNade_WorldModel(entity, model[]) {
if(is_valid_ent(entity)) {
static ClassName[33];
entity_get_string(entity, EV_SZ_classname, ClassName, charsmax(ClassName));
if(equal(ClassName, "grenade") && entity_get_int(entity, EV_INT_WeaponKey) == FrostNadeID) {
entity_set_model(entity, FrostNadeModel_W);
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW)
write_short(entity)
write_short(frostnade_trail)
write_byte(5)
write_byte(5)
write_byte(0)
write_byte(0)
write_byte(200)
write_byte(200)
message_end()
}
}
return FMRES_IGNORED;
}
public FrostNade_UpdateClientData(id, sendweapons, cd_handle) {
if(is_user_alive(id) && is_user_connected(id) && get_user_weapon(id) == CSW_FROSTNADE && get_user_frostnade(id))
set_cd(cd_handle, CD_flNextAttack, halflife_time() + 0.001);
return FMRES_IGNORED;
}
public FrostNade_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2) {
if(is_user_connected(invoker) && eventid == frostnade_event)
playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2);
return FMRES_IGNORED;
}
public FrostNade_PrecacheEvent_Post(type, const name[]) {
if (equal("events/smokegrenade.sc", name))
frostnade_event = get_orig_retval();
return FMRES_IGNORED;
}
public FrostNade_CmdStart(id, uc_handle, seed) {
if(is_user_alive(id) && is_user_connected(id) && Frozen[id] > get_gametime()) {
new CurButton = get_uc(uc_handle, UC_Buttons);
if(CurButton & IN_JUMP) {
CurButton &= ~IN_JUMP;
set_uc(uc_handle, UC_Buttons, CurButton);
}
if(CurButton & IN_DUCK) {
CurButton &= ~IN_DUCK;
set_uc(uc_handle, UC_Buttons, CurButton);
}
}
}
public FrostNade_AddToPlayer(Weapon, id) {
if(pev_valid(Weapon) && is_user_alive(id) && entity_get_int(Weapon, EV_INT_WeaponKey) == FrostNadeID)
WeaponList(id, CSW_FROSTNADE, FrostNade_WeaponList, 0)
else if(pev_valid(Weapon) && is_user_alive(id) && entity_get_int(id, EV_INT_WeaponKey) == FrostNadeID) {
entity_set_int(Weapon, EV_INT_WeaponKey, FrostNadeID)
ColorChat(id, "!t[!g%s!t]!g Damage:!t %s!g Radius:!t %s!g Duration:!t %s", WPN_FROSTNADE[FROSTNADE_NAME], WPN_FROSTNADE[FROSTNADE_DAMAGE], WPN_FROSTNADE[FROSTNADE_RADIUS], WPN_FROSTNADE[FROSTNADE_DURATION])
}
return HAM_IGNORED;
}
public FrostNade_Deploy_Post(Weapon) {
if(pev_valid(Weapon)) {
new Owner = get_pdata_cbase(Weapon, 41, 4);
if(is_user_alive(Owner) && entity_get_int(Weapon, EV_INT_WeaponKey) == FrostNadeID) {
set_pev(Owner, pev_viewmodel2, FrostNadeModel_V);
set_pev(Owner, pev_weaponmodel2, FrostNadeModel_P);
set_weapon_anim(Owner, 3)
set_pdata_float(Owner, 83, 0.7, 5);
set_pdata_float(Weapon, 48, 0.7, 4)
}
}
return HAM_IGNORED;
}
public FrostNade_Think(FrostNade) {
if(pev_valid(FrostNade)) {
if(pev(FrostNade, pev_dmgtime) < get_gametime() && entity_get_int(FrostNade, EV_INT_WeaponKey) == FrostNadeID) {
new Float:GrenadeOrigin[3], Victim = -1,
id = pev(FrostNade, pev_owner)
pev(FrostNade, pev_origin, GrenadeOrigin)
engfunc(EngFunc_EmitSound, FrostNade, CHAN_WEAPON, FrostNade_Sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_EXPLOSION)
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+75) // z axis
write_short(frostnade_explode)
write_byte(22)
write_byte(17)
write_byte(TE_EXPLFLAG_NOSOUND)
message_end()
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_WORLDDECAL)
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0])
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1])
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2])
write_byte(random_num(46, 48))
message_end()
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_DLIGHT);
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]); // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]); // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]); // z
write_byte(floatround(str_to_float(WPN_FROSTNADE[FROSTNADE_RADIUS])/10.0)); // radius
write_byte(0) // red
write_byte(0) // green
write_byte(200) // blue
write_byte(15); // life
write_byte(15); // decay rate
message_end();
engfunc(EngFunc_MessageBegin, MSG_BROADCAST ,SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_SPRITETRAIL) // TE ID
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+100) // z axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z axis
write_short(frostnade_gib) // Sprite Index
write_byte(100) // Count
write_byte(20) // Life
write_byte(1) // Scale
write_byte(50) // Velocity Along Vector
write_byte(10) // Rendomness of Velocity
message_end();
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+100.0) // z axis
write_short(frostnade_wave) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(5) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(0) // red
write_byte(0) // green
write_byte(200) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+200.0) // z axis
write_short(frostnade_wave) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(5) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(0) // red
write_byte(50) // green
write_byte(200) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+300.0) // z axis
write_short(frostnade_wave) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(5) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(0) // red
write_byte(100) // green
write_byte(200) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
while((Victim = find_ent_in_sphere(Victim, GrenadeOrigin, str_to_float(WPN_FROSTNADE[FROSTNADE_RADIUS]))) != 0) {
if(is_user_connected(Victim) && is_user_alive(Victim) && get_user_team(id) != get_user_team(Victim)) {
new Float:VictimOrigin[3], Float:Distance, Float:DistanceRatio, Float:Damage;
pev(Victim, pev_origin, VictimOrigin);
Distance = get_distance_f(GrenadeOrigin, VictimOrigin);
DistanceRatio = floatdiv(Distance, str_to_float(WPN_FROSTNADE[FROSTNADE_RADIUS]));
Damage = str_to_float(WPN_FROSTNADE[FROSTNADE_DAMAGE]) - floatround(floatmul(str_to_float(WPN_FROSTNADE[FROSTNADE_DAMAGE]), DistanceRatio));
make_blood(Victim, floatround(Damage))
if(get_user_health(Victim) > Damage) {
ExecuteHam(Ham_TakeDamage, Victim, id, id, Damage, (1<<24));
set_user_frost(Victim)
}
else
death_message(id, Victim, "frostnade");
}
}
engfunc(EngFunc_RemoveEntity, FrostNade);
return HAM_SUPERCEDE;
}
}
return HAM_IGNORED;
}
public FrostNade_IceThink(Ice) {
if(pev_valid(Ice)) {
new id = pev(Ice, pev_owner)
if(Frozen[id] < get_gametime()) {
engfunc(EngFunc_RemoveEntity, Ice);
set_pev(id, pev_maxspeed, LastSpeed[id])
}
else {
if(is_user_alive(id)) {
new Float:VictimOrigin[3]
pev(id, pev_origin, VictimOrigin);
engfunc(EngFunc_SetOrigin, Ice, VictimOrigin);
set_pev(id, pev_maxspeed, 0.1)
}
set_pev(Ice, pev_nextthink, get_gametime() + 0.1);
}
}
}
public Hook_FrostNade(id) {
engclient_cmd(id, weapon_frostnade);
return PLUGIN_HANDLED
}
public set_user_frost(victim) {
if(is_user_alive(victim)) {
set_pev(victim, pev_velocity, Float:{0.0,0.0,0.0})
pev(victim, pev_maxspeed, LastSpeed[victim])
set_pev(victim, pev_maxspeed, 0.1)
Frozen[victim] = get_gametime() + str_to_float(WPN_FROSTNADE[FROSTNADE_DURATION]);
new Ice = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
if(pev_valid(Ice)) {
new Float:VictimOrigin[3]
pev(victim, pev_origin, VictimOrigin);
VictimOrigin[2] -= 40
set_pev(Ice, pev_classname, FROSTNADE_CLASS);
set_pev(Ice, pev_owner, victim);
set_pev(Ice, pev_solid, SOLID_NOT);
set_pev(Ice, pev_movetype, MOVETYPE_TOSS);
VictimOrigin[2] -= 40.0
engfunc(EngFunc_SetOrigin, Ice, VictimOrigin);
engfunc(EngFunc_SetModel, Ice, FrostNadeModel_ICE);
fm_set_user_rendering(Ice, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 10);
set_pev(Ice, pev_nextthink, get_gametime() + 0.1);
}
}
}
public get_user_frostnade(id)
return get_weapon(id, weapon_frostnade, CSW_FROSTNADE, FrostNadeID)
public set_user_frostnade(id)
return set_weapon(id, WPN_GRENADE, FrostNadeID)
public frostnade_id()
return FrostNadeID
#define weapon_frostnade "weapon_smokegrenade"
#define CSW_FROSTNADE CSW_SMOKEGRENADE
enum FrostNadeData {
FROSTNADE_NAME = 0,
FROSTNADE_LEVEL,
FROSTNADE_DAMAGE,
FROSTNADE_RADIUS,
FROSTNADE_DURATION
}
new WPN_FROSTNADE[FrostNadeData][] = {
/*Name*/ "Frost Grenade",
/*Level*/ "0",
/*Damage*/ "100",
/*Radius*/ "300",
/*Duration*/ "5"
},
FrostNadeModel_V[] = "models/Furien40/v_frostnade.mdl",
FrostNadeModel_P[] = "models/Furien40/p_frostnade.mdl",
FrostNadeModel_W[] = "models/Furien40/w_frostnade.mdl",
FrostNadeModel_ICE[] = "models/Furien40/iceblock.mdl",
FrostNade_WeaponList[] = "weapon_smokegrenade",
FrostNade_Sound[][] = {
"Furien40/frostnova.wav",
"Furien40/impalehit.wav",
"Furien40/impalelaunch1.wav"
},
/*
FrostNade_Generic[][] = {
"sprites/furien40_frostnade.txt",
"sprites/Furien40/frostnade.spr"
},
*/
FrostNadeID, Float:Frozen[33], Float:LastSpeed[33], frostnade_event,
frostnade_trail, frostnade_explode, frostnade_gib, frostnade_wave;
FrostNade_Init() {
FrostNadeID = RegisterGrenade(WPN_FROSTNADE[FROSTNADE_NAME], WPN_TEAM_CT, WPN_ACCES_ALL, WPN_FROSTNADE[FROSTNADE_LEVEL], weapon_frostnade, CSW_FROSTNADE, FrostNade_WeaponList)
if(FrostNadeID) {
register_clcmd(FrostNade_WeaponList, "Hook_FrostNade");
register_message(MSGID_CurWeapon, "FrostNade_CurWeapon")
register_event("CurWeapon", "FrostNade_ViewModel", "be", "1=1");
register_event("WeapPickup", "FrostNade_ViewModel","be", "1=19");
register_event("DeathMsg", "FrostNade_Death", "a");
register_forward(FM_SetModel, "FrostNade_WorldModel", 1);
register_forward(FM_UpdateClientData, "FrostNade_UpdateClientData", 1);
register_forward(FM_PlaybackEvent, "FrostNade_PlaybackEvent");
register_forward(FM_CmdStart, "FrostNade_CmdStart");
RegisterHam(Ham_Item_AddToPlayer, weapon_frostnade, "FrostNade_AddToPlayer");
RegisterHam(Ham_Item_Deploy , weapon_frostnade, "FrostNade_Deploy_Post", 1);
RegisterHam(Ham_Think, "grenade", "FrostNade_Think")
register_think(FROSTNADE_CLASS, "FrostNade_IceThink");
}
}
FrostNade_Precache() {
frostnade_trail = engfunc(EngFunc_PrecacheModel, "sprites/ef_shockwave.spr")
frostnade_explode = engfunc(EngFunc_PrecacheModel, "sprites/Furien40/frost_explode.spr")
frostnade_gib = engfunc(EngFunc_PrecacheModel, "sprites/Furien40/frost_gib.spr")
frostnade_wave = engfunc(EngFunc_PrecacheModel, "sprites/ef_shockwave.spr")
register_forward(FM_PrecacheEvent, "FrostNade_PrecacheEvent_Post", 1);
precache_model(FrostNadeModel_V);
precache_model(FrostNadeModel_P);
precache_model(FrostNadeModel_W);
precache_model(FrostNadeModel_ICE);
for(new i = 0; i < sizeof(FrostNade_Sound); i++)
engfunc(EngFunc_PrecacheSound, FrostNade_Sound[i]);
/*for(new i = 0; i < sizeof(FrostNade_Generic); i++)
engfunc(EngFunc_PrecacheGeneric, FrostNade_Generic[i]);*/
}
FrostNade_Natives() {
register_native("get_user_frostnade", "get_user_frostnade", 1);
register_native("set_user_frostnade", "set_user_frostnade", 1);
register_native("set_user_frost", "set_user_frost", 1);
register_native("frostnade_id", "frostnade_id", 1);
}
public FrostNade_CurWeapon(msg_id, msg_dest, id) {
new Weapon = get_msg_arg_int(2);
if(is_user_alive(id) && Weapon == CSW_FROSTNADE && get_user_weapon(id) == CSW_FROSTNADE && get_user_frostnade(id))
set_msg_arg_int(3, ARG_BYTE, -1)
}
public FrostNade_ViewModel(id) {
if(is_user_alive(id) && get_user_weapon(id) == CSW_FROSTNADE && get_user_frostnade(id)) {
new VModel[128], PModel[128];
pev(id, pev_viewmodel2, VModel, 127),
pev(id, pev_weaponmodel2, PModel, 127);
if(!equal(VModel, FrostNadeModel_V))
set_pev(id, pev_viewmodel2, FrostNadeModel_V);
if(!equal(PModel, FrostNadeModel_P))
set_pev(id, pev_weaponmodel2, FrostNadeModel_P);
}
}
public FrostNade_Death() {
if(is_user_connected(read_data(2)))
Frozen[read_data(2)] = 0.0
}
public FrostNade_WorldModel(entity, model[]) {
if(is_valid_ent(entity)) {
static ClassName[33];
entity_get_string(entity, EV_SZ_classname, ClassName, charsmax(ClassName));
if(equal(ClassName, "grenade") && entity_get_int(entity, EV_INT_WeaponKey) == FrostNadeID) {
entity_set_model(entity, FrostNadeModel_W);
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW)
write_short(entity)
write_short(frostnade_trail)
write_byte(5)
write_byte(5)
write_byte(0)
write_byte(0)
write_byte(200)
write_byte(200)
message_end()
}
}
return FMRES_IGNORED;
}
public FrostNade_UpdateClientData(id, sendweapons, cd_handle) {
if(is_user_alive(id) && is_user_connected(id) && get_user_weapon(id) == CSW_FROSTNADE && get_user_frostnade(id))
set_cd(cd_handle, CD_flNextAttack, halflife_time() + 0.001);
return FMRES_IGNORED;
}
public FrostNade_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2) {
if(is_user_connected(invoker) && eventid == frostnade_event)
playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2);
return FMRES_IGNORED;
}
public FrostNade_PrecacheEvent_Post(type, const name[]) {
if (equal("events/smokegrenade.sc", name))
frostnade_event = get_orig_retval();
return FMRES_IGNORED;
}
public FrostNade_CmdStart(id, uc_handle, seed) {
if(is_user_alive(id) && is_user_connected(id) && Frozen[id] > get_gametime()) {
new CurButton = get_uc(uc_handle, UC_Buttons);
if(CurButton & IN_JUMP) {
CurButton &= ~IN_JUMP;
set_uc(uc_handle, UC_Buttons, CurButton);
}
if(CurButton & IN_DUCK) {
CurButton &= ~IN_DUCK;
set_uc(uc_handle, UC_Buttons, CurButton);
}
}
}
public FrostNade_AddToPlayer(Weapon, id) {
if(pev_valid(Weapon) && is_user_alive(id) && entity_get_int(Weapon, EV_INT_WeaponKey) == FrostNadeID)
WeaponList(id, CSW_FROSTNADE, FrostNade_WeaponList, 0)
else if(pev_valid(Weapon) && is_user_alive(id) && entity_get_int(id, EV_INT_WeaponKey) == FrostNadeID) {
entity_set_int(Weapon, EV_INT_WeaponKey, FrostNadeID)
ColorChat(id, "!t[!g%s!t]!g Damage:!t %s!g Radius:!t %s!g Duration:!t %s", WPN_FROSTNADE[FROSTNADE_NAME], WPN_FROSTNADE[FROSTNADE_DAMAGE], WPN_FROSTNADE[FROSTNADE_RADIUS], WPN_FROSTNADE[FROSTNADE_DURATION])
}
return HAM_IGNORED;
}
public FrostNade_Deploy_Post(Weapon) {
if(pev_valid(Weapon)) {
new Owner = get_pdata_cbase(Weapon, 41, 4);
if(is_user_alive(Owner) && entity_get_int(Weapon, EV_INT_WeaponKey) == FrostNadeID) {
set_pev(Owner, pev_viewmodel2, FrostNadeModel_V);
set_pev(Owner, pev_weaponmodel2, FrostNadeModel_P);
set_weapon_anim(Owner, 3)
set_pdata_float(Owner, 83, 0.7, 5);
set_pdata_float(Weapon, 48, 0.7, 4)
}
}
return HAM_IGNORED;
}
public FrostNade_Think(FrostNade) {
if(pev_valid(FrostNade)) {
if(pev(FrostNade, pev_dmgtime) < get_gametime() && entity_get_int(FrostNade, EV_INT_WeaponKey) == FrostNadeID) {
new Float:GrenadeOrigin[3], Victim = -1,
id = pev(FrostNade, pev_owner)
pev(FrostNade, pev_origin, GrenadeOrigin)
engfunc(EngFunc_EmitSound, FrostNade, CHAN_WEAPON, FrostNade_Sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_EXPLOSION)
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+75) // z axis
write_short(frostnade_explode)
write_byte(22)
write_byte(17)
write_byte(TE_EXPLFLAG_NOSOUND)
message_end()
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_WORLDDECAL)
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0])
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1])
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2])
write_byte(random_num(46, 48))
message_end()
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_DLIGHT);
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]); // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]); // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]); // z
write_byte(floatround(str_to_float(WPN_FROSTNADE[FROSTNADE_RADIUS])/10.0)); // radius
write_byte(0) // red
write_byte(0) // green
write_byte(200) // blue
write_byte(15); // life
write_byte(15); // decay rate
message_end();
engfunc(EngFunc_MessageBegin, MSG_BROADCAST ,SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_SPRITETRAIL) // TE ID
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+100) // z axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z axis
write_short(frostnade_gib) // Sprite Index
write_byte(100) // Count
write_byte(20) // Life
write_byte(1) // Scale
write_byte(50) // Velocity Along Vector
write_byte(10) // Rendomness of Velocity
message_end();
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+100.0) // z axis
write_short(frostnade_wave) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(5) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(0) // red
write_byte(0) // green
write_byte(200) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+200.0) // z axis
write_short(frostnade_wave) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(5) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(0) // red
write_byte(50) // green
write_byte(200) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+300.0) // z axis
write_short(frostnade_wave) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(5) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(0) // red
write_byte(100) // green
write_byte(200) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
while((Victim = find_ent_in_sphere(Victim, GrenadeOrigin, str_to_float(WPN_FROSTNADE[FROSTNADE_RADIUS]))) != 0) {
if(is_user_connected(Victim) && is_user_alive(Victim) && get_user_team(id) != get_user_team(Victim)) {
new Float:VictimOrigin[3], Float:Distance, Float:DistanceRatio, Float:Damage;
pev(Victim, pev_origin, VictimOrigin);
Distance = get_distance_f(GrenadeOrigin, VictimOrigin);
DistanceRatio = floatdiv(Distance, str_to_float(WPN_FROSTNADE[FROSTNADE_RADIUS]));
Damage = str_to_float(WPN_FROSTNADE[FROSTNADE_DAMAGE]) - floatround(floatmul(str_to_float(WPN_FROSTNADE[FROSTNADE_DAMAGE]), DistanceRatio));
make_blood(Victim, floatround(Damage))
if(get_user_health(Victim) > Damage) {
ExecuteHam(Ham_TakeDamage, Victim, id, id, Damage, (1<<24));
set_user_frost(Victim)
}
else
death_message(id, Victim, "frostnade");
}
}
engfunc(EngFunc_RemoveEntity, FrostNade);
return HAM_SUPERCEDE;
}
}
return HAM_IGNORED;
}
public FrostNade_IceThink(Ice) {
if(pev_valid(Ice)) {
new id = pev(Ice, pev_owner)
if(Frozen[id] < get_gametime()) {
engfunc(EngFunc_RemoveEntity, Ice);
set_pev(id, pev_maxspeed, LastSpeed[id])
}
else {
if(is_user_alive(id)) {
new Float:VictimOrigin[3]
pev(id, pev_origin, VictimOrigin);
engfunc(EngFunc_SetOrigin, Ice, VictimOrigin);
set_pev(id, pev_maxspeed, 0.1)
}
set_pev(Ice, pev_nextthink, get_gametime() + 0.1);
}
}
}
public Hook_FrostNade(id) {
engclient_cmd(id, weapon_frostnade);
return PLUGIN_HANDLED
}
public set_user_frost(victim) {
if(is_user_alive(victim)) {
set_pev(victim, pev_velocity, Float:{0.0,0.0,0.0})
pev(victim, pev_maxspeed, LastSpeed[victim])
set_pev(victim, pev_maxspeed, 0.1)
Frozen[victim] = get_gametime() + str_to_float(WPN_FROSTNADE[FROSTNADE_DURATION]);
new Ice = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
if(pev_valid(Ice)) {
new Float:VictimOrigin[3]
pev(victim, pev_origin, VictimOrigin);
VictimOrigin[2] -= 40
set_pev(Ice, pev_classname, FROSTNADE_CLASS);
set_pev(Ice, pev_owner, victim);
set_pev(Ice, pev_solid, SOLID_NOT);
set_pev(Ice, pev_movetype, MOVETYPE_TOSS);
VictimOrigin[2] -= 40.0
engfunc(EngFunc_SetOrigin, Ice, VictimOrigin);
engfunc(EngFunc_SetModel, Ice, FrostNadeModel_ICE);
fm_set_user_rendering(Ice, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 10);
set_pev(Ice, pev_nextthink, get_gametime() + 0.1);
}
}
}
public get_user_frostnade(id)
return get_weapon(id, weapon_frostnade, CSW_FROSTNADE, FrostNadeID)
public set_user_frostnade(id)
return set_weapon(id, WPN_GRENADE, FrostNadeID)
public frostnade_id()
return FrostNadeID
SFNade
Spoiler
#define weapon_sfnade "weapon_flashbang"
#define CSW_SFNADE CSW_FLASHBANG
enum SFNadeData {
SFNADE_NAME = 0,
SFNADE_LEVEL,
SFNADE_DAMAGE,
SFNADE_RADIUS,
SFNADE_FLASHRADIUS
}
new WPN_SFNADE[SFNadeData][] = {
/*Name*/ "SF Grenade",
/*Level*/ "0",
/*Damage*/ "100",
/*Radius*/ "300",
/*Flash Radius*/ "1000"
},
SFNadeModel_V[] = "models/Furien40/v_sfnade.mdl",
SFNadeModel_P[] = "models/Furien40/p_sfnade.mdl",
SFNadeModel_W[] = "models/Furien40/w_sfnade.mdl",
SFNade_WeaponList[] = "furien40_sfnade",
SFNade_Sound[][] = {
"weapons/sfgrenade_explode.wav",
"weapons/sfgrenade_deploy.wav",
"weapons/sfgrenade_pullpin.wav",
"weapons/sfgrenade_ready.wav"
},
SFNade_Generic[][] = {
"sprites/furien40_sfnade.txt",
"sprites/Furien40/sfnade.spr"
},
SFNadeID, sfnade_event,
sfnade_trail, sfnade_explode, sfnade_wave;
SFNade_Init() {
SFNadeID = RegisterGrenade(WPN_SFNADE[SFNADE_NAME], WPN_TEAM_CT, WPN_ACCES_ALL, WPN_SFNADE[SFNADE_LEVEL], weapon_sfnade, CSW_SFNADE, SFNade_WeaponList)
if(SFNadeID) {
register_clcmd(SFNade_WeaponList, "Hook_SFNade");
register_message(MSGID_CurWeapon, "SFNade_CurWeapon")
register_event("CurWeapon", "SFNade_ViewModel", "be", "1=1");
register_event("WeapPickup", "SFNade_ViewModel","be", "1=19");
register_forward(FM_SetModel, "SFNade_WorldModel", 1);
register_forward(FM_UpdateClientData, "SFNade_UpdateClientData", 1);
register_forward(FM_PlaybackEvent, "SFNade_PlaybackEvent");
RegisterHam(Ham_Item_AddToPlayer, weapon_sfnade, "SFNade_AddToPlayer");
RegisterHam(Ham_Item_Deploy , weapon_sfnade, "SFNade_Deploy_Post", 1);
RegisterHam(Ham_Think, "grenade", "SFNade_Think")
}
}
SFNade_Precache() {
sfnade_trail = engfunc(EngFunc_PrecacheModel, "sprites/ef_shockwave.spr")
sfnade_explode = engfunc(EngFunc_PrecacheModel, "sprites/ef_elec.spr")
sfnade_wave = engfunc(EngFunc_PrecacheModel, "sprites/ef_shockwave.spr")
register_forward(FM_PrecacheEvent, "SFNade_PrecacheEvent_Post", 1);
precache_model(SFNadeModel_V);
precache_model(SFNadeModel_P);
precache_model(SFNadeModel_W);
for(new i = 0; i < sizeof(SFNade_Sound); i++)
engfunc(EngFunc_PrecacheSound, SFNade_Sound[i]);
for(new i = 0; i < sizeof(SFNade_Generic); i++)
engfunc(EngFunc_PrecacheGeneric, SFNade_Generic[i]);
}
SFNade_Natives() {
register_native("get_user_sfnade", "get_user_sfnade", 1);
register_native("set_user_sfnade", "set_user_sfnade", 1);
register_native("sfnade_id", "sfnade_id", 1);
}
public SFNade_CurWeapon(msg_id, msg_dest, id) {
new Weapon = get_msg_arg_int(2);
if(is_user_alive(id) && Weapon == CSW_SFNADE && get_user_weapon(id) == CSW_SFNADE && get_user_sfnade(id))
set_msg_arg_int(3, ARG_BYTE, -1)
}
public SFNade_ViewModel(id) {
if(is_user_alive(id) && get_user_weapon(id) == CSW_SFNADE && get_user_sfnade(id)) {
new VModel[128], PModel[128];
pev(id, pev_viewmodel2, VModel, 127),
pev(id, pev_weaponmodel2, PModel, 127);
if(!equal(VModel, SFNadeModel_V))
set_pev(id, pev_viewmodel2, SFNadeModel_V);
if(!equal(PModel, SFNadeModel_P))
set_pev(id, pev_weaponmodel2, SFNadeModel_P);
}
}
public SFNade_WorldModel(entity, model[]) {
if(is_valid_ent(entity)) {
static ClassName[33];
entity_get_string(entity, EV_SZ_classname, ClassName, charsmax(ClassName));
if(equal(ClassName, "grenade") && entity_get_int(entity, EV_INT_WeaponKey) == SFNadeID) {
entity_set_model(entity, SFNadeModel_W);
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW)
write_short(entity)
write_short(sfnade_trail)
write_byte(5)
write_byte(5)
write_byte(200)
write_byte(200)
write_byte(200)
write_byte(200)
message_end()
}
}
return FMRES_IGNORED;
}
public SFNade_UpdateClientData(id, sendweapons, cd_handle) {
if(is_user_alive(id) && is_user_connected(id) && get_user_weapon(id) == CSW_SFNADE && get_user_sfnade(id))
set_cd(cd_handle, CD_flNextAttack, halflife_time() + 0.001);
return FMRES_IGNORED;
}
public SFNade_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2) {
if(is_user_connected(invoker) && eventid == sfnade_event)
playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2);
return FMRES_IGNORED;
}
public SFNade_PrecacheEvent_Post(type, const name[]) {
if (equal("events/flashbang.sc", name))
sfnade_event = get_orig_retval();
return FMRES_IGNORED;
}
public SFNade_AddToPlayer(Weapon, id) {
if(pev_valid(Weapon) && is_user_alive(id) && entity_get_int(Weapon, EV_INT_WeaponKey) == SFNadeID)
WeaponList(id, CSW_SFNADE, SFNade_WeaponList, 0)
else if(pev_valid(Weapon) && is_user_alive(id) && entity_get_int(id, EV_INT_WeaponKey) == SFNadeID) {
entity_set_int(Weapon, EV_INT_WeaponKey, SFNadeID)
ColorChat(id, "!t[!g%s!t]!g Damage:!t %s!g Radius:!t %s!g Flash Radius:!t %s", WPN_SFNADE[SFNADE_NAME], WPN_SFNADE[SFNADE_DAMAGE], WPN_SFNADE[SFNADE_RADIUS], WPN_SFNADE[SFNADE_FLASHRADIUS])
}
return HAM_IGNORED;
}
public SFNade_Deploy_Post(Weapon) {
if(pev_valid(Weapon)) {
new Owner = get_pdata_cbase(Weapon, 41, 4);
if(is_user_alive(Owner) && entity_get_int(Weapon, EV_INT_WeaponKey) == SFNadeID) {
set_pev(Owner, pev_viewmodel2, SFNadeModel_V);
set_pev(Owner, pev_weaponmodel2, SFNadeModel_P);
set_weapon_anim(Owner, 3)
set_pdata_float(Owner, 83, 1.0, 5);
set_pdata_float(Weapon, 48, 1.0, 4)
}
}
return HAM_IGNORED;
}
public SFNade_Think(SFNade) {
if(pev_valid(SFNade)) {
if(pev(SFNade, pev_dmgtime) < get_gametime() && entity_get_int(SFNade, EV_INT_WeaponKey) == SFNadeID) {
new Float:GrenadeOrigin[3], Victim = -1,
id = pev(SFNade, pev_owner)
pev(SFNade, pev_origin, GrenadeOrigin)
engfunc(EngFunc_EmitSound, SFNade, CHAN_WEAPON, SFNade_Sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_EXPLOSION)
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+50) // z axis
write_short(sfnade_explode)
write_byte(10)
write_byte(17)
write_byte(TE_EXPLFLAG_NOSOUND)
message_end()
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_WORLDDECAL)
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0])
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1])
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2])
write_byte(random_num(46, 48))
message_end()
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_DLIGHT);
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]); // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]); // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]); // z
write_byte(floatround(str_to_float(WPN_SFNADE[SFNADE_RADIUS])/10.0)); // radius
write_byte(200) // red
write_byte(200) // green
write_byte(200) // blue
write_byte(15); // life
write_byte(15); // decay rate
message_end();
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+100.0) // z axis
write_short(sfnade_wave) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(5) // life
write_byte(60) // width
write_byte(200) // noise
write_byte(200) // red
write_byte(200) // green
write_byte(200) // blue
write_byte(220) // brightness
write_byte(0) // speed
message_end()
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+200.0) // z axis
write_short(sfnade_wave) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(5) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(0) // red
write_byte(50) // green
write_byte(200) // blue
write_byte(230) // brightness
write_byte(0) // speed
message_end()
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+300.0) // z axis
write_short(sfnade_wave) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(5) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(200) // red
write_byte(200) // green
write_byte(200) // blue
write_byte(240) // brightness
write_byte(0) // speed
message_end()
while((Victim = find_ent_in_sphere(Victim, GrenadeOrigin, str_to_float(WPN_SFNADE[SFNADE_RADIUS]))) != 0) {
if(is_user_connected(Victim) && is_user_alive(Victim) && get_user_team(id) != get_user_team(Victim)) {
new Float:VictimOrigin[3], Float:Distance, Float:DistanceRatio, Float:Damage;
pev(Victim, pev_origin, VictimOrigin);
Distance = get_distance_f(GrenadeOrigin, VictimOrigin);
DistanceRatio = floatdiv(Distance, str_to_float(WPN_SFNADE[SFNADE_RADIUS]));
Damage = str_to_float(WPN_SFNADE[SFNADE_DAMAGE]) - floatround(floatmul(str_to_float(WPN_SFNADE[SFNADE_DAMAGE]), DistanceRatio));
make_blood(Victim, floatround(Damage))
if(get_user_health(Victim) > Damage)
ExecuteHam(Ham_TakeDamage, Victim, id, id, Damage, (1<<24));
else
death_message(id, Victim, "sfnade");
}
}
new Spectators[32], SpecNum;
get_players(Spectators, SpecNum, "bch");
while((Victim = find_ent_in_sphere(Victim, GrenadeOrigin, str_to_float(WPN_SFNADE[SFNADE_FLASHRADIUS]))) != 0) {
if(is_user_connected(Victim) && is_user_alive(Victim)) {
new Float:VictimOrigin[3], Float:Fraction
pev(Victim, pev_origin, VictimOrigin);
engfunc(EngFunc_TraceLine, VictimOrigin, GrenadeOrigin, IGNORE_MONSTERS, Victim, 0);
get_tr2(0, TR_flFraction, Fraction);
if(!(Fraction < 1.0) && is_in_viewcone(Victim, GrenadeOrigin, 1)) {
message_begin(MSG_ONE, MSGID_ScreenFade, {0,0,0}, Victim)
write_short((1<<15)) // Duration
write_short((1<<10)) // Hold time
write_short((1<<12)) // Fade type
write_byte(200) // Red
write_byte(200) // Green
write_byte(200) // Blue
write_byte(255) // Alpha
message_end()
message_begin(MSG_ONE , MSGID_ScreenShake , {0,0,0} ,Victim)
write_short((1<<14)*2) // --| Shake amount.
write_short((1<<13)*2) // --| Shake lasts this long.
write_short((1<<14)*2) // --| Shake noise frequency.
message_end()
for(new s = 0; s < SpecNum; s++) {
new Spectator = Spectators[s]
if(is_user_connected(Spectator) && pev(Spectator, pev_iuser2) == Victim && Victim != Spectator) {
message_begin(MSG_ONE, MSGID_ScreenFade, {0,0,0}, Spectator)
write_short((1<<15)) // Duration
write_short((1<<10)) // Hold time
write_short((1<<12)) // Fade type
write_byte(200) // Red
write_byte(200) // Green
write_byte(200) // Blue
write_byte(255) // Alpha
message_end()
message_begin(MSG_ONE , MSGID_ScreenShake , {0,0,0} ,Spectator)
write_short((1<<14)*2) // --| Shake amount.
write_short((1<<13)*2) // --| Shake lasts this long.
write_short((1<<14)*2) // --| Shake noise frequency.
message_end()
}
}
}
}
}
engfunc(EngFunc_RemoveEntity, SFNade);
return HAM_SUPERCEDE;
}
}
return HAM_IGNORED;
}
public Hook_SFNade(id) {
engclient_cmd(id, weapon_sfnade);
return PLUGIN_HANDLED
}
public get_user_sfnade(id)
return get_weapon(id, weapon_sfnade, CSW_SFNADE, SFNadeID)
public set_user_sfnade(id)
return set_weapon(id, WPN_GRENADE, SFNadeID)
public sfnade_id()
return SFNadeID
stock bool:fmm_is_in_viewcone(index, const Float:point[3]) {
static Float:angles[3]
//pev(index, pev_angles, angles)
pev(index, pev_v_angle, angles)
engfunc(EngFunc_MakeVectors, angles)
global_get(glb_v_forward, angles)
angles[2] = 0.0
static Float:origin[3], Float:diff[3], Float:norm[3]
pev(index, pev_origin, origin)
xs_vec_sub(point, origin, diff)
diff[2] = 0.0
xs_vec_normalize(diff, norm)
static Float:dot, Float:fov
dot = xs_vec_dot(norm, angles)
pev(index, pev_fov, fov)
if (dot >= floatcos(fov * M_PI / 360.0))
return true
return false
}
#define CSW_SFNADE CSW_FLASHBANG
enum SFNadeData {
SFNADE_NAME = 0,
SFNADE_LEVEL,
SFNADE_DAMAGE,
SFNADE_RADIUS,
SFNADE_FLASHRADIUS
}
new WPN_SFNADE[SFNadeData][] = {
/*Name*/ "SF Grenade",
/*Level*/ "0",
/*Damage*/ "100",
/*Radius*/ "300",
/*Flash Radius*/ "1000"
},
SFNadeModel_V[] = "models/Furien40/v_sfnade.mdl",
SFNadeModel_P[] = "models/Furien40/p_sfnade.mdl",
SFNadeModel_W[] = "models/Furien40/w_sfnade.mdl",
SFNade_WeaponList[] = "furien40_sfnade",
SFNade_Sound[][] = {
"weapons/sfgrenade_explode.wav",
"weapons/sfgrenade_deploy.wav",
"weapons/sfgrenade_pullpin.wav",
"weapons/sfgrenade_ready.wav"
},
SFNade_Generic[][] = {
"sprites/furien40_sfnade.txt",
"sprites/Furien40/sfnade.spr"
},
SFNadeID, sfnade_event,
sfnade_trail, sfnade_explode, sfnade_wave;
SFNade_Init() {
SFNadeID = RegisterGrenade(WPN_SFNADE[SFNADE_NAME], WPN_TEAM_CT, WPN_ACCES_ALL, WPN_SFNADE[SFNADE_LEVEL], weapon_sfnade, CSW_SFNADE, SFNade_WeaponList)
if(SFNadeID) {
register_clcmd(SFNade_WeaponList, "Hook_SFNade");
register_message(MSGID_CurWeapon, "SFNade_CurWeapon")
register_event("CurWeapon", "SFNade_ViewModel", "be", "1=1");
register_event("WeapPickup", "SFNade_ViewModel","be", "1=19");
register_forward(FM_SetModel, "SFNade_WorldModel", 1);
register_forward(FM_UpdateClientData, "SFNade_UpdateClientData", 1);
register_forward(FM_PlaybackEvent, "SFNade_PlaybackEvent");
RegisterHam(Ham_Item_AddToPlayer, weapon_sfnade, "SFNade_AddToPlayer");
RegisterHam(Ham_Item_Deploy , weapon_sfnade, "SFNade_Deploy_Post", 1);
RegisterHam(Ham_Think, "grenade", "SFNade_Think")
}
}
SFNade_Precache() {
sfnade_trail = engfunc(EngFunc_PrecacheModel, "sprites/ef_shockwave.spr")
sfnade_explode = engfunc(EngFunc_PrecacheModel, "sprites/ef_elec.spr")
sfnade_wave = engfunc(EngFunc_PrecacheModel, "sprites/ef_shockwave.spr")
register_forward(FM_PrecacheEvent, "SFNade_PrecacheEvent_Post", 1);
precache_model(SFNadeModel_V);
precache_model(SFNadeModel_P);
precache_model(SFNadeModel_W);
for(new i = 0; i < sizeof(SFNade_Sound); i++)
engfunc(EngFunc_PrecacheSound, SFNade_Sound[i]);
for(new i = 0; i < sizeof(SFNade_Generic); i++)
engfunc(EngFunc_PrecacheGeneric, SFNade_Generic[i]);
}
SFNade_Natives() {
register_native("get_user_sfnade", "get_user_sfnade", 1);
register_native("set_user_sfnade", "set_user_sfnade", 1);
register_native("sfnade_id", "sfnade_id", 1);
}
public SFNade_CurWeapon(msg_id, msg_dest, id) {
new Weapon = get_msg_arg_int(2);
if(is_user_alive(id) && Weapon == CSW_SFNADE && get_user_weapon(id) == CSW_SFNADE && get_user_sfnade(id))
set_msg_arg_int(3, ARG_BYTE, -1)
}
public SFNade_ViewModel(id) {
if(is_user_alive(id) && get_user_weapon(id) == CSW_SFNADE && get_user_sfnade(id)) {
new VModel[128], PModel[128];
pev(id, pev_viewmodel2, VModel, 127),
pev(id, pev_weaponmodel2, PModel, 127);
if(!equal(VModel, SFNadeModel_V))
set_pev(id, pev_viewmodel2, SFNadeModel_V);
if(!equal(PModel, SFNadeModel_P))
set_pev(id, pev_weaponmodel2, SFNadeModel_P);
}
}
public SFNade_WorldModel(entity, model[]) {
if(is_valid_ent(entity)) {
static ClassName[33];
entity_get_string(entity, EV_SZ_classname, ClassName, charsmax(ClassName));
if(equal(ClassName, "grenade") && entity_get_int(entity, EV_INT_WeaponKey) == SFNadeID) {
entity_set_model(entity, SFNadeModel_W);
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW)
write_short(entity)
write_short(sfnade_trail)
write_byte(5)
write_byte(5)
write_byte(200)
write_byte(200)
write_byte(200)
write_byte(200)
message_end()
}
}
return FMRES_IGNORED;
}
public SFNade_UpdateClientData(id, sendweapons, cd_handle) {
if(is_user_alive(id) && is_user_connected(id) && get_user_weapon(id) == CSW_SFNADE && get_user_sfnade(id))
set_cd(cd_handle, CD_flNextAttack, halflife_time() + 0.001);
return FMRES_IGNORED;
}
public SFNade_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2) {
if(is_user_connected(invoker) && eventid == sfnade_event)
playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2);
return FMRES_IGNORED;
}
public SFNade_PrecacheEvent_Post(type, const name[]) {
if (equal("events/flashbang.sc", name))
sfnade_event = get_orig_retval();
return FMRES_IGNORED;
}
public SFNade_AddToPlayer(Weapon, id) {
if(pev_valid(Weapon) && is_user_alive(id) && entity_get_int(Weapon, EV_INT_WeaponKey) == SFNadeID)
WeaponList(id, CSW_SFNADE, SFNade_WeaponList, 0)
else if(pev_valid(Weapon) && is_user_alive(id) && entity_get_int(id, EV_INT_WeaponKey) == SFNadeID) {
entity_set_int(Weapon, EV_INT_WeaponKey, SFNadeID)
ColorChat(id, "!t[!g%s!t]!g Damage:!t %s!g Radius:!t %s!g Flash Radius:!t %s", WPN_SFNADE[SFNADE_NAME], WPN_SFNADE[SFNADE_DAMAGE], WPN_SFNADE[SFNADE_RADIUS], WPN_SFNADE[SFNADE_FLASHRADIUS])
}
return HAM_IGNORED;
}
public SFNade_Deploy_Post(Weapon) {
if(pev_valid(Weapon)) {
new Owner = get_pdata_cbase(Weapon, 41, 4);
if(is_user_alive(Owner) && entity_get_int(Weapon, EV_INT_WeaponKey) == SFNadeID) {
set_pev(Owner, pev_viewmodel2, SFNadeModel_V);
set_pev(Owner, pev_weaponmodel2, SFNadeModel_P);
set_weapon_anim(Owner, 3)
set_pdata_float(Owner, 83, 1.0, 5);
set_pdata_float(Weapon, 48, 1.0, 4)
}
}
return HAM_IGNORED;
}
public SFNade_Think(SFNade) {
if(pev_valid(SFNade)) {
if(pev(SFNade, pev_dmgtime) < get_gametime() && entity_get_int(SFNade, EV_INT_WeaponKey) == SFNadeID) {
new Float:GrenadeOrigin[3], Victim = -1,
id = pev(SFNade, pev_owner)
pev(SFNade, pev_origin, GrenadeOrigin)
engfunc(EngFunc_EmitSound, SFNade, CHAN_WEAPON, SFNade_Sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_EXPLOSION)
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+50) // z axis
write_short(sfnade_explode)
write_byte(10)
write_byte(17)
write_byte(TE_EXPLFLAG_NOSOUND)
message_end()
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_WORLDDECAL)
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0])
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1])
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2])
write_byte(random_num(46, 48))
message_end()
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_DLIGHT);
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]); // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]); // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]); // z
write_byte(floatround(str_to_float(WPN_SFNADE[SFNADE_RADIUS])/10.0)); // radius
write_byte(200) // red
write_byte(200) // green
write_byte(200) // blue
write_byte(15); // life
write_byte(15); // decay rate
message_end();
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+100.0) // z axis
write_short(sfnade_wave) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(5) // life
write_byte(60) // width
write_byte(200) // noise
write_byte(200) // red
write_byte(200) // green
write_byte(200) // blue
write_byte(220) // brightness
write_byte(0) // speed
message_end()
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+200.0) // z axis
write_short(sfnade_wave) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(5) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(0) // red
write_byte(50) // green
write_byte(200) // blue
write_byte(230) // brightness
write_byte(0) // speed
message_end()
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, GrenadeOrigin, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]) // z
engfunc(EngFunc_WriteCoord, GrenadeOrigin[0]) // x axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[1]) // y axis
engfunc(EngFunc_WriteCoord, GrenadeOrigin[2]+300.0) // z axis
write_short(sfnade_wave) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(5) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(200) // red
write_byte(200) // green
write_byte(200) // blue
write_byte(240) // brightness
write_byte(0) // speed
message_end()
while((Victim = find_ent_in_sphere(Victim, GrenadeOrigin, str_to_float(WPN_SFNADE[SFNADE_RADIUS]))) != 0) {
if(is_user_connected(Victim) && is_user_alive(Victim) && get_user_team(id) != get_user_team(Victim)) {
new Float:VictimOrigin[3], Float:Distance, Float:DistanceRatio, Float:Damage;
pev(Victim, pev_origin, VictimOrigin);
Distance = get_distance_f(GrenadeOrigin, VictimOrigin);
DistanceRatio = floatdiv(Distance, str_to_float(WPN_SFNADE[SFNADE_RADIUS]));
Damage = str_to_float(WPN_SFNADE[SFNADE_DAMAGE]) - floatround(floatmul(str_to_float(WPN_SFNADE[SFNADE_DAMAGE]), DistanceRatio));
make_blood(Victim, floatround(Damage))
if(get_user_health(Victim) > Damage)
ExecuteHam(Ham_TakeDamage, Victim, id, id, Damage, (1<<24));
else
death_message(id, Victim, "sfnade");
}
}
new Spectators[32], SpecNum;
get_players(Spectators, SpecNum, "bch");
while((Victim = find_ent_in_sphere(Victim, GrenadeOrigin, str_to_float(WPN_SFNADE[SFNADE_FLASHRADIUS]))) != 0) {
if(is_user_connected(Victim) && is_user_alive(Victim)) {
new Float:VictimOrigin[3], Float:Fraction
pev(Victim, pev_origin, VictimOrigin);
engfunc(EngFunc_TraceLine, VictimOrigin, GrenadeOrigin, IGNORE_MONSTERS, Victim, 0);
get_tr2(0, TR_flFraction, Fraction);
if(!(Fraction < 1.0) && is_in_viewcone(Victim, GrenadeOrigin, 1)) {
message_begin(MSG_ONE, MSGID_ScreenFade, {0,0,0}, Victim)
write_short((1<<15)) // Duration
write_short((1<<10)) // Hold time
write_short((1<<12)) // Fade type
write_byte(200) // Red
write_byte(200) // Green
write_byte(200) // Blue
write_byte(255) // Alpha
message_end()
message_begin(MSG_ONE , MSGID_ScreenShake , {0,0,0} ,Victim)
write_short((1<<14)*2) // --| Shake amount.
write_short((1<<13)*2) // --| Shake lasts this long.
write_short((1<<14)*2) // --| Shake noise frequency.
message_end()
for(new s = 0; s < SpecNum; s++) {
new Spectator = Spectators[s]
if(is_user_connected(Spectator) && pev(Spectator, pev_iuser2) == Victim && Victim != Spectator) {
message_begin(MSG_ONE, MSGID_ScreenFade, {0,0,0}, Spectator)
write_short((1<<15)) // Duration
write_short((1<<10)) // Hold time
write_short((1<<12)) // Fade type
write_byte(200) // Red
write_byte(200) // Green
write_byte(200) // Blue
write_byte(255) // Alpha
message_end()
message_begin(MSG_ONE , MSGID_ScreenShake , {0,0,0} ,Spectator)
write_short((1<<14)*2) // --| Shake amount.
write_short((1<<13)*2) // --| Shake lasts this long.
write_short((1<<14)*2) // --| Shake noise frequency.
message_end()
}
}
}
}
}
engfunc(EngFunc_RemoveEntity, SFNade);
return HAM_SUPERCEDE;
}
}
return HAM_IGNORED;
}
public Hook_SFNade(id) {
engclient_cmd(id, weapon_sfnade);
return PLUGIN_HANDLED
}
public get_user_sfnade(id)
return get_weapon(id, weapon_sfnade, CSW_SFNADE, SFNadeID)
public set_user_sfnade(id)
return set_weapon(id, WPN_GRENADE, SFNadeID)
public sfnade_id()
return SFNadeID
stock bool:fmm_is_in_viewcone(index, const Float:point[3]) {
static Float:angles[3]
//pev(index, pev_angles, angles)
pev(index, pev_v_angle, angles)
engfunc(EngFunc_MakeVectors, angles)
global_get(glb_v_forward, angles)
angles[2] = 0.0
static Float:origin[3], Float:diff[3], Float:norm[3]
pev(index, pev_origin, origin)
xs_vec_sub(point, origin, diff)
diff[2] = 0.0
xs_vec_normalize(diff, norm)
static Float:dot, Float:fov
dot = xs_vec_dot(norm, angles)
pev(index, pev_fov, fov)
if (dot >= floatcos(fov * M_PI / 360.0))
return true
return false
}
Cele 3 coduri sunt luate din Furien40 , dar as vrea toate astea trei intr-un plugin separat ! Daca puteti sa faceti si cu native