Из замерзшей модели zm видна def модель

Сообщения
316
Реакции
131
Помог
4 раз(а)
Основная информация

Проблема: Из замерзшей модели zm видна def модель

Ошибка:
Зомби замерзает и наружу как будто сам дьявол лезет дефолтная моделька, не должно такого быть
Дополнительная информация

Amx Mod X: ReAMXX

Билд:
Код:
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.3.0.590-dev
Build date: 20:57:36 Aug 4 2017 (1210)


ReGamedll:
Код:
ReGameDLL version: 5.3.0.221-dev
Build date: 17:13:45 Aug 19 2017


Список модулей:
PHP:
[ 1] MySQL                   1.8.3-Re    AMX Mod X Dev Team   running
[ 2] Fun 1.8.3-Re AMX Mod X Dev Team running
[ 3] Engine 1.8.3-Re AMX Mod X Dev Team running
[ 4] FakeMeta 1.8.3-Re AMX Mod X Dev Team running
[ 5] GeoIP 1.8.3-Re AMX Mod X Dev Team running
[ 6] CStrike 1.8.3-Re AMX Mod X Dev Team running
[ 7] CSX 1.8.3-Re AMX Mod X Dev Team running
[ 8] Ham Sandwich 1.8.3-Re AMX Mod X Dev Team running
[ 9] dummy_csx 1.0 AGHL.RU Dev Team running
[10] ReAPI 5.1.0.112- Asmodai & s1lent running
[11] ReAimDetector 0.1.7 ReHLDS Team running
[12] RegEx 1.8.3-Re AMX Mod X Dev Team running


Список плагинов:
HTML:
aimdetector и что то еще
[ 3] Cmd Checker 0.1.1 Mistrick cmdchecker.amxx running
[ 4] FreshBans 1.3.8b kanagava fresh_bans_138_ running
[ 5] Admin Loader 2.7 neygomon admin_loader.am running
[ 6] WebHS 0.1 kanagava fb_web_online.a running
[ 7] fb_forwards 0.1.5 Kanagava & Realu fb_forwards.amx running
[ 8] Admin Commands 1.8.3-Re AMXX Dev Team admincmd.amxx running
[ 9] Menus Front-End 1.5 neugomon menufront_end.a running
[ 10] Players Menu 1.3.2 neugomon players_menu.am running
[ 11] Maps Menu 1.8.3-Re AMXX Dev Team mapsmenu.amxx running
[ 12] Admin Chat 1.8.3-Re AMXX Dev Team adminchat.amxx running
[ 13] Admin Votes 1.8.3-Re AMXX Dev Team adminvote.amxx running
[ 14] Advanced MapChooser 1.1.0 neygomon mapchooser.amxx running
[ 15] Pause Plugins 1.8.3-Re AMXX Dev Team pausecfg.amxx running
[ 16] Stats Configuration 1.8.3-Re AMXX Dev Team statscfg.amxx running
[ 17] Restrict Weapons 1.8.3-Re AMXX Dev Team restmenu.amxx running
[ 18] Say me and Say hp 1.4 neygomon sayme.amxx debug
[ 19] CSStatsX SQL 0.7.4 serfreeman1337 csstatsx_sql.am running
[ 20] AES: StatsX Info Rank 0.1 serfreeman1337 aes_statsx_rank error
[ 21] Statsx Optimized 0.6 gyxoBka statsx.amxx running
[ 22] Biohazard 2.00 Beta cheap_suit biohazard.amxx debug
[ 23] knockback 0.2 cheap_suit bio_knockback2. debug
[ 24] Napalm Nades for Bio 1.3a MeRcyLeZZ bio_napalm_nade debug
[ 25] Buy Zone Create 1.0 ViniPux buy_zone_create debug
[ 26] In-Game Ads(MastaMan E 1.83 (Edit stupok in_game_ads_Mas running
[ 27] Damager_by_iChip 3.0 iChip damager_by_iChi debug
[ 28] Entity Remover 0.4 Exolent entity_remover. running
[ 29] Reset Score 0.0.2f wopox1337 reset_score.amx running
[ 30] Advanced Gag 1.7.0 neygomon amx_gag.amxx running
[ 31] [CS] Runes of Quake 0.5 81x08 cs_runes_of_qua debug
[ 32] Map Spawns Editor 1.0.16 iG_os map_spawns_edit running
[ 33] Menu na m 228 admin menu_na_m.amxx running
[ 34] DemoRecoder 1.1 neygomon amx_demorec.amx running
[ 35] Juicy Corpse 0.4 VEN bio_corpse.amxx running
[ 36] Autoresponder/Advertis 0.5 MaximusBrood ad_manager.amxx running
[ 37] Admin_Check 0.1 CepeH9 adm_vip_check.a running
[ 38] Obscura Cam 0.7 Nani (SkumTomteN ObscuraCam_0.7. running
[ 39] Afk Control 0.5.1 neygomon afk_control.amx running
[ 40] Permanent message 1.1 He3aBuCuM permanent_messa running
[ 41] PLUGIN VERSION AUTHOR forum_ips4.amxx running
[ 42] Aim Info 1.0 Quasar aiminfouser.amx running
[ 43] WeaponAmmo 1.0 ViniPux weapon_ammo.amx running
[ 44] unknown unknown unknown zm_no_flash.amx running
[ 45] Spawnhealth 1.0 leksys vip_hp.amxx debug
[ 46] SpawnGrenades 1.0 leksys vip_grenade.amx debug
[ 47] VSSpawnArmor 1.0 leksys vip_armor.amxx debug
[ 48] Custom Flashlight 0.5.4 ConnorMcLeod fonarik_only_vi running
[ 49] Grenade Drop 2.5 Eriurias & PRoST grenade_drop.am running
[ 50] Lite Admin ESP 1.0 neygomon admin_esp.amxx running
[ 51] WalkGuard 1.3.2 mogel walkguard_free. running
[ 52] Ping Control 1.31 neygomon Ping_Control.am running
[ 53] Spawn Money 1.1 Don.C Spawn_Money.amx running
[ 54] Hats 1.3 Next21 Team hat1337.amxx running
[ 55] MODELS 1.0 DUKKHAZ0R woomen_zm.amxx running
[ 56] VoteBan_by_SLIMSHADY 1.5 RAF_SLIMSHADY_MO voteban.amxx debug
[ 57] unknown unknown unknown switch_tm_admin running
[ 58] Chat Manager 1.1.1-11 Mistrick chatmanager.amx running
[ 59] Chat Manager: Addon 0.0.4-70 Mistrick chatmanager_add running


Список метамодулей:
PHP:
description      stat pend  file              vers      src   load  unlod
[ 1] VoiceTranscoder RUN - VoiceTranscoder. v2017RC3 ini ANY ANY
[ 2] SafeNameAndChat RUN - SafeNameAndChat. v1.1 ini ANY ANY
[ 3] AMX Mod X RUN - amxmodx_mm_i386. v1.8.3-R ini Start ANY
[ 4] Reunion RUN - reunion_mm_i386. v0.1.75 ini Start Never
[ 5] Rechecker RUN - rechecker_mm_i38 v2.3 ini Chlvl ANY
[ 6] ReSRDetector RUN - resrdetector_mm_ v0.1.0 ini Chlvl ANY
[ 7] MySQL RUN - mysql_amxx_i386. v1.8.3-R pl3 ANY ANY
[ 8] Fun RUN - fun_amxx_i386.so v1.8.3-R pl3 ANY ANY
[ 9] Engine RUN - engine_amxx_i386 v1.8.3-R pl3 ANY ANY
[10] FakeMeta RUN - fakemeta_amxx_i3 v1.8.3-R pl3 ANY ANY
[11] GeoIP RUN - geoip_amxx_i386. v1.8.3-R pl3 ANY ANY
[12] CStrike RUN - cstrike_amxx_i38 v1.8.3-R pl3 ANY ANY
[13] CSX RUN - csx_amxx_i386.so v1.8.3-R pl3 ANY ANY
[14] Ham Sandwich RUN - hamsandwich_amxx v1.8.3-R pl3 ANY ANY
[15] ReAPI RUN - reapi_amxx_i386. v5.1.0.1 pl3 ANY Never
[16] ReAimDetector RUN - reaimdetector_am v0.1.7 pl3 ANY Never


Исходник:
Код:
#include <amxmodx>
#include <fun>
#include <engine>
#include <fakemeta>
#include <cstrike>
#include <biohazard>

new hasFrostNade[33];
new isChilled[33];
new isFrozen[33];

new novaDisplay[33];
new Float:oldSpeed[33];

new glassGibs;
new trailSpr;
new smokeSpr;
new exploSpr;

#define FROST_RADIUS 240.0
#define FROST_R 0
#define FROST_G 206
#define FROST_B 209

#define TASK_REMOVE_CHILL 200
#define TASK_REMOVE_FREEZE 250


public plugin_init()
{
register_plugin("FrostNades","0.12b","Avalanche");

register_cvar("fn_on","1");
register_cvar("fn_hitself","0");
register_cvar("fn_los","0");

register_cvar("fn_maxdamage","100.0");
register_cvar("fn_mindamage","1.0");

register_cvar("fn_override","1");
register_cvar("fn_price","1500");

register_cvar("fn_chill_maxchance","100");
register_cvar("fn_chill_minchance","100");
register_cvar("fn_chill_duration","8");
register_cvar("fn_chill_speed","60");

register_cvar("fn_freeze_maxchance","100");
register_cvar("fn_freeze_minchance","40");
register_cvar("fn_freeze_duration","1");

register_event("DeathMsg","event_deathmsg","a");
register_event("HLTV", "new_round", "a", "1=0", "2=0");
register_event("CurWeapon","event_curweapon","b","1=1");
register_forward(FM_SetModel,"fw_setmodel");
register_think("grenade","think_grenade");

register_logevent("event_roundend",2,"0=World triggered","1=Round_End");
}

public plugin_precache()
{
precache_model("models/frostnova_v1.mdl");
glassGibs = precache_model("models/glassgibs.mdl");

precache_sound("warcraft3/frostnova.wav"); // grenade explodes
precache_sound("warcraft3/impalehit.wav"); // player is frozen
precache_sound("warcraft3/impalelaunch1.wav"); // frozen wears off
precache_sound("player/pl_duct2.wav"); // player is chilled

trailSpr = precache_model("sprites/laserbeam.spr");
smokeSpr = precache_model("sprites/steam1.spr");
exploSpr = precache_model("sprites/shockwave.spr");
}

public new_round(id)
{
if(!get_cvar_num("fn_on"))
return PLUGIN_CONTINUE;

// can't buy while dead
if(!is_user_alive(id))
return PLUGIN_HANDLED;

// no custom buy needed
if(get_cvar_num("fn_override"))
return PLUGIN_HANDLED;

if(is_user_zombie(id))
return PLUGIN_HANDLED;

// gimme gimme
hasFrostNade[id] = 1;

// display icon
message_begin(MSG_ONE,get_user_msgid("StatusIcon"),{0,0,0},id);
write_byte(1); // status (0=hide, 1=show, 2=flash)
write_string("dmg_cold"); // sprite name
write_byte(FROST_R); // red
write_byte(FROST_G); // green
write_byte(FROST_B); // blue
message_end();

return PLUGIN_HANDLED;
}

public event_infect2(id)
{
hasFrostNade[id] = 0
}

public client_PreThink(id)
{
if(!get_cvar_num("fn_on"))
return;

if(isFrozen[id])
{
entity_set_vector(id,EV_VEC_velocity,Float:{0.0,0.0,0.0});

new button = get_user_button(id), oldbuttons = entity_get_int(id,EV_INT_oldbuttons);
new flags = entity_get_int(id,EV_INT_flags);

// if are on the ground and about to jump, set the gravity too high to really do so
if((button & IN_JUMP) && !(oldbuttons & IN_JUMP) && (flags & FL_ONGROUND))
entity_set_float(id,EV_FL_gravity,999999.9); // I CAN'T STAND THE PRESSURE

// otherwise, set the gravity so low that they don't fall
else
entity_set_float(id,EV_FL_gravity,0.000001); // 0.0 doesn't work
}
}

public event_deathmsg()
{
if(!get_cvar_num("fn_on"))
return;

new id = read_data(2);

if(hasFrostNade[id])
{
hasFrostNade[id] = 0;
message_begin(MSG_ONE,get_user_msgid("StatusIcon"),{0,0,0},id);
write_byte(0); // status (0=hide, 1=show, 2=flash)
write_string("dmg_cold"); // sprite name
write_byte(FROST_R); // red
write_byte(FROST_G); // green
write_byte(FROST_B); // blue
message_end();
}

if(isChilled[id])
remove_chill(TASK_REMOVE_CHILL+id);

if(isFrozen[id])
remove_freeze(TASK_REMOVE_FREEZE+id);
}

public event_curweapon(id)
{
if(!get_cvar_num("fn_on"))
return;

if(is_user_zombie(id))
return;

// flash icon if frost grenade is out
if(hasFrostNade[id] && read_data(2) == CSW_FLASHBANG)
{
message_begin(MSG_ONE,get_user_msgid("StatusIcon"),{0,0,0},id);
write_byte(2); // status (0=hide, 1=show, 2=flash)
write_string("dmg_cold"); // sprite name
write_byte(FROST_R); // red
write_byte(FROST_G); // green
write_byte(FROST_B); // blue
message_end();
}
else if(hasFrostNade[id])
{
message_begin(MSG_ONE,get_user_msgid("StatusIcon"),{0,0,0},id);
write_byte(1); // status (0=hide, 1=show, 2=flash)
write_string("dmg_cold"); // sprite name
write_byte(FROST_R); // red
write_byte(FROST_G); // green
write_byte(FROST_B); // blue
message_end();
}

if(isChilled[id])
chill_player(id);

if(isFrozen[id])
freeze_player(id);
}

public fw_setmodel(ent,model[])
{
if(get_cvar_num("fn_on") < 1 || !is_valid_ent(ent))
return FMRES_IGNORED;

// not a smoke grenade
if(!equali(model,"models/w_flashbang.mdl"))
return FMRES_IGNORED;

// not yet thrown
if(entity_get_float(ent,EV_FL_gravity) == 0.0)
return FMRES_IGNORED;

new owner = entity_get_edict(ent,EV_ENT_owner);

// check to see if this isn't a frost grenade
if(!get_cvar_num("fn_override") && !hasFrostNade[owner])
return FMRES_IGNORED;

// store team in the grenade
entity_set_int(ent,EV_INT_team,get_user_team(owner));

// hide icon
if(hasFrostNade[owner])
{
hasFrostNade[owner] = 0;
message_begin(MSG_ONE,get_user_msgid("StatusIcon"),{0,0,0},owner);
write_byte(0); // status (0=hide, 1=show, 2=flash)
write_string("dmg_cold"); // sprite name
write_byte(FROST_R); // red
write_byte(FROST_G); // green
write_byte(FROST_B); // blue
message_end();
}

// give it a blue glow and a blue trail
set_rendering(ent,kRenderFxGlowShell,FROST_R,FROST_G,FROST_B);
set_beamfollow(ent,10,10,FROST_R,FROST_G,FROST_B,100);

// hack? flag to remember to track this grenade's think
entity_set_int(ent,EV_INT_bInDuck,1);

// track for when it will explode
set_task(1.6,"grenade_explode",ent);

return FMRES_IGNORED;
}

public think_grenade(ent)
{
if(get_cvar_num("fn_on") < 1 || !is_valid_ent(ent))
return PLUGIN_CONTINUE;

// hack? not a smoke grenade, or at least not a popular one
if(!entity_get_int(ent,EV_INT_bInDuck))
return PLUGIN_CONTINUE;

// stop it from exploding
return PLUGIN_HANDLED;
}

// the round ends
public event_roundend()
{
new i;
for(i=1;i<=32;i++)
{
if(isChilled)
remove_chill(TASK_REMOVE_CHILL+i);

if(isFrozen)
remove_freeze(TASK_REMOVE_FREEZE+i);
}
}

/*-------------------
OTHER MAIN FUNCTIONS
--------------------*/

// and boom goes the dynamite
public grenade_explode(ent)
{
if(get_cvar_num("fn_on") < 1 || !is_valid_ent(ent))
return;

// make the smoke
new origin[3], Float:originF[3];
entity_get_vector(ent,EV_VEC_origin,originF);
FVecIVec(originF,origin);

message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(5); // TE_SMOKE
write_coord(origin[0]); // x
write_coord(origin[1]); // y
write_coord(origin[2]); // z
write_short(smokeSpr); // sprite
write_byte(random_num(35,45)); // scale
write_byte(5); // framerate
message_end();

// debug
//show_xyz(origin,floatround(FROST_RADIUS));

// explosion
create_blast(origin);
emit_sound(ent,CHAN_WEAPON,"warcraft3/frostnova.wav",1.0,ATTN_NORM,0,PITCH_NORM);

// get grenade's owner
new owner = entity_get_edict(ent,EV_ENT_owner);

// get grenades team
new nadeTeam = entity_get_int(ent,EV_INT_team);

// collisions
new player;
while((player = find_ent_in_sphere(player,originF,FROST_RADIUS)) != 0)
{
// not a player, or a dead one
if(!is_user_alive(player))
continue;

if(!is_user_zombie(player))
continue;

// don't hit teammates if friendlyfire is off, but don't count self as teammate
if((!get_cvar_num("mp_friendlyfire") && nadeTeam == get_user_team(player)) && owner != player)
continue;

// don't hit self if the cvar is set
if(owner == player && !get_cvar_num("fn_hitself"))
continue;

// if user was frozen this check
new wasFrozen;

// get this player's origin for calculations
new Float:playerOrigin[3];
entity_get_vector(player,EV_VEC_origin,playerOrigin);

// check for line of sight
if(get_cvar_num("fn_los"))
{
new Float:endPos[3];
trace_line(ent,originF,playerOrigin,endPos);

// no line of sight (end point not at player's origin)
if(endPos[0] != playerOrigin[0] && endPos[1] != playerOrigin[1] && endPos[2] != playerOrigin[2])
continue;
}

// calculate our odds
new Float:chillChance = radius_calucation(playerOrigin,originF,FROST_RADIUS,get_cvar_float("fn_chill_maxchance"),get_cvar_float("fn_chill_minchance"));
new Float:freezeChance = radius_calucation(playerOrigin,originF,FROST_RADIUS,get_cvar_float("fn_freeze_maxchance"),get_cvar_float("fn_freeze_minchance"));

// deal damage
if(get_cvar_float("fn_maxdamage") > 0.0)
{
new Float:damage = radius_calucation(playerOrigin,originF,FROST_RADIUS,get_cvar_float("fn_maxdamage"),get_cvar_float("fn_mindamage"));

// half damage for friendlyfire
if(nadeTeam == get_user_team(player))
damage *= 0.5;

// see if this will kill player
if(floatround(entity_get_float(player,EV_FL_health)) - damage <= 0)
{
user_silentkill(player);
make_deathmsg(owner,player,0,"frostgrenade");

// update score
if(nadeTeam == get_user_team(player))
{
set_user_frags(owner,get_user_frags(owner)-1);

if(get_cvar_num("mp_tkpunish"))
cs_set_user_tked(owner,1,0);
}
else
set_user_frags(owner,get_user_frags(owner)+1);

// update scoreboard
message_begin(MSG_BROADCAST,get_user_msgid("ScoreInfo"));
write_byte(owner);
write_short(get_user_frags(owner));
write_short(cs_get_user_deaths(owner));
write_short(0);
write_short(get_user_team(owner));
message_end();

message_begin(MSG_BROADCAST,get_user_msgid("ScoreInfo"));
write_byte(player);
write_short(get_user_frags(player));
write_short(cs_get_user_deaths(player));
write_short(0);
write_short(get_user_team(player));
message_end();

continue;
}

fakedamage(player,"frostgrenade",damage,3);
}

// check for freeze
if(random_num(1,100) <= floatround(freezeChance) && !isFrozen[player])
{
wasFrozen = 1;
freeze_player(player);
isFrozen[player] = 1;

emit_sound(player,CHAN_BODY,"warcraft3/impalehit.wav",1.0,ATTN_NORM,0,PITCH_HIGH);
set_task(get_cvar_float("fn_freeze_duration"),"remove_freeze",TASK_REMOVE_FREEZE+player);

// if they don't already have a frostnova
if(!is_valid_ent(novaDisplay[player]))
{
// create the entity
new nova = create_entity("info_target");

// give it a size
new Float:maxs[3], Float:mins[3];
maxs = Float:{ 8.0, 8.0, 4.0 };
mins = Float:{ -8.0, -8.0, -4.0 };
entity_set_size(nova,mins,maxs);

// random orientation
new Float:angles[3];
angles[1] = float(random_num(0,359));
entity_set_vector(nova,EV_VEC_angles,angles);

// put it at their feet
new Float:playerMins[3], Float:novaOrigin[3];
entity_get_vector(player,EV_VEC_mins,playerMins);
entity_get_vector(player,EV_VEC_origin,novaOrigin);
novaOrigin[2] += playerMins[2];
entity_set_vector(nova,EV_VEC_origin,novaOrigin);

// mess with the model
entity_set_model(nova,"models/frostnova_v1.mdl");
entity_set_float(nova,EV_FL_animtime,1.0)
entity_set_float(nova,EV_FL_framerate,1.0)
entity_set_int(nova,EV_INT_sequence,0);
set_rendering(nova,kRenderFxNone,FROST_R,FROST_G,FROST_B,kRenderTransColor,100);

// remember this
novaDisplay[player] = nova;
}
}

// check for chill
if(random_num(1,100) <= floatround(chillChance) && !isChilled[player])
{
chill_player(player);
isChilled[player] = 1;

// don't play sound if player just got frozen,
// reason being it will be overriden and I like the other sound better
if(!wasFrozen)
emit_sound(player,CHAN_BODY,"player/pl_duct2.wav",1.0,ATTN_NORM,0,PITCH_LOW);

set_task(get_cvar_float("fn_chill_duration"),"remove_chill",TASK_REMOVE_CHILL+player);
}
}

// get rid of the old grenade
remove_entity(ent);
}

// apply the effects of being chilled
public chill_player(id)
{
// don't mess with their speed if they are frozen
if(isFrozen[id])
set_user_maxspeed(id,1.0); // 0.0 doesn't work
else
{
new speed = floatround(get_user_maxspeed(id) * (get_cvar_float("fn_chill_speed") / 100.0));
set_user_maxspeed(id,float(speed));
}

// add a blue tint to their screen
message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id);
write_short(~0); // duration
write_short(~0); // hold time
write_short(0x0004); // flags: FFADE_STAYOUT, ignores the duration, stays faded out until new ScreenFade message received
write_byte(FROST_R); // red
write_byte(FROST_G); // green
write_byte(FROST_B); // blue
write_byte(100); // alpha
message_end();

// make them glow and have a trail
set_user_rendering(id,kRenderFxGlowShell,FROST_R,FROST_G,FROST_B,kRenderNormal,1);

// bug fix
if(!isFrozen[id])
set_beamfollow(id,30,8,FROST_R,FROST_G,FROST_B,100);
}

// apply the effects of being frozen
public freeze_player(id)
{
new Float:speed = get_user_maxspeed(id);

// remember their old speed for when they get unfrozen,
// but don't accidentally save their frozen speed
if(speed > 1.0 && speed != oldSpeed[id])
{
// save their unchilled speed
if(isChilled[id])
{
new speed = floatround(get_user_maxspeed(id) / (get_cvar_float("fn_chill_speed") / 100.0));
oldSpeed[id] = float(speed);
}
else
oldSpeed[id] = speed;
}

// stop them from moving
set_user_maxspeed(id,1.0); // 0.0 doesn't work
entity_set_vector(id,EV_VEC_velocity,Float:{0.0,0.0,0.0});
entity_set_float(id,EV_FL_gravity,0.000001); // 0.0 doesn't work
}

// a player's chill runs out
public remove_chill(taskid)
{
remove_task(taskid);
new id = taskid - TASK_REMOVE_CHILL;

// no longer chilled
if(!isChilled[id])
return;

isChilled[id] = 0;

// only apply effects to this player if they are still connected
if(is_user_connected(id))
{
// clear screen fade
message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id);
write_short(0); // duration
write_short(0); // hold time
write_short(0); // flags
write_byte(0); // red
write_byte(0); // green
write_byte(0); // blue
write_byte(0); // alpha
message_end();

// restore speed and remove glow
new speed = floatround(get_user_maxspeed(id) / (get_cvar_float("fn_chill_speed") / 100.0));
set_user_maxspeed(id,float(speed));
set_user_rendering(id);

// kill their trail
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(99); // TE_KILLBEAM
write_short(id);
message_end();
}
}

// a player's freeze runs out
public remove_freeze(taskid)
{
remove_task(taskid);
new id = taskid - TASK_REMOVE_FREEZE;

// no longer frozen
if(!isFrozen[id])
return;

// if nothing happened to the model
if(is_valid_ent(novaDisplay[id]))
{
// get origin of their frost nova
new origin[3], Float:originF[3];
entity_get_vector(novaDisplay[id],EV_VEC_origin,originF);
FVecIVec(originF,origin);

// add some tracers
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(14); // TE_IMPLOSION
write_coord(origin[0]); // x
write_coord(origin[1]); // y
write_coord(origin[2] + 8); // z
write_byte(64); // radius
write_byte(10); // count
write_byte(3); // duration
message_end();

// add some sparks
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(9); // TE_SPARKS
write_coord(origin[0]); // x
write_coord(origin[1]); // y
write_coord(origin[2]); // z
message_end();

// add the shatter
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(108); // TE_BREAKMODEL
write_coord(origin[0]); // x
write_coord(origin[1]); // y
write_coord(origin[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(glassGibs); // model
write_byte(10); // count
write_byte(25); // life
write_byte(0x01); // flags: BREAK_GLASS
message_end();

// play a sound and remove the model
emit_sound(novaDisplay[id],CHAN_BODY,"warcraft3/impalelaunch1.wav",1.0,ATTN_NORM,0,PITCH_LOW);
remove_entity(novaDisplay[id]);
}

isFrozen[id] = 0;
novaDisplay[id] = 0;

// only apply effects to this player if they are still connected
if(is_user_connected(id))
{
// restore gravity
entity_set_float(id,EV_FL_gravity,1.0);

// if they are still chilled, set the speed rightly so. otherwise, restore it to complete regular.
if(isChilled[id])
{
set_beamfollow(id,30,8,FROST_R,FROST_G,FROST_B,100); // bug fix

new speed = floatround(oldSpeed[id] * (get_cvar_float("fn_chill_speed") / 100.0));
set_user_maxspeed(id,float(speed));
}
else
set_user_maxspeed(id,oldSpeed[id]);
}

oldSpeed[id] = 0.0;
}

/*----------------
UTILITY FUNCTIONS
-----------------*/

// my own radius calculations...
//
// 1. figure out how far a player is from a center point
// 2. figure the percentage this distance is of the overall radius
// 3. find a value between maxVal and minVal based on this percentage
//
// example: origin1 is 96 units away from origin2, and radius is 240.
// this player is then 60% towards the center from the edge of the sphere.
// let us say maxVal is 100.0 and minVal is 25.0. 60% progression from minimum
// to maximum becomes 70.0. tada!
public Float:radius_calucation(Float:origin1[3],Float:origin2[3],Float:radius,Float:maxVal,Float:minVal)
{
if(maxVal <= 0.0)
return 0.0;

if(minVal >= maxVal)
return minVal;

new Float:percent;

// figure out how far away the points are
new Float:distance = vector_distance(origin1,origin2);

// if we are close enough, assume we are at the center
if(distance < 40.0)
return maxVal;

// otherwise, calculate the distance range
else
percent = 1.0 - (distance / radius);

// we have the technology...
return minVal + (percent * (maxVal - minVal));
}

// displays x y z axis
public show_xyz(origin[3],radius)
{
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(0); // TE_BEAMPOINTS
write_coord(origin[0]); // start x
write_coord(origin[1]); // starty
write_coord(origin[2] + 1); // start z
write_coord(origin[0] + radius); // end x
write_coord(origin[1]); // end y
write_coord(origin[2] + 1); // end z
write_short(trailSpr); // sprite
write_byte(0); // starting frame
write_byte(0); // framerate
write_byte(100); // life
write_byte(8); // line width
write_byte(0); // noise
write_byte(255); // r
write_byte(0); // g
write_byte(0); // b
write_byte(200); // brightness
write_byte(0); // scroll speed
message_end();

message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(0); // TE_BEAMPOINTS
write_coord(origin[0]); // start x
write_coord(origin[1]); // starty
write_coord(origin[2] + 1); // start z
write_coord(origin[0]); // end x
write_coord(origin[1] + radius); // end y
write_coord(origin[2] + 1); // end z
write_short(trailSpr); // sprite
write_byte(0); // starting frame
write_byte(0); // framerate
write_byte(100); // life
write_byte(8); // line width
write_byte(0); // noise
write_byte(0); // r
write_byte(255); // g
write_byte(0); // b
write_byte(200); // brightness
write_byte(0); // scroll speed
message_end();

message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(0); // TE_BEAMPOINTS
write_coord(origin[0]); // start x
write_coord(origin[1]); // starty
write_coord(origin[2]); // start z
write_coord(origin[0]); // end x
write_coord(origin[1]); // end y
write_coord(origin[2] + radius); // end z
write_short(trailSpr); // sprite
write_byte(0); // starting frame
write_byte(0); // framerate
write_byte(100); // life
write_byte(8); // line width
write_byte(0); // noise
write_byte(0); // r
write_byte(0); // g
write_byte(255); // b
write_byte(200); // brightness
write_byte(0); // scroll speed
message_end();
}

// give an entity a trail
public set_beamfollow(ent,life,width,r,g,b,brightness)
{
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(22); // TE_BEAMFOLLOW
write_short(ent); // ball
write_short(trailSpr); // sprite
write_byte(life); // life
write_byte(width); // width
write_byte(r); // r
write_byte(g); // g
write_byte(b); // b
write_byte(brightness); // brightness
message_end();
}

// blue blast
public create_blast(origin[3])
{
// smallest ring
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(21); // TE_BEAMCYLINDER
write_coord(origin[0]); // start X
write_coord(origin[1]); // start Y
write_coord(origin[2]); // start Z
write_coord(origin[0]); // something X
write_coord(origin[1]); // something Y
write_coord(origin[2] + 385); // something Z
write_short(exploSpr); // sprite
write_byte(0); // startframe
write_byte(0); // framerate
write_byte(4); // life
write_byte(60); // width
write_byte(0); // noise
write_byte(FROST_R); // red
write_byte(FROST_G); // green
write_byte(FROST_B); // blue
write_byte(100); // brightness
write_byte(0); // speed
message_end();

// medium ring
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(21); // TE_BEAMCYLINDER
write_coord(origin[0]); // start X
write_coord(origin[1]); // start Y
write_coord(origin[2]); // start Z
write_coord(origin[0]); // something X
write_coord(origin[1]); // something Y
write_coord(origin[2] + 470); // something Z
write_short(exploSpr); // sprite
write_byte(0); // startframe
write_byte(0); // framerate
write_byte(4); // life
write_byte(60); // width
write_byte(0); // noise
write_byte(FROST_R); // red
write_byte(FROST_G); // green
write_byte(FROST_B); // blue
write_byte(100); // brightness
write_byte(0); // speed
message_end();

// largest ring
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(21); // TE_BEAMCYLINDER
write_coord(origin[0]); // start X
write_coord(origin[1]); // start Y
write_coord(origin[2]); // start Z
write_coord(origin[0]); // something X
write_coord(origin[1]); // something Y
write_coord(origin[2] + 555); // something Z
write_short(exploSpr); // sprite
write_byte(0); // startframe
write_byte(0); // framerate
write_byte(4); // life
write_byte(60); // width
write_byte(0); // noise
write_byte(FROST_R); // red
write_byte(FROST_G); // green
write_byte(FROST_B); // blue
write_byte(100); // brightness
write_byte(0); // speed
message_end();

// light effect
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(27); // TE_DLIGHT
write_coord(origin[0]); // x
write_coord(origin[1]); // y
write_coord(origin[2]); // z
write_byte(floatround(FROST_RADIUS/5.0)); // radius
write_byte(FROST_R); // r
write_byte(FROST_G); // g
write_byte(FROST_B); // b
write_byte(8); // life
write_byte(60); // decay rate
message_end();
}


Комментарий:
Зомби замерзает и модельки зм видна дефолтная моделька
 
В этой теме было размещено решение! Перейти к решению.

Download all Attachments

Garey

ninjaCow
Сообщения
411
Реакции
1,051
Помог
10 раз(а)
попробуйте закомментить все
set_user_rendering, и покажите результат, если дело в этом (что я думаю скорее всего) и хочется использовать эффект glow, то замените все set_user_rendering функции связанные с игроками на эту:
C++:

#include <fakemeta_util>

stock biohazard_set_rendering(id, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) {
{
#define MODEL_CLASSNAME "player_model"

new ent
ent = fm_find_ent_by_owner(-1, MODEL_CLASSNAME, id);

if(ent)
{
fm_set_user_rendering(ent, fx, r, g, b, render, amount);
}
}
 
Последнее редактирование:
Сообщения
316
Реакции
131
Помог
4 раз(а)
Garey, не нужен glow, просто заморозка
29 Авг 2017
попробуйте закомментить все
set_user_rendering
все как и было
30 Авг 2017
Вроде как это из за замены модели ледышки, вернул стандартную, все нормально
Но стали появляться ерор логи, хотя, оказывается они и раньше были
Код:
[FAKEMETA] Invalid entity
L 08/30/2017 - 09:31:12: [AMXX] Displaying debug trace (plugin "bio_frostnades.amxx", version "2.00-bh2.0")
L 08/30/2017 - 09:31:12: [AMXX] Run time error 10: native error (native "pev")
L 08/30/2017 - 09:31:12: [AMXX] [0] bio_frostnades.sma::ham_grenade_think (line 412)
 
Сообщения
2,143
Реакции
1,223
Помог
44 раз(а)
Сообщения
56
Реакции
46
Помог
1 раз(а)
Решение:
Код:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
#include <biohazard>

new const VERSION[] =        "3.1";

#define AMMO_FLASHBANG        11
#define AMMO_HEGRENADE        12
#define AMMO_SMOKEGRENADE    13
#define OFFSET_SHIELD        510
#define HAS_SHIELD        (1<<24)
#define USING_SHIELD        (1<<16)
#define DMG_GRENADE        (1<<24) // thanks arkshine
#define FFADE_IN            0x0000 // just here so we don't pass 0 into the function
#define BREAK_GLASS        0x01

#define FROST_RADIUS        240.0
#define NT_FLASHBANG        (1<<0) // 1; CSW:25
#define NT_HEGRENADE        (1<<1) // 2; CSW:4
#define NT_SMOKEGRENADE        (1<<2) // 4; CSW:9
#define TASK_REMOVE_CHILL    100
#define TASK_REMOVE_FREEZE    200
#define TASK_NADE_EXPLODE    300
    


new pcv_enabled, pcv_override, pcv_nadetypes, pcv_teams, pcv_price, pcv_roundlimit, pcv_buyzone, pcv_color,
pcv_by_radius, pcv_hitself, pcv_los, pcv_maxdamage, pcv_mindamage, pcv_chill_maxchance, pcv_chill_minchance,
pcv_chill_duration, pcv_chill_variance, pcv_chill_speed, pcv_freeze_maxchance, pcv_freeze_minchance,
pcv_freeze_duration, pcv_freeze_variance;

new maxPlayers, gmsgCurWeapon, gmsgScreenFade, gmsgStatusIcon, gmsgBlinkAcct, gmsgAmmoPickup, gmsgTextMsg,
gmsgWeapPickup, glassGibs, trailSpr, smokeSpr, exploSpr, czero, bot_quota, czBotHams, fwdPPT;

new isChilled[33], isFrozen[33], frostKilled[33], novaDisplay[33], Float:oldGravity[33], hasFrostNade[33],
boughtThisRound[33];

public plugin_init() {         
    register_plugin("FrostNades",VERSION,"Avalanche");
    register_cvar("fn_version",VERSION,FCVAR_SERVER);
    is_biomod_active() ? plugin_init2() : pause("ad")   
}

public plugin_init2()
{
    pcv_enabled = register_cvar("fn_enabled","1");
    pcv_override = register_cvar("fn_override","1");
    pcv_nadetypes = register_cvar("fn_nadetypes","4"); // NT_SMOKEGRENADE
    pcv_teams = register_cvar("fn_teams","3");
    pcv_price = register_cvar("fn_price","300");
    pcv_roundlimit = register_cvar("fn_roundlimit","0");
    pcv_buyzone = register_cvar("fn_buyzone","1");
    pcv_color = register_cvar("fn_color","0 206 209");

    pcv_by_radius = register_cvar("fn_by_radius","0.0");
    pcv_hitself = register_cvar("fn_hitself","1");
    pcv_los = register_cvar("fn_los","1");
    pcv_maxdamage = register_cvar("fn_maxdamage","20.0");
    pcv_mindamage = register_cvar("fn_mindamage","1.0");
    pcv_chill_maxchance = register_cvar("fn_chill_maxchance","100.0");
    pcv_chill_minchance = register_cvar("fn_chill_minchance","100.0");
    pcv_chill_duration = register_cvar("fn_chill_duration","7.0");
    pcv_chill_variance = register_cvar("fn_chill_variance","1.0");
    pcv_chill_speed = register_cvar("fn_chill_speed","60.0");
    pcv_freeze_maxchance = register_cvar("fn_freeze_maxchance","110.0");
    pcv_freeze_minchance = register_cvar("fn_freeze_minchance","40.0");
    pcv_freeze_duration = register_cvar("fn_freeze_duration","4.0");
    pcv_freeze_variance = register_cvar("fn_freeze_variance","0.5");

    
    new mod[6];
    get_modname(mod,5);
    if(equal(mod,"czero"))
    {
        czero = 1;
        bot_quota = get_cvar_pointer("bot_quota");
    }
    
    maxPlayers = get_maxplayers();
    gmsgCurWeapon = get_user_msgid("CurWeapon");
    gmsgScreenFade = get_user_msgid("ScreenFade");
    gmsgStatusIcon = get_user_msgid("StatusIcon");
    gmsgBlinkAcct = get_user_msgid("BlinkAcct");
    gmsgAmmoPickup = get_user_msgid("AmmoPickup");
    gmsgWeapPickup = get_user_msgid("WeapPickup");
    gmsgTextMsg = get_user_msgid("TextMsg");

    register_event("HLTV","event_new_round","a","1=0","2=0"); // new round
    register_logevent("event_round_end",2,"0=World triggered","1=Round_End");

    register_forward(FM_SetModel,"fw_setmodel",1);
    register_message(get_user_msgid("DeathMsg"),"msg_deathmsg");

    register_event("CurWeapon","event_curweapon","b","1=1");
    register_event("AmmoX","event_ammox","b","1=11","1=12","1=13"); // flash, HE, smoke

    RegisterHam(Ham_Killed,"player","ham_player_killed",1);
    RegisterHam(Ham_Think,"grenade","ham_grenade_think",0);
    
    register_clcmd("say /fn","buy_frostnade");
    register_clcmd("say_team /fn","buy_frostnade");
    register_clcmd("say /frostnade","buy_frostnade");
    register_clcmd("say_team /frostnade","buy_frostnade");
}

public plugin_precache()
{
    precache_model("models/frostnova.mdl");
    glassGibs = precache_model("models/glassgibs.mdl");

    precache_sound("warcraft3/frostnova.wav"); // grenade explodes
    precache_sound("warcraft3/impalehit.wav"); // player is frozen
    precache_sound("warcraft3/impalelaunch1.wav"); // frozen wears off
    precache_sound("player/pl_duct2.wav"); // player is chilled
    precache_sound("items/gunpickup2.wav"); // player buys frostnade

    trailSpr = precache_model("sprites/laserbeam.spr");
    smokeSpr = precache_model("sprites/steam1.spr");
    exploSpr = precache_model("sprites/shockwave.spr");
}

public client_putinserver(id)
{
    isChilled[id] = 0;
    isFrozen[id] = 0;
    frostKilled[id] = 0;
    novaDisplay[id] = 0;
    oldGravity[id] = 1.0;
    hasFrostNade[id] = 0;
    boughtThisRound[id] = 0;
    
    if(czero && !czBotHams && is_user_bot(id) && get_pcvar_num(bot_quota) > 0)
        set_task(0.1,"czbot_hook_ham",id);
}

public client_disconnect(id)
{
    if(isChilled[id]) task_remove_chill(TASK_REMOVE_CHILL+id);
    if(isFrozen[id]) task_remove_freeze(TASK_REMOVE_FREEZE+id);
}

// registering a ham hook for "player" won't register it for CZ bots,
// for some reason. so we have to register it by entity.
public czbot_hook_ham(id)
{
    if(!czBotHams && is_user_connected(id) && is_user_bot(id) && get_pcvar_num(bot_quota) > 0)
    {
        RegisterHamFromEntity(Ham_Killed,id,"ham_player_killed",1);
        czBotHams = 1;
    }
}

/****************************************
* PRIMARY FUNCTIONS AND SUCH
****************************************/

public buy_frostnade(id)
{
    if(!get_pcvar_num(pcv_enabled) || get_pcvar_num(pcv_override))
        return PLUGIN_CONTINUE;

    if(!is_user_alive(id)) return PLUGIN_HANDLED;

    // Bipbip : zombie cant buy fn
    if (is_user_zombie(id)) return PLUGIN_HANDLED;
    
    if(get_pcvar_num(pcv_buyzone) && !cs_get_user_buyzone(id))
    {
        client_print(id,print_center,"You are not in a buy zone."); // #Cstrike_NotInBuyZone won't work
        return PLUGIN_HANDLED;
    }

    if(!(get_pcvar_num(pcv_teams) & _:cs_get_user_team(id)))
    {
        // have to do it this way to format
        message_begin(MSG_ONE,gmsgTextMsg,_,id);
        write_byte(print_center);
        write_string("#Alias_Not_Avail");
        write_string("Frost Grenade");
        message_end();

        return PLUGIN_HANDLED;
    }

    if(hasFrostNade[id])
    {
        client_print(id,print_center,"#Cstrike_Already_Own_Weapon");
        return PLUGIN_HANDLED;
    }
    
    new limit = get_pcvar_num(pcv_roundlimit);
    if(limit && boughtThisRound[id] >= limit)
    {
        client_print(id,print_center,"#Cstrike_TitlesTXT_Cannot_Carry_Anymore");
        return PLUGIN_HANDLED;
    }
    
    new money = cs_get_user_money(id), price = get_pcvar_num(pcv_price);

    // need more vespene gas
    if(money < price)
    {
        client_print(id,print_center,"#Cstrike_TitlesTXT_Not_Enough_Money");
        
        message_begin(MSG_ONE_UNRELIABLE,gmsgBlinkAcct,_,id);
        write_byte(2);
        message_end();

        return PLUGIN_HANDLED;
    }
    
    // try to use smokegrenade, then flashbang, then hegrenade
    new wpnid = CSW_FLASHBANG, ammoid = AMMO_FLASHBANG, wpnName[20] = "weapon_flashbang", type = get_pcvar_num(pcv_nadetypes);
    if(!(type & NT_SMOKEGRENADE))
    {
        if(type & NT_FLASHBANG)
        {
            wpnid = CSW_FLASHBANG;
            ammoid = AMMO_FLASHBANG;
            wpnName = "weapon_flashbang";
        }
        else if(type & NT_HEGRENADE)
        {
            wpnid = CSW_HEGRENADE;
            ammoid = AMMO_HEGRENADE;
            wpnName = "weapon_hegrenade";
        }
    }
    
    hasFrostNade[id] = wpnid;
    boughtThisRound[id]++;
    cs_set_user_money(id,money - price);

    new ammo = cs_get_user_bpammo(id,wpnid);

    // give him one
    if(!ammo) ham_give_weapon(id,wpnName);
    else
    {
        cs_set_user_bpammo(id,wpnid,ammo+1);
        
        // just so the player can see what kind it is on his HUD

        message_begin(MSG_ONE,gmsgAmmoPickup,_,id);
        write_byte(ammoid);
        write_byte(ammo+2);
        message_end();

        message_begin(MSG_ONE,gmsgWeapPickup,_,id);
        write_byte(wpnid);
        message_end();
    }

    // won't play via ham_give_weapon or cs_set_user_bpammo
    engfunc(EngFunc_EmitSound,id,CHAN_ITEM,"items/gunpickup2.wav",VOL_NORM,ATTN_NORM,0,PITCH_NORM);
    
    return PLUGIN_HANDLED;
}

// new round starts
public event_new_round()
{
    if(!get_pcvar_num(pcv_enabled)) return;

    for(new i=1;i<=maxPlayers;i++)
    {
        boughtThisRound[i] = 0;

        if(is_user_alive(i))
        {
            if(isChilled[i]) task_remove_chill(TASK_REMOVE_CHILL+i);
            if(isFrozen[i]) task_remove_freeze(TASK_REMOVE_FREEZE+i);
        }
    }
}

// the round ends
public event_round_end()
{
    if(!get_pcvar_num(pcv_enabled)) return;

    for(new i=1;i<=maxPlayers;i++)
    {
        if(is_user_alive(i))
        {
            if(isChilled[i]) task_remove_chill(TASK_REMOVE_CHILL+i);
            if(isFrozen[i]) task_remove_freeze(TASK_REMOVE_FREEZE+i);
        }
    }
}

public fw_setmodel(ent,model[])
{
    if(!get_pcvar_num(pcv_enabled)) return FMRES_IGNORED;

    new owner = pev(ent,pev_owner);
    if(!is_user_connected(owner)) return FMRES_IGNORED;
    
    // this isn't going to explode
    new Float:dmgtime;
    pev(ent,pev_dmgtime,dmgtime);
    if(dmgtime == 0.0) return FMRES_IGNORED;
    
    new type, csw;
    if(model[7] == 'w' && model[8] == '_')
    {
        switch(model[9])
        {
            case 'h': { type = NT_HEGRENADE; csw = CSW_HEGRENADE; }
            case 'f': { type = NT_FLASHBANG; csw = CSW_FLASHBANG; }
            case 's': { type = NT_SMOKEGRENADE; csw = CSW_SMOKEGRENADE; }
        }
    }
    if(!type) return FMRES_IGNORED;
    
    new team = _:cs_get_user_team(owner);

    // have a frostnade (override off) ;OR; override enabled, on valid team, using valid frostnade type
    if(hasFrostNade[owner] == csw ||
    (get_pcvar_num(pcv_override) && (get_pcvar_num(pcv_teams) & team) && (get_pcvar_num(pcv_nadetypes) & type)))
    {
        hasFrostNade[owner] = 0;

        set_pev(ent,pev_team,team);
        set_pev(ent,pev_bInDuck,1); // flag it as a frostnade

        new Float:rgb[3];
        get_rgb_colors(team,rgb);

        set_glowshell(ent,rgb,16.0);
        set_beamfollow(ent,10,10,rgb,100);
    }

    return FMRES_IGNORED;
}

// freeze a player in place whilst he's frozen
public fw_playerprethink(id)
{
    if(isFrozen[id])
    {
        set_pev(id,pev_velocity,Float:{0.0,0.0,0.0}); // stop motion
        
        engfunc(EngFunc_SetClientMaxspeed,id,0.00001); // keep immobile
        
        new Float:gravity;
        pev(id,pev_gravity,gravity);
        
        // remember any gravity changes
        if(gravity != 0.000000001 && gravity != 999999999.9)
            oldGravity[id] = gravity;

        // if are on the ground and about to jump, set the gravity too high to really do so
        if((pev(id,pev_button) & IN_JUMP) && !(pev(id,pev_oldbuttons) & IN_JUMP) && (pev(id,pev_flags) & FL_ONGROUND))
            set_pev(id,pev_gravity,999999999.9);

        // otherwise, set the gravity so low that they don't fall
        else set_pev(id,pev_gravity,0.000000001);
    }
    
    return FMRES_IGNORED;
}

// override grenade kill message with skull and crossbones
public msg_deathmsg(msg_id,msg_dest,msg_entity)
{
    new victim = get_msg_arg_int(2);
    if(!is_user_connected(victim) || !frostKilled[victim]) return PLUGIN_CONTINUE;

    static weapon[8];
    get_msg_arg_string(4,weapon,7);
    if(equal(weapon,"grenade")) set_msg_arg_string(4,"frostgrenade");

    frostKilled[victim] = 0;
    return PLUGIN_CONTINUE;
}

// maintain speed on weapon changes
public event_curweapon(id)
{
    if(get_pcvar_num(pcv_enabled) && is_user_connected(id))
    {
        manage_icon(id);
        if(isChilled[id]) set_maxspeed(id);
    }
}

// a player's grenade ammo changes
public event_ammox(id)
{
    if(get_pcvar_num(pcv_enabled) && is_user_connected(id))
        manage_icon(id);
}

// killed to death
public ham_player_killed(id)
{
    hasFrostNade[id] = 0;
    manage_icon(id);

    if(isChilled[id]) task_remove_chill(TASK_REMOVE_CHILL+id);
    if(isFrozen[id]) task_remove_freeze(TASK_REMOVE_FREEZE+id);
}

// grenade is ticking away
public ham_grenade_think(ent)
{
    if(!pev_valid(ent)) return HAM_IGNORED;

    // not a frostnade
    if(!pev(ent,pev_bInDuck)) return HAM_IGNORED;
    
    new Float:dmgtime;
    pev(ent,pev_dmgtime,dmgtime);
    if(dmgtime > get_gametime()) return HAM_IGNORED;
    
    // and boom goes the dynamite
    frostnade_explode(ent);

    return HAM_SUPERCEDE;
}

// a frost grenade explodes
public frostnade_explode(ent)
{
    new nadeTeam = pev(ent,pev_team), owner = pev(ent,pev_owner), Float:nadeOrigin[3];
    pev(ent,pev_origin,nadeOrigin);
    
    // make the smoke
    message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
    write_byte(TE_SMOKE);
    write_coord(floatround(nadeOrigin[0])); // x
    write_coord(floatround(nadeOrigin[1])); // y
    write_coord(floatround(nadeOrigin[2])); // z
    write_short(smokeSpr); // sprite
    write_byte(random_num(30,40)); // scale
    write_byte(5); // framerate
    message_end();
    
    // explosion
    create_blast(nadeTeam,nadeOrigin);
    emit_sound(ent,CHAN_BODY,"warcraft3/frostnova.wav",VOL_NORM,ATTN_NORM,0,PITCH_NORM);

    // cache our cvars
    new Float:by_radius = get_pcvar_float(pcv_by_radius),
    hitself = get_pcvar_num(pcv_hitself), los = get_pcvar_num(pcv_los), Float:maxdamage = get_pcvar_float(pcv_maxdamage),
    Float:mindamage = get_pcvar_float(pcv_mindamage), Float:chill_maxchance = get_pcvar_float(pcv_chill_maxchance),
    Float:chill_minchance = get_pcvar_float(pcv_chill_minchance), Float:freeze_maxchance, Float:freeze_minchance;

    if(!by_radius)
    {
        freeze_maxchance = get_pcvar_float(pcv_freeze_maxchance);
        freeze_minchance = get_pcvar_float(pcv_freeze_minchance);
    }

    new ta, Float:targetOrigin[3], Float:distance, tr = create_tr2(), Float:fraction, Float:damage, gotFrozen;
    for(new target=1;target<=maxPlayers;target++)
    {
        // dead, invincible, or self attack that is not allowed
        if(!is_user_alive(target) || !is_user_zombie(target) || pev(target,pev_takedamage) == DAMAGE_NO
        || (pev(target,pev_flags) & FL_GODMODE) ||(target == owner && !hitself))
            continue;
        
        pev(target,pev_origin,targetOrigin);
        distance = vector_distance(nadeOrigin,targetOrigin);
        
        // too far
        if(distance > FROST_RADIUS) continue;

        // check line of sight
        if(los)
        {
            nadeOrigin[2] += 2.0;
            engfunc(EngFunc_TraceLine,nadeOrigin,targetOrigin,DONT_IGNORE_MONSTERS,ent,tr);
            nadeOrigin[2] -= 2.0;

            get_tr2(tr,TR_flFraction,fraction);
            if(fraction != 1.0 && get_tr2(tr,TR_pHit) != target) continue;
        }

        // damaged
        if(maxdamage > 0.0)
        {
            damage = radius_calc(distance,FROST_RADIUS,maxdamage,mindamage);
            if(ta) damage /= 2.0; // half damage for friendlyfire

            if(damage > 0.0)
            {
                frostKilled[target] = 1;
                ExecuteHamB(Ham_TakeDamage,target,ent,owner,damage,DMG_GRENADE);
                if(!is_user_alive(target)) continue; // dead now
                frostKilled[target] = 0;
            }
        }

        // frozen
        if((by_radius && radius_calc(distance,FROST_RADIUS,100.0,0.0) >= by_radius)
        || (!by_radius && random_num(1,100) <= floatround(radius_calc(distance,FROST_RADIUS,freeze_maxchance,freeze_minchance))))
        {
            gotFrozen = 1;

            freeze_player(target,nadeTeam);
            emit_sound(target,CHAN_BODY,"warcraft3/impalehit.wav",VOL_NORM,ATTN_NORM,0,PITCH_HIGH);
        }
        else gotFrozen = 0;
        
        // chilled
        if(by_radius || random_num(1,100) <= floatround(radius_calc(distance,FROST_RADIUS,chill_maxchance,chill_minchance)))
        {
            chill_player(target,nadeTeam);
            if(!gotFrozen) emit_sound(target,CHAN_BODY,"player/pl_duct2.wav",VOL_NORM,ATTN_NORM,0,PITCH_LOW);
        }
    }

    free_tr2(tr);
    set_pev(ent,pev_flags,pev(ent,pev_flags)|FL_KILLME);
}

freeze_player(id,nadeTeam)
{
    isFrozen[id] = nadeTeam;
    oldGravity[id] = get_class_data(get_user_class(id), DATA_GRAVITY);
    
    // register our forward only when we need it
    if(!fwdPPT) fwdPPT = register_forward(FM_PlayerPreThink,"fw_playerprethink",0);
    
    new Float:duration = get_pcvar_float(pcv_freeze_duration), Float:variance = get_pcvar_float(pcv_freeze_variance);
    duration += random_float(-variance,variance);

    remove_task(TASK_REMOVE_FREEZE+id);
    set_task(duration,"task_remove_freeze",TASK_REMOVE_FREEZE+id);
    
    if(!pev_valid(novaDisplay[id])) create_nova(id);
}

public task_remove_freeze(taskid)
{
    new id = taskid-TASK_REMOVE_FREEZE;
    
    if(pev_valid(novaDisplay[id]))
    {
        new origin[3], Float:originF[3];
        pev(novaDisplay[id],pev_origin,originF);
        FVecIVec(originF,origin);

        // add some tracers
        message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
        write_byte(TE_IMPLOSION);
        write_coord(origin[0]); // x
        write_coord(origin[1]); // y
        write_coord(origin[2] + 8); // z
        write_byte(64); // radius
        write_byte(10); // count
        write_byte(3); // duration
        message_end();

        // add some sparks
        message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
        write_byte(TE_SPARKS);
        write_coord(origin[0]); // x
        write_coord(origin[1]); // y
        write_coord(origin[2]); // z
        message_end();

        // add the shatter
        message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
        write_byte(TE_BREAKMODEL);
        write_coord(origin[0]); // x
        write_coord(origin[1]); // y
        write_coord(origin[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(glassGibs); // model
        write_byte(10); // count
        write_byte(25); // life
        write_byte(BREAK_GLASS); // flags
        message_end();

        emit_sound(novaDisplay[id],CHAN_BODY,"warcraft3/impalelaunch1.wav",VOL_NORM,ATTN_NORM,0,PITCH_LOW);
        set_pev(novaDisplay[id],pev_flags,pev(novaDisplay[id],pev_flags)|FL_KILLME);
    }

    isFrozen[id] = 0;
    novaDisplay[id] = 0;
    
    // unregister forward if we are no longer using it
    if(fwdPPT)
    {
        new i;
        for(i=1;i<=maxPlayers;i++) if(isFrozen[i]) break;
        if(i > maxPlayers)
        {
            unregister_forward(FM_PlayerPreThink,fwdPPT,0);
            fwdPPT = 0;
        }
    }

    if(!is_user_connected(id)) return;
    
    set_maxspeed(id);
    set_pev(id,pev_gravity,oldGravity[id]);
    
    // sometimes trail fades during freeze, reapply
    if(isChilled[id])
    {
        new Float:rgb[3];
        get_rgb_colors(isChilled[id],rgb);
        set_beamfollow(id,30,8,rgb,100);
    }
    else
    {
        // let other plugins change speed if they need to
        new clip, weapon = get_user_weapon(id,clip);
        emessage_begin(MSG_ONE,gmsgCurWeapon,_,id);
        ewrite_byte(1); // is current
        ewrite_byte(weapon); // weapon id
        ewrite_byte(clip); // clip ammo
        emessage_end();
    }
}

chill_player(id,nadeTeam)
{
    isChilled[id] = nadeTeam;
    
    set_maxspeed(id);
    
    new Float:duration = get_pcvar_float(pcv_chill_duration), Float:variance = get_pcvar_float(pcv_chill_variance);
    duration += random_float(-variance,variance);

    remove_task(TASK_REMOVE_CHILL+id);
    set_task(duration,"task_remove_chill",TASK_REMOVE_CHILL+id);

    new Float:rgb[3];
    get_rgb_colors(nadeTeam,rgb);

    set_glowshell(id,rgb,1.0);
    set_beamfollow(id,30,8,rgb,100);

    // add a blue tint to their screen
    message_begin(MSG_ONE,gmsgScreenFade,_,id);
    write_short(floatround(4096.0 * duration)); // duration
    write_short(floatround(2867.2 * duration)); // hold time (4096.0 * 0.7)
    write_short(FFADE_IN); // flags
    write_byte(floatround(rgb[0])); // red
    write_byte(floatround(rgb[1])); // green
    write_byte(floatround(rgb[2])); // blue
    write_byte(100); // alpha
    message_end();
}

public task_remove_chill(taskid)
{
    new id = taskid-TASK_REMOVE_CHILL;

    isChilled[id] = 0;
    if(!is_user_connected(id)) return;
    
    set_maxspeed(id);

    clear_glowshell(id);
    clear_beamfollow(id);
    
    // clear tint (might clear a flashbang?)
    message_begin(MSG_ONE,gmsgScreenFade,_,id);
    write_short(0); // duration
    write_short(0); // hold time
    write_short(FFADE_IN); // flags
    write_byte(105); // red
    write_byte(0); // green
    write_byte(150); // blue
    write_byte(0); // alpha
    message_end();
    
    if(!isFrozen[id])
    {
        // let other plugins change speed if they need to
        new clip, weapon = get_user_weapon(id,clip);
        emessage_begin(MSG_ONE,gmsgCurWeapon,_,id);
        ewrite_byte(1); // is current
        ewrite_byte(weapon); // weapon id
        ewrite_byte(clip); // clip ammo
        emessage_end();
    }
}

// set my maxspeed to whatever it should be
set_maxspeed(id)
{
    if(isFrozen[id]) return engfunc(EngFunc_SetClientMaxspeed,id,0.00001);

    new Float:speed = get_class_data(get_user_class(id), DATA_SPEED);
    if(isChilled[id]) speed *= (get_pcvar_float(pcv_chill_speed) / 100.0);
    return engfunc(EngFunc_SetClientMaxspeed,id,speed);
}

// make a frost nova at a player's feet
create_nova(id)
{
    new nova = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"));

    engfunc(EngFunc_SetSize,nova,Float:{-8.0,-8.0,-4.0},Float:{8.0,8.0,4.0});
    engfunc(EngFunc_SetModel,nova,"models/frostnova.mdl");

    // random orientation
    new Float:angles[3];
    angles[1] = random_float(0.0,360.0);
    set_pev(nova,pev_angles,angles);

    // put it at their feet
    new Float:playerMins[3], Float:novaOrigin[3];
    pev(id,pev_mins,playerMins);
    pev(id,pev_origin,novaOrigin);
    novaOrigin[2] += playerMins[2];
    engfunc(EngFunc_SetOrigin,nova,novaOrigin);

    // make it translucent
    get_rgb_colors(isFrozen[id],angles); // let's just use angles
    set_pev(nova,pev_rendercolor,angles); // ^
    set_pev(nova,pev_rendermode,kRenderTransColor);
    set_pev(nova,pev_renderamt,100.0);

    novaDisplay[id] = nova;
}

// manage our snowflake (show it, hide it, flash it?)
manage_icon(id)
{
    new status, team = _:cs_get_user_team(id);

    // so if I have it, status = 1; if I also have it out, status = 2
    if(get_pcvar_num(pcv_enabled))
    {
        if(hasFrostNade[id])
        {
            status = 1;
            if(get_user_weapon(id) == hasFrostNade[id]) status = 2;
        }
        else if(get_pcvar_num(pcv_override) && (get_pcvar_num(pcv_teams) & team))
        {
            new weapon = get_user_weapon(id), types = get_pcvar_num(pcv_nadetypes);

            if(types & NT_HEGRENADE)
            {
                if(cs_get_user_bpammo(id,CSW_HEGRENADE))
                {
                    status = 1;
                    if(weapon == CSW_HEGRENADE) status = 2;
                }
            }
            if(status != 2 && (types & NT_SMOKEGRENADE))
            {
                if(cs_get_user_bpammo(id,CSW_SMOKEGRENADE))
                {
                    status = 1;
                    if(weapon == CSW_SMOKEGRENADE) status = 2;
                }
            }
            if(status != 2 && (types & NT_FLASHBANG))
            {
                if(cs_get_user_bpammo(id,CSW_FLASHBANG))
                {
                    status = 1;
                    if(weapon == CSW_FLASHBANG) status = 2;
                }
            }
        }
    }
    
    new Float:rgb[3];
    if(status) get_rgb_colors(team,rgb); // only get colors if we need to
    
    message_begin(MSG_ONE_UNRELIABLE,gmsgStatusIcon,_,id);
    write_byte(status); // status (0=hide, 1=show, 2=flash)
    write_string("dmg_cold"); // sprite name
    write_byte(floatround(rgb[0])); // red
    write_byte(floatround(rgb[1])); // green
    write_byte(floatround(rgb[2])); // blue
    message_end();
}

/****************************************
* UTILITY FUNCTIONS
****************************************/

// make the explosion effects
create_blast(team,Float:originF[3])
{
    new origin[3];
    FVecIVec(originF,origin);

    new Float:rgbF[3], rgb[3];
    get_rgb_colors(team,rgbF);
    FVecIVec(rgbF,rgb);

    // smallest ring
    message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
    write_byte(TE_BEAMCYLINDER);
    write_coord(origin[0]); // x
    write_coord(origin[1]); // y
    write_coord(origin[2]); // z
    write_coord(origin[0]); // x axis
    write_coord(origin[1]); // y axis
    write_coord(origin[2] + 385); // z axis
    write_short(exploSpr); // sprite
    write_byte(0); // start frame
    write_byte(0); // framerate
    write_byte(4); // life
    write_byte(60); // width
    write_byte(0); // noise
    write_byte(rgb[0]); // red
    write_byte(rgb[1]); // green
    write_byte(rgb[2]); // blue
    write_byte(100); // brightness
    write_byte(0); // speed
    message_end();

    // medium ring
    message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
    write_byte(TE_BEAMCYLINDER);
    write_coord(origin[0]); // x
    write_coord(origin[1]); // y
    write_coord(origin[2]); // z
    write_coord(origin[0]); // x axis
    write_coord(origin[1]); // y axis
    write_coord(origin[2] + 470); // z axis
    write_short(exploSpr); // sprite
    write_byte(0); // start frame
    write_byte(0); // framerate
    write_byte(4); // life
    write_byte(60); // width
    write_byte(0); // noise
    write_byte(rgb[0]); // red
    write_byte(rgb[1]); // green
    write_byte(rgb[2]); // blue
    write_byte(100); // brightness
    write_byte(0); // speed
    message_end();

    // largest ring
    message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
    write_byte(TE_BEAMCYLINDER);
    write_coord(origin[0]); // x
    write_coord(origin[1]); // y
    write_coord(origin[2]); // z
    write_coord(origin[0]); // x axis
    write_coord(origin[1]); // y axis
    write_coord(origin[2] + 555); // z axis
    write_short(exploSpr); // sprite
    write_byte(0); // start frame
    write_byte(0); // framerate
    write_byte(4); // life
    write_byte(60); // width
    write_byte(0); // noise
    write_byte(rgb[0]); // red
    write_byte(rgb[1]); // green
    write_byte(rgb[2]); // blue
    write_byte(100); // brightness
    write_byte(0); // speed
    message_end();

    // light effect
    message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
    write_byte(TE_DLIGHT);
    write_coord(origin[0]); // x
    write_coord(origin[1]); // y
    write_coord(origin[2]); // z
    write_byte(floatround(FROST_RADIUS/5.0)); // radius
    write_byte(rgb[0]); // r
    write_byte(rgb[1]); // g
    write_byte(rgb[2]); // b
    write_byte(8); // life
    write_byte(60); // decay rate
    message_end();
}

// give an entity a glowshell
set_glowshell(ent,Float:rgb[3],Float:amount)
{
    set_pev(ent,pev_renderfx,kRenderFxGlowShell);
    set_pev(ent,pev_rendercolor,rgb);
    set_pev(ent,pev_renderamt,amount);
}

// take away the glowshell
clear_glowshell(ent)
{
    set_pev(ent,pev_renderfx,kRenderFxNone);
    set_pev(ent,pev_rendercolor,Float:{255.0,255.0,255.0});
    set_pev(ent,pev_renderamt,16.0);
}

// give an entity a beam trail
set_beamfollow(ent,life,width,Float:rgb[3],brightness)
{
    clear_beamfollow(ent);

    message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
    write_byte(TE_BEAMFOLLOW);
    write_short(ent); // entity
    write_short(trailSpr); // sprite
    write_byte(life); // life
    write_byte(width); // width
    write_byte(floatround(rgb[0])); // red
    write_byte(floatround(rgb[1])); // green
    write_byte(floatround(rgb[2])); // blue
    write_byte(brightness); // brightness
    message_end();
}

// removes beam trails from an entity
clear_beamfollow(ent)
{
    message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
    write_byte(TE_KILLBEAM);
    write_short(ent); // entity
    message_end();
}   


// gets RGB colors from the cvar
get_rgb_colors(team,Float:rgb[3])
{
    static color[12], parts[3][4];
    get_pcvar_string(pcv_color,color,11);
    
    // if cvar is set to "team", use colors based on the given team
    if(equali(color,"team",4))
    {
        if(team == 1)
        {
            rgb[0] = 150.0;
            rgb[1] = 0.0;
            rgb[2] = 0.0;
        }
        else
        {
            rgb[0] = 0.0;
            rgb[1] = 0.0;
            rgb[2] = 150.0;
        }
    }
    else
    {
        parse(color,parts[0],3,parts[1],3,parts[2],3);
        rgb[0] = floatstr(parts[0]);
        rgb[1] = floatstr(parts[1]);
        rgb[2] = floatstr(parts[2]);
    }
}

// scale a value equally (inversely?) with the distance that something
// is from the center of another thing. that makes pretty much no sense,
// so basically, the closer we are to the center of a ring, the higher
// our value gets.
//
// EXAMPLE: distance = 60.0, radius = 240.0, maxVal = 100.0, minVal = 20.0
// we are 0.75 (1.0-(60.0/240.0)) of the way to the radius, so scaled with our
// values, it comes out to 80.0 (20.0 + (0.75 * (100.0 - 20.0)))
Float:radius_calc(Float:distance,Float:radius,Float:maxVal,Float:minVal)
{
    if(maxVal <= 0.0) return 0.0;
    if(minVal >= maxVal) return minVal;
    return minVal + ((1.0 - (distance / radius)) * (maxVal - minVal));
}

// gives a player a weapon efficiently
stock ham_give_weapon(id,weapon[])
{
    if(!equal(weapon,"weapon_",7)) return 0;

    new wEnt = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,weapon));
    if(!pev_valid(wEnt)) return 0;

     set_pev(wEnt,pev_spawnflags,SF_NORESPAWN);
    dllfunc(DLLFunc_Spawn,wEnt);
    
    if(!ExecuteHamB(Ham_AddPlayerItem,id,wEnt))
    {
        if(pev_valid(wEnt)) set_pev(wEnt,pev_flags,pev(wEnt,pev_flags) | FL_KILLME);
        return 0;
    }

    ExecuteHamB(Ham_Item_AttachToPlayer,wEnt,id)
    return 1;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang9226\\ f0\\ fs16 \n\\ par }
*/
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу