Member
Join Date: Jan 2017
Location: Turkey, Istanbul
|
05-26-2017
, 19:46
Re: [Request] WorldModel / W_Model Frost Grenade
|
#11
|
Something Is Wrong. Precached Model, It's OK. But When I Threw The Bomb, Seemed Standart W_Flashbang Model. I Checked With HL Model Viewer, Deleted And Precached Again. But The Same Problem.
Here Is The New SMA:
PHP Code:
#include <amxmodx>
#include <engine>
#include <cstrike>
#include <fun>
#include <biohazard>
#include <hamsandwich>
#include <fakemeta>
#include <fakemeta_util>
#define RADIUS 250.0
#define FROST_DURATION 5.0
#define FROST_CODE 3245879
#define ice_model "models/dd_iceblock.mdl"
#define V_MODEL "models/v_ice_cube_z.mdl"
#define W_MODEL "models/w_ice_cube_lawliet.mdl"
new g_frostexp
new g_frost_gibs;
new iceent[33], g_glassSpr, g_msgScreenFade, grenadetrail, g_msgDamage
public plugin_init()
{
register_plugin("T.Knight Avalanche Frost" , "2.0" , "Halil ibrahim")
register_cvar("fros", "hardy", FCVAR_SERVER|FCVAR_SPONLY)
register_event("HLTV", "Event_NewRound", "a", "1=0", "2=0")
register_forward(FM_SetModel, "fw_SetModel")
register_forward(FM_Touch, "fw_Touch")
RegisterHam(Ham_Item_Deploy,"weapon_flashbang", "fw_Item_Deploy_Post", 1)
RegisterHam(Ham_Killed, "player", "player_dead")
g_msgDamage = get_user_msgid("Damage")
g_msgScreenFade = get_user_msgid("ScreenFade")
}
public plugin_precache()
{
grenadetrail = engfunc(EngFunc_PrecacheModel, "sprites/laserbeam.spr")
g_glassSpr = engfunc(EngFunc_PrecacheModel, "models/glassgibs.mdl")
engfunc(EngFunc_PrecacheModel, ice_model)
engfunc(EngFunc_PrecacheModel, V_MODEL)
engfunc(EngFunc_PrecacheModel, W_MODEL )
engfunc(EngFunc_PrecacheSound, "/weapons/frostnova.wav")
engfunc(EngFunc_PrecacheSound, "/weapons/impalehit.wav")
engfunc(EngFunc_PrecacheSound, "weapons/impalelaunch1.wav")
g_frostexp = precache_model("sprites/frost_kurukafa.spr")
g_frost_gibs = precache_model("sprites/frostbomb_buzparcacigi.spr")
}
public client_putinserver(id)
{
new g_Ham_Bot
if(!g_Ham_Bot && is_user_bot(id))
{
g_Ham_Bot = 1
set_task(0.1, "Do_RegisterHam_Bot", id)
}
}
public Do_RegisterHam_Bot(id)
{
RegisterHamFromEntity(Ham_Killed, id, "player_dead")
}
public fw_Item_Deploy_Post(weapon_ent)
{
static id; id = fm_cs_get_weapon_ent_owner(weapon_ent)
if (!pev_valid(id))
return
set_pev(id, pev_viewmodel2, V_MODEL)
}
public fw_Touch(pfn, ptd)
{
if(!pev_valid(pfn))
return
static Classname[32]; pev(pfn, pev_classname, Classname, sizeof(Classname))
if(equal(Classname, "grenade"))
{
if(pev(pfn, pev_iuser2) != FROST_CODE)
return
frost_explode(pfn)
set_pev(pfn, pev_iuser2, 0)
engfunc(EngFunc_RemoveEntity, pfn)
}
}
frost_explode(ent)
{
// Get origin
static Float:originF[3], Owner
pev(ent, pev_origin, originF)
Owner = pev(ent, pev_owner)
// Make the explosion
yeni_balast_ates(originF)
// Fire nade explode sound
emit_sound(ent, CHAN_WEAPON, "frostnova.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
static Float:PlayerOrigin[3]
for(new i = 0; i < get_maxplayers(); i++)
{
if(!is_user_alive(i))
continue
if(cs_get_user_team(i) == cs_get_user_team(Owner))
continue
pev(i, pev_origin, PlayerOrigin)
if(get_distance_f(originF, PlayerOrigin) > RADIUS)
continue
if(!is_user_connected(Owner)) Owner = i
ami_frozen(i)
message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, _, i)
write_byte(0) // damage save
write_byte(0) // damage take
write_long(DMG_DROWN) // damage type - DMG_FREEZE
write_coord(0) // x
write_coord(0) // y
write_coord(0) // z
message_end()
emit_sound(i, CHAN_BODY, "impalehit.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
message_begin(MSG_ONE, g_msgScreenFade, _, i)
write_short(0) // duration
write_short(0) // hold time
write_short(0x0004) // fade type
write_byte(0) // red
write_byte(50) // green
write_byte(200) // blue
write_byte(100) // alpha
message_end()
set_task(FROST_DURATION, "remove_freeze", i)
}
}
public remove_freeze(id)
{
// Not alive or not frozen anymore
if (!is_user_alive(id))
return;
// Gradually remove screen's blue tint
message_begin(MSG_ONE, g_msgScreenFade, _, id)
write_short((1<<12)) // duration
write_short(0) // hold time
write_short(0x0000) // fade type
write_byte(0) // red
write_byte(50) // green
write_byte(200) // blue
write_byte(100) // alpha
message_end()
ice_entity( id, 0 )
// Broken glass sound
emit_sound(id, CHAN_BODY, "impalelaunch1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
// Get player's origin
static origin2[3]
get_user_origin(id, origin2)
// Glass shatter
message_begin(MSG_PVS, SVC_TEMPENTITY, origin2)
write_byte(TE_BREAKMODEL) // TE id
write_coord(origin2[0]) // x
write_coord(origin2[1]) // y
write_coord(origin2[2]+24) // z
write_coord(16) // size x
write_coord(16) // size y
write_coord(16) // size z
write_coord(random_num(-50, 50)) // velocity x
write_coord(random_num(-50, 50)) // velocity y
write_coord(25) // velocity z
write_byte(10) // random velocity
write_short(g_glassSpr) // model
write_byte(10) // count
write_byte(25) // life
write_byte(0x01) // flags
message_end()
}
public fw_SetModel(entity, const model[])
{
// We don't care
if (strlen(model) < 8)
return;
if (model[9] == 'f' && model[10] == 'l' && model[11] == 'a' && model[12] == 's' && model[13] == 'h' && model[14] == 'b') // Napalm Grenade
{
// Give it a glow
fm_set_rendering(entity, kRenderFxGlowShell, 84, 231, 247, kRenderNormal, 16);
set_pev(entity, pev_iuser2, FROST_CODE)
engfunc(EngFunc_SetModel, entity, W_MODEL);
// And a colored trail
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW) // TE id
write_short(entity) // entity
write_short(grenadetrail) // sprite
write_byte(10) // life
write_byte(10) // width
write_byte(0) // r
write_byte(191) // g
write_byte(255) // b
write_byte(200) // brightness
message_end()
}
}
public Event_NewRound()
{
for(new i = 0; i < get_maxplayers(); i++)
{
ice_entity( i, 0 )
}
}
public player_dead(id)
{
ice_entity( id, 0 )
}
public ami_frozen(id)
{
ice_entity( id, 1 )
}
stock ice_entity(id, status)
{
if(status)
{
static ent, Float:o[3]
if(!is_user_alive(id))
{
ice_entity(id,0)
return
}
if( is_valid_ent(iceent[id]))
{
if( pev( iceent[id], pev_iuser3 ) != id)
{
if(pev(iceent[id], pev_team) == 6969) remove_entity(iceent[id])
}
else
{
pev(id,pev_origin,o)
if( pev(id,pev_flags) & FL_DUCKING ) o[2] -= 15.0
else o[2] -= 35.0
entity_set_origin(iceent[id], o)
return
}
}
pev( id, pev_origin, o )
if( pev( id, pev_flags ) & FL_DUCKING ) o[2] -= 15.0
else o[2] -= 35.0
ent = create_entity("info_target")
set_pev( ent, pev_classname, "DareDevil" )
entity_set_model(ent, ice_model)
dllfunc(DLLFunc_Spawn, ent)
set_pev(ent, pev_solid, SOLID_BBOX)
set_pev(ent, pev_movetype, MOVETYPE_FLY)
entity_set_origin(ent, o)
entity_set_size(ent, Float:{ -3.0, -3.0, -3.0 }, Float:{ 3.0, 3.0, 3.0 })
set_pev( ent, pev_iuser3, id )
set_pev( ent, pev_team, 6969 )
set_rendering(ent, kRenderFxNone, 255, 255, 255, kRenderTransAdd, 255)
iceent[id] = ent
}
else
{
if(is_valid_ent(iceent[id]))
{
if( pev(iceent[id], pev_team) == 6969 ) remove_entity(iceent[id])
iceent[id] = -1
}
}
}
yeni_balast_ates(const Float:originF[3])
{
message_begin (MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(TE_SPRITE)
engfunc(EngFunc_WriteCoord, originF[0]+random_float(-5.0, 5.0))
engfunc(EngFunc_WriteCoord, originF[1]+random_float(-5.0, 5.0))
engfunc(EngFunc_WriteCoord, originF[2]+90.0)
write_short(g_frostexp)
write_byte(13) //Büyüklük
write_byte(150) //Saydamlık
message_end()
message_begin (MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( TE_SPRITETRAIL )
engfunc(EngFunc_WriteCoord, originF[ 0 ]) // başlangıç
engfunc(EngFunc_WriteCoord, originF[ 1 ])
engfunc(EngFunc_WriteCoord, originF[ 2 ] + 200.0)
engfunc(EngFunc_WriteCoord, originF[ 0 ]) // hızı
engfunc(EngFunc_WriteCoord, originF[ 1 ])
engfunc(EngFunc_WriteCoord, originF[ 2 ] + 30.0)
write_short(g_frost_gibs) // sprite dosyası
write_byte(30) // kaç adet dağılacağı
write_byte(random_num(27,30))
write_byte(2)
write_byte(50)
write_byte(10)
message_end()
}
stock fm_cs_get_weapon_ent_owner(ent)
{
if (pev_valid(ent) != 2)
return -1
return get_pdata_cbase(ent, 41, 4)
}
|
|