q7291172
|
分享:
▼
x0
|
[1.6][插件] 寒冰手雷怎么修改
寒冰手雷怎么修改 我有源码! 我想修改成支持biohazard 以前的有BUG!有些僵尸不能冰到! 我修改后也不能冰到!只是把人冰人的BUG修改了! 僵尸冰到了,他居然还能可以动! 求帮助!
/*------------------- INCLUDES AND DEFINES --------------------*/ #include <amxmodx> #include <fakemeta> #include <cstrike> #define VERSION "0.14" // for the explosion #define FROST_RADIUS 240.0 #define FROST_R 0 #define FROST_G 206 #define FROST_B 209 // for the tasks #define TASK_REMOVE_CHILL 200 #define TASK_REMOVE_FREEZE 250 // for detecting a shield (thanks connorr) #define OFFSET_SHIELD 510 #define HAS_SHIELD (1<<24) #define USING_SHIELD (1<<16) // fn_nadetype enum { NADE_SMOKE = 1, NADE_FLASH, NADE_HE }; // used by regular_maxspeed near the bottom new Float:maxSpeed[31] = { 0.0, 250.0, 0.0, 260.0, 250.0, 240.0, 250.0, 250.0, 240.0, 250.0, 250.0, 250.0, 250.0, 210.0, 240.0, 240.0, 250.0, 250.0, 210.0, 250.0, 220.0, 230.0, 230.0, 250.0, 210.0, 250.0, 250.0, 235.0, 221.0, 250.0, 245.0 }; // player values new hasFrostNade[33], isChilled[33], isFrozen[33], novaDisplay[33], Float:oldGravity[33]; // misc values new glassGibs, trailSpr, smokeSpr, exploSpr, maxPlayers; // cvar values new fn_on, fn_hitself, fn_los, fn_override, fn_buyzone, fn_nadetype, fn_price, fn_maxdamage, fn_mindamage, fn_chill_maxchance, fn_chill_minchance, fn_chill_duration, fn_chill_speed, fn_freeze_maxchance, fn_freeze_minchance, fn_freeze_duration, mp_friendlyfire, mp_tkpunish; /*---------------- LOADING FUNCTIONS -----------------*/ // 3, 2, 1: blastoff! public plugin_init() { register_plugin("FrostNades",VERSION,"Avalanche"); maxPlayers = get_maxplayers(); fn_on = register_cvar("fn_on","1"); fn_hitself = register_cvar("fn_hitself","1"); fn_los = register_cvar("fn_los","0"); fn_override = register_cvar("fn_override","1"); fn_buyzone = register_cvar("fn_buyzone","1"); fn_nadetype = register_cvar("fn_nadetype","1"); fn_price = register_cvar("fn_price","300"); fn_maxdamage = register_cvar("fn_maxdamage","20.0"); fn_mindamage = register_cvar("fn_mindamage","1.0"); fn_chill_maxchance = register_cvar("fn_chill_maxchance","100"); fn_chill_minchance = register_cvar("fn_chill_minchance","100"); fn_chill_duration = register_cvar("fn_chill_duration","8.0"); fn_chill_speed = register_cvar("fn_chill_speed","60.0"); fn_freeze_maxchance = register_cvar("fn_freeze_maxchance","100"); fn_freeze_minchance = register_cvar("fn_freeze_minchance","40"); fn_freeze_duration = register_cvar("fn_freeze_duration","4.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"); register_event("DeathMsg","event_deathmsg","a"); register_event("CurWeapon","event_curweapon","b","1=1"); register_event("AmmoX","event_ammox","b","1=11"); // flash register_event("AmmoX","event_ammox","b","1=12"); // he register_event("AmmoX","event_ammox","b","1=13"); // smoke register_logevent("event_roundend",2,"0=World triggered","1=Round_End"); register_forward(FM_SetModel,"fw_setmodel"); } // wait for cvars and grab pointers public plugin_cfg() { mp_friendlyfire = get_cvar_pointer("mp_friendlyfire"); mp_tkpunish = get_cvar_pointer("mp_tkpunish"); } // get in the cache and be quiet!! 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 trailSpr = precache_model("sprites/laserbeam.spr"); smokeSpr = precache_model("sprites/steam1.spr"); exploSpr = precache_model("sprites/shockwave.spr"); } /*------------ HOOK HANDLERS -------------*/ // player wants to buy a grenade public buy_frostnade(id) { if(!get_pcvar_num(fn_on)) return PLUGIN_CONTINUE; // dead, no custom buy needed, or not in a buyzone if(!is_user_alive(id) || get_pcvar_num(fn_override) || (get_pcvar_num(fn_buyzone) && !cs_get_user_buyzone(id))) return PLUGIN_HANDLED; new money = cs_get_user_money(id), price = get_pcvar_num(fn_price); // need more vespene gas if(money < price) { client_print(id,print_center,"#Not_Enough_Money"); return PLUGIN_HANDLED; } new nadetype = get_pcvar_num(fn_nadetype), csw = cvar_to_csw(nadetype); // already have a frost grenade, or 2 if((nadetype != NADE_FLASH && hasFrostNade[id]) || hasFrostNade[id] >= 2) { client_print(id,print_center,"#Cstrike_Already_Own_Weapon"); return PLUGIN_HANDLED; } // gimme gimme hasFrostNade[id] += 1; // give us one if we need it new bpammo = cs_get_user_bpammo(id,csw); if(!bpammo || (bpammo < 2 && nadetype == NADE_FLASH)) { static name[20]; get_weaponname(csw,name,19); // pretty much fm_give_item from VEN's Fakemeta Utilities new ent = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,name)); if(pev_valid(ent)) { new Float:origin[3]; pev(id,pev_origin,origin); set_pev(ent,pev_origin,origin); set_pev(ent,pev_spawnflags,pev(ent,pev_spawnflags)|SF_NORESPAWN); dllfunc(DLLFunc_Spawn,ent); new save = pev(ent,pev_solid); dllfunc(DLLFunc_Touch,ent,id); if(pev(ent,pev_solid) == save) engfunc(EngFunc_RemoveEntity,ent); } } cs_set_user_money(id,money - price); // display icon set_snowflake(id,1); return PLUGIN_HANDLED; } // someone dies public event_deathmsg() { if(!get_pcvar_num(fn_on)) return; new id = read_data(2); if(id < 0 || id > 32) return; if(hasFrostNade[id]) { hasFrostNade[id] = 0; set_snowflake(id,0); } if(isChilled[id]) remove_chill(TASK_REMOVE_CHILL+id); if(isFrozen[id]) remove_freeze(TASK_REMOVE_FREEZE+id); oldGravity[id] = 1.0; } // a player changes weapons public event_curweapon(id) { if(!get_pcvar_num(fn_on) || !is_user_connected(id)) return; manage_icon(id); // redo speeds if(isChilled[id]) chill_player(id); if(isFrozen[id]) freeze_player(id); } // a player's grenade ammo changes public event_ammox(id) { if(get_pcvar_num(fn_on) && is_user_connected(id)) manage_icon(id); } // when a model is set public fw_setmodel(ent,model[]) { if(!get_pcvar_num(fn_on) || !pev_valid(ent)) return FMRES_IGNORED; new nadetype = get_pcvar_num(fn_nadetype); // not the type of grenade that is a frostnade if((nadetype == NADE_FLASH && !equal(model,"models/w_flashbang.mdl")) || (nadetype == NADE_HE && !equal(model,"models/w_hegrenade.mdl")) || (nadetype != NADE_FLASH && nadetype != NADE_HE && !equal(model,"models/w_smokegrenade.mdl"))) return FMRES_IGNORED; // not yet thrown new Float:gravity; if(pev(ent,pev_gravity,gravity) == 0.0) return FMRES_IGNORED; new owner = pev(ent,pev_owner); if(!is_user_connected(owner)) return FMRES_IGNORED; // check to see if this isn't a frost grenade if(!get_pcvar_num(fn_override) && !hasFrostNade[owner]) return FMRES_IGNORED; // store team in the grenade set_pev(ent,pev_team,_:cs_get_user_team(owner)); if(hasFrostNade[owner]) { hasFrostNade[owner] -= 1; if(hasFrostNade[owner] <= 0) set_snowflake(owner,0); } // give it a blue glow and a blue trail fm_set_rendering(ent,kRenderFxGlowShell,FROST_R,FROST_G,FROST_B); set_beamfollow(ent,10,10,FROST_R,FROST_G,FROST_B,100); // flag to remember to track this grenade's think set_pev(ent,pev_bInDuck,1); new Float:dmgtime, Float:now = get_gametime(); pev(ent,pev_dmgtime,dmgtime); // track for when it will explode set_task(dmgtime-now,"grenade_explode",ent); // stop from exploding set_pev(ent,pev_dmgtime,now+60.0); return FMRES_IGNORED; } // the round ends public event_roundend() { if(!get_pcvar_num(fn_on)) return; new i; for(i=1;i<=maxPlayers;i++) { if(isChilled) remove_chill(TASK_REMOVE_CHILL+i); if(isFrozen) remove_freeze(TASK_REMOVE_FREEZE+i); oldGravity = 1.0; } } /*------------------- OTHER MAIN FUNCTIONS --------------------*/ // and boom goes the dynamite public grenade_explode(ent) { if(!get_pcvar_num(fn_on) || !pev_valid(ent)) return; new Float:origin[3]; pev(ent,pev_origin,origin); // make the smoke message_begin(MSG_BROADCAST,SVC_TEMPENTITY); write_byte(TE_SMOKE); write_coord(floatround(origin[0])); // x write_coord(floatround(origin[1])); // y write_coord(floatround(origin[2])); // z write_short(smokeSpr); // sprite write_byte(random_num(35,45)); // scale write_byte(5); // framerate message_end(); // explosion create_blast(origin); emit_sound(ent,CHAN_WEAPON,"warcraft3/frostnova.wav",1.0,ATTN_NORM,0,PITCH_NORM); new owner = pev(ent,pev_owner), nadeTeam = pev(ent,pev_team); // save cvars new Float:chill_maxchance = get_pcvar_float(fn_chill_maxchance), Float:chill_minchance = get_pcvar_float(fn_chill_minchance), Float:freeze_maxchance = get_pcvar_float(fn_freeze_maxchance), Float:freeze_minchance = get_pcvar_float(fn_freeze_minchance), Float:maxdamage = get_pcvar_float(fn_maxdamage), Float:mindamage = get_pcvar_float(fn_mindamage), Float:freeze_duration = get_pcvar_float(fn_freeze_duration), Float:chill_duration = get_pcvar_float(fn_chill_duration); // values we will be using in the loop new player, wasFrozen, tr, playerTeam, Float:health, Float:damage, Float:frags, Float:playerOrigin[3], Float:end[3], Float:chillChance, Float:freezeChance; // go through collisions while((player = engfunc(EngFunc_FindEntityInSphere,player,origin,FROST_RADIUS)) != 0) { // not a player, or a dead one if(!is_user_alive(player)) continue; playerTeam = _:cs_get_user_team(player); // don't hit teammates if friendlyfire is off, but don't count self as teammate if(player != owner && !get_pcvar_num(mp_friendlyfire) && nadeTeam == playerTeam) continue; // don't hit self if the cvar is set if(owner == player && !get_pcvar_num(fn_hitself)) continue; // get this player's origin for calculations pev(player,pev_origin,playerOrigin); // check for line of sight if(get_pcvar_num(fn_los)) { tr = create_tr2(); origin[2] += 2.0; // out of ground engfunc(EngFunc_TraceLine,origin,playerOrigin,DONT_IGNORE_MONSTERS,ent,tr); get_tr2(tr,TR_vecEndPos,end); free_tr2(tr); origin[2] -= 2.0; // no line of sight (could not draw line from nade to player). // TR_pHit appears to not work at all for some reason. if(vector_distance(playerOrigin,end) > 1.0) continue; } // calculate our odds chillChance = radius_calucation(playerOrigin,origin,FROST_RADIUS,chill_maxchance,chill_minchance); freezeChance = radius_calucation(playerOrigin,origin,FROST_RADIUS,freeze_maxchance,freeze_minchance); // deal damage if(maxdamage > 0.0) { damage = radius_calucation(playerOrigin,origin,FROST_RADIUS,maxdamage,mindamage); // half damage for friendlyfire if(nadeTeam == playerTeam) damage *= 0.5; // see if this will kill player pev(player,pev_health,health); if(health - damage <= 0.0) { user_silentkill(player); make_deathmsg(owner,player,0,"frostgrenade"); // update score if(nadeTeam == playerTeam) { pev(owner,pev_frags,frags); set_pev(owner,pev_frags,frags-1.0); if(player != owner && get_pcvar_num(mp_tkpunish)) cs_set_user_tked(owner,1,0); } else { pev(owner,pev_frags,frags); set_pev(owner,pev_frags,frags+1.0); } // update scoreboard pev(owner,pev_frags,frags); message_begin(MSG_BROADCAST,get_user_msgid("ScoreInfo")); write_byte(owner); write_short(floatround(frags)); write_short(cs_get_user_deaths(owner)); write_short(0); write_short(nadeTeam); message_end(); pev(player,pev_frags,frags); message_begin(MSG_BROADCAST,get_user_msgid("ScoreInfo")); write_byte(player); write_short(floatround(frags)); write_short(cs_get_user_deaths(player)); write_short(0); write_short(playerTeam); message_end(); continue; } fm_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); remove_task(TASK_REMOVE_FREEZE+player); set_task(freeze_duration,"remove_freeze",TASK_REMOVE_FREEZE+player); // if they don't already have a frostnova if(!pev_valid(novaDisplay[player])) create_nova(player); } // 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); remove_task(TASK_REMOVE_CHILL+player); set_task(chill_duration,"remove_chill",TASK_REMOVE_CHILL+player); } } // get rid of the old grenade set_pev(ent,pev_flags,pev(ent,pev_flags)|FL_KILLME); } // apply the effects of being chilled chill_player(id) { // don't mess with their speed if they are frozen if(isFrozen[id]) engfunc(EngFunc_SetClientMaxspeed,id,0.00001); else { new Float:speed = regular_maxspeed(id) * (get_pcvar_float(fn_chill_speed) / 100.0); engfunc(EngFunc_SetClientMaxspeed,id,speed); } // add a blue tint to their screen message_begin(MSG_ONE_UNRELIABLE,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 fm_set_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 freeze_player(id) { // stop them from moving engfunc(EngFunc_SetClientMaxspeed,id,0.00001); set_pev(id,pev_velocity,Float:{0.0,0.0,0.0}); new Float:gravity; pev(id,pev_gravity,gravity); if(gravity > 0.0001 && gravity < 9999.9) { oldGravity[id] = gravity; if(pev(id,pev_flags) & FL_ONGROUND) set_pev(id,pev_gravity,9999.9); else set_pev(id,pev_gravity,0.0001); } } // 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 if(!isFrozen[id]) engfunc(EngFunc_SetClientMaxspeed,id,regular_maxspeed(id)); fm_set_rendering(id); // kill their trail message_begin(MSG_BROADCAST,SVC_TEMPENTITY); write_byte(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(pev_valid(novaDisplay[id])) { // get origin of their frost nova 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(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); engfunc(EngFunc_RemoveEntity,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 if(oldGravity[id] > 0.0001) set_pev(id,pev_gravity,oldGravity[id]); else set_pev(id,pev_gravity,1.0); // if they are still chilled, set the speed rightly so. otherwise, restore it to complete regular. if(isChilled[id]) chill_player(id); else engfunc(EngFunc_SetClientMaxspeed,id,regular_maxspeed(id)); } } /*---------------- 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! 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; // figure out how far away the points are new Float:percent, 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)); } // give an entity a trail set_beamfollow(ent,life,width,r,g,b,brightness) { // kill oldies first message_begin(MSG_BROADCAST,SVC_TEMPENTITY); write_byte(TE_KILLBEAM); write_short(ent); message_end(); message_begin(MSG_BROADCAST,SVC_TEMPENTITY); write_byte(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(); } // make a frost nova at a player's feet create_nova(id) { // create the entity new nova = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target")); // give it a size engfunc(EngFunc_SetSize,nova,Float:{-8.0,-8.0,-4.0},Float:{8.0,8.0,4.0}); // random orientation new Float:angles[3]; angles[1] = random_float(0.0,359.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); // mess with the model engfunc(EngFunc_SetModel,nova,"models/frostnova.mdl"); set_pev(nova,pev_animtime,1.0) set_pev(nova,pev_framerate,1.0) set_pev(nova,pev_sequence,0); fm_set_rendering(nova,kRenderFxNone,FROST_R,FROST_G,FROST_B,kRenderTransColor,100); novaDisplay[id] = nova; return nova; } // blue blast create_blast(Float:originF[3]) { new origin[3]; FVecIVec(originF,origin); // smallest ring message_begin(MSG_BROADCAST,SVC_TEMPENTITY); write_byte(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(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(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(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(); } // manage our snowflake (show it, hide it, flash it?) manage_icon(id) { // override mode and have that grenade, or tagged new csw = cvar_to_csw(get_pcvar_num(fn_nadetype)); new frost = (hasFrostNade[id] || (get_pcvar_num(fn_override) && cs_get_user_bpammo(id,csw))); // flash icon if frost grenade is out if(frost) { if(read_data(2) == csw) set_snowflake(id,2); else set_snowflake(id,1); } else set_snowflake(id,0); // otherwise hide it } // sets the icon to indicated status set_snowflake(id,status) { message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("StatusIcon"),{0,0,0},id); write_byte(status); // 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(); } // converts cvar value into CSW_* constant cvar_to_csw(in) { switch(in) { case NADE_FLASH: return CSW_FLASHBANG; case NADE_HE: return CSW_HEGRENADE; } return CSW_SMOKEGRENADE; } // gets the regular maxspeed for this player based on his weapon Float:regular_maxspeed(id) { if(!is_user_alive(id)) return 0.0; new shield = get_pdata_int(id,OFFSET_SHIELD); if(shield & USING_SHIELD) return 180.0; if(shield & HAS_SHIELD) return 250.0; new weapon = get_user_weapon(id); if(weapon < 0 || weapon > 30) return 0.0; return maxSpeed[weapon]; } // VEN's Fakemeta Utilities stock fm_find_ent_by_owner(index,const classname[],owner,jghgtype=0) { new strtype[11] = "classname", ent = index; switch(jghgtype) { case 1: strtype = "target"; case 2: strtype = "targetname"; } while((ent = engfunc(EngFunc_FindEntityByString,ent,strtype,classname)) && pev(ent,pev_owner) != owner) {} return ent; } // VEN's Fakemeta Utilities stock fm_set_rendering(entity,fx=kRenderFxNone,r=255,g=255,b=255,render=kRenderNormal,amount=16) { new Float:RenderColor[3]; RenderColor[0] = float(r); RenderColor[1] = float(g); RenderColor[2] = float(b); set_pev(entity,pev_renderfx,fx); set_pev(entity,pev_rendercolor,RenderColor); set_pev(entity,pev_rendermode,render); set_pev(entity,pev_renderamt,float(amount)); return 1; } // VEN's Fakemeta Utilities stock fm_fakedamage(victim,const classname[],Float:takedmgdamage,damagetype) { new classn[] = "trigger_hurt"; new entity = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,classn)); if(!entity) return 0; static value[16]; float_to_str(takedmgdamage * 2,value,sizeof value - 1); fm_set_kvd(entity,"dmg",value,classn); num_to_str(damagetype,value,sizeof value - 1); fm_set_kvd(entity,"damagetype",value,classn); fm_set_kvd(entity,"origin","8192 8192 8192",classn); dllfunc(DLLFunc_Spawn,entity); set_pev(entity,pev_classname,classname); dllfunc(DLLFunc_Touch,entity,victim); engfunc(EngFunc_RemoveEntity,entity); return 1; } // VEN's Fakemeta Utilities stock fm_set_kvd(entity,const key[],const value[],const classname[]="") { if(classname[0]) set_kvd(0,KV_ClassName,classname); else { new class[32]; pev(entity,pev_classname,class,sizeof class - 1); set_kvd(0,KV_ClassName,class); } set_kvd(0,KV_KeyName,key); set_kvd(0,KV_Value,value); set_kvd(0,KV_fHandled,0); return dllfunc(DLLFunc_KeyValue,entity,0); }
|