Автор: alkaline
Описание: Плъгина замества/дава замразяваща граната.
INCLUDE's:
Код за потвърждение: Избери целия код
#include <AmxModx>
#include <Engine>
#include <CStrike>
#include <FakeMeta>
#include <HamSandwich>
#include <FakeMeta_Util>
Ресурси (модели) : https://drive.google.com/file/d/0B1vuM0 ... A1b3M/view
Изтегли ресурсите:
Код за потвърждение: Избери целия код
/*Credits: ( zp4.3 & DareDevil (Gyiove) )*/
#include <AmxModx>
#include <Engine>
#include <CStrike>
#include <FakeMeta>
#include <HamSandwich>
#include <FakeMeta_Util>
#define ICE_FACE 666
const Float: ICE_RADIUS = 240.0;
const Float: ICE_DURATION = 6.0; // seconds
new ICE_MODELS[][] = {
"models/ifc/ice_face_cube.mdl",
"models/ifc/v_ice_face_cube.mdl",
"models/ifc/p_ice_face_cube.mdl",
"models/ifc/w_ice_face_cube.mdl"
},ICECUBE[33], ICEFROZEN[33], ICE_TRAIL, ICE_MODEL_BR, ICE_RING, bool: IFC_CORE[33];
new const NoAttackOnThis[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10",
"weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550",
"weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249",
"weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552",
"weapon_ak47", "weapon_knife", "weapon_p90" };
public plugin_init() {
register_plugin( "Ice Face Cube @2016", "v2.0.2", "alkaline" );
RegisterHam( Ham_Touch, "grenade", "FW_GrenadeTouch" );
RegisterHam( Ham_Think, "grenade", "FW_ThinkGrenade" );
RegisterHam( Ham_Spawn, "player", "FW_PlayerSpawnPost", true );
RegisterHam( Ham_Killed, "player", "FW_Playerkilled" );
register_logevent( "Round_Ended", 2, "1=Round_End" );
register_event( "CurWeapon", "FW_IFC_Model", "be", "1=1" );
register_forward( FM_SetModel, "FW_SetModel" );
refresh();
}
#pragma tabsize 0;
public MSG( source_code_loved_you ) { new x;source_code_loved_you = x;
Color( x, "!4[!3IFC!4]!1 You Blocked by !4Ice Face Cube !3!" );
}
public MSGB( source_code_loved_you ) { new x;source_code_loved_you = x;
Color( x, "!1[!3IFC!1] !4Ice Face Cube !1was !4Broken !1!" );
}
public client_connect( id ) { IFC_CORE[id]=false; ICECUBE[id] = -1; ICE_CUBE( id, 0 ); DESTROY_ICE_FACE_CUBE(id); }
public client_disconnect( id ){ IFC_CORE[id]=false; ICE_CUBE( id, 0 ); DESTROY_ICE_FACE_CUBE(id); }
public Round_Ended( ) { static a; for( a = 1; a < 33; a++ ){ IFC_CORE[a]=false; ICE_CUBE( a, 0 );} }
public FW_Playerkilled( id ) { IFC_CORE[id]=false; ICE_CUBE( id, 0 ); DESTROY_ICE_FACE_CUBE(id); }
public FW_PlayerSpawnPost( id ) { IFC_CORE[id]=false; ICE_CUBE( id, 0 ); DESTROY_ICE_FACE_CUBE(id); }
public plugin_natives( ) {
register_native( "get_ifc", "native_detect_ifc", 1 );
register_native( "set_ifc", "native_apply_ifc", 1 );
}
public native_detect_ifc( id ) return IFC_CORE[id];
public native_apply_ifc( id, ifc ) {
// if nr of ifc is more than 1, get more ifc nade, ex: 2..100,etc..
if( ifc > 1 ) {
IFC_CORE[id]=true;
fm_give_item( id, "weapon_flashbang" );
cs_set_user_bpammo( id, CSW_FLASHBANG, ifc );
engclient_cmd( id, "weapon_flashbang" );
FW_IFC_Model(id);
} else
if( ifc == 1 ) {
if( !IFC_CORE[id] ) {
IFC_CORE[id]=true;
FW_IFC_Model(id);
fm_give_item(id,"weapon_flashbang");
engclient_cmd( id, "weapon_flashbang" );
}
} else if( IFC_CORE[id] ) { IFC_CORE[id]=false; ICECUBE[id] = -1; ICE_CUBE( id, 0 ); DESTROY_ICE_FACE_CUBE(id); FW_IFC_Model(id); }
}
public plugin_precache( ) {
for( new i = 0; i < sizeof ICE_MODELS; i++ )
engfunc( EngFunc_PrecacheModel, ICE_MODELS[i] );
ICE_TRAIL = engfunc( EngFunc_PrecacheModel, "sprites/laserbeam.spr" );
ICE_RING = engfunc( EngFunc_PrecacheModel, "sprites/shockwave.spr" );
ICE_MODEL_BR = engfunc( EngFunc_PrecacheModel, ICE_MODELS[0] );
}
public FW_IFC_Model( id ) {
if( IFC_CORE[id] &&get_user_weapon( id ) == CSW_FLASHBANG ) {
set_pev( id, pev_viewmodel2, ICE_MODELS[1] );
set_pev( id, pev_weaponmodel2, ICE_MODELS[2] );
}
}
public FW_SetModel( ent, const model[] ) {
if ( !pev_valid(ent))
return FMRES_IGNORED;
static Float: dmgtime; pev( ent, pev_dmgtime, dmgtime );
if( dmgtime == 0.0 )
return FMRES_IGNORED;
new ix;// set_pev( ent, pev_owner, ix );
//ix = fm_find_ent_by_owner( -1, "weapon_flashbang", ent )
ix = pev( ent, pev_owner );
if( !is_user_connected(ix) && (1<=ix<=32) )
return HAM_IGNORED;
if( IFC_CORE[ix] && equal( model, "models/w_flashbang.mdl" ) ) {
fm_set_rendering( ent, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 16 );
message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte(TE_BEAMFOLLOW); // TE id
write_short(ent); // entity
write_short(ICE_TRAIL); // sprite
write_byte(6); // life
write_byte(10); // width
write_byte(0); // r
write_byte(100); // g
write_byte(200); // b
write_byte(200); // brightness
message_end();
IFC_CORE[ix] = true;
set_pev( ent, pev_flTimeStepSound, ICE_FACE );
engfunc(EngFunc_SetModel, ent, ICE_MODELS[3] );
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}
public FW_GrenadeTouch( ent ) {
if (!pev_valid( ent ) )
return HAM_IGNORED;
new ix; ix = pev( ent, pev_owner );
if( !is_user_connected(ix) && (1<=ix<=32) )
return HAM_IGNORED;
//c4 // He // Smoke // ONLY FLASH
if( IFC_CORE[ix]&& ~get_pdata_int( ent, 96, 5) & (1<<8) && ~get_pdata_int(ent, 114, 5) & (1<<0) && ~get_pdata_int(ent, 114, 5) & (1<<1) && ~get_pdata_int(ent, 114, 5) ) {
IFC_CORE[ix]=true;
set_pev( ent, pev_dmgtime, 0.0)
return HAM_HANDLED;
}
//https://forums.alliedmods.net/showthread.php?t=145102
//https://forums.alliedmods.net/showthread.php?p=401189?p=401189#post401189
return HAM_IGNORED;
}
public FW_ThinkGrenade( ent ) {
if( !pev_valid( ent ) )
return HAM_IGNORED;
static Float: dmgtime, Float: current_time;
pev( ent, pev_dmgtime, dmgtime ); current_time = get_gametime();
if( dmgtime > current_time )
return HAM_IGNORED;
new ix; ix = pev( ent, pev_owner );
if( !is_user_connected(ix) && (1<=ix<=32) )
return HAM_IGNORED;
if( IFC_CORE[ix] && pev( ent, pev_flTimeStepSound ) == ICE_FACE ) {
IFC_CORE[ix]=true;
IFC_Explosion( ent );
return HAM_SUPERCEDE;
}
return HAM_IGNORED;
}
IFC_Explosion( ent ) {
static Float: originF[3]; pev( ent, pev_origin, originF );
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0 );
write_byte(TE_BEAMCYLINDER); // TE id
engfunc(EngFunc_WriteCoord, originF[0]); // x
engfunc(EngFunc_WriteCoord, originF[1]); // y
engfunc(EngFunc_WriteCoord, originF[2]); // z
engfunc(EngFunc_WriteCoord, originF[0]); // x axis
engfunc(EngFunc_WriteCoord, originF[1]); // y axis
engfunc(EngFunc_WriteCoord, originF[2]+385.0); // z axis
write_short(ICE_RING); // sprite
write_byte(0); // startframe
write_byte(0); // framerate
write_byte(4); // life
write_byte(60); // width
write_byte(0); // noise
write_byte(0); // red
write_byte(100); // green
write_byte(200); // blue
write_byte(200); // brightness
write_byte(0); // speed
message_end();
static victim; victim = -1;
//new id; set_pev( id, pev_owner );
while( ( victim = engfunc( EngFunc_FindEntityInSphere, victim, originF, ICE_RADIUS ) ) != 0 ) {
if( !(1<=victim<=32) || ICEFROZEN[victim] )
continue;
message_begin( MSG_ONE_UNRELIABLE, get_user_msgid("Damage"), _, victim );
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();
fm_set_rendering( victim, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 25 );
message_begin( MSG_ONE, get_user_msgid("ScreenFade"), _, victim );
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();
MSG(victim);
ICEFROZEN[victim] = true;
IFC_CORE[victim] = true;
ICE_CUBE( victim, 1 );
for( new i = 1; i < sizeof NoAttackOnThis; i++ ) {
if( NoAttackOnThis[i][0] ) {
static ice; ice = fm_find_ent_by_owner( -1, NoAttackOnThis[i], victim );
if( pev_valid( ice ) ) { set_pdata_float( ice, 46, 9999.0, 4 ); set_pdata_float( ice, 47, 9999.0, 4 ); }
}
}
fm_set_user_godmode(victim,true);
set_task( ICE_DURATION, "DESTROY_ICE_FACE_CUBE", victim );
}
engfunc( EngFunc_RemoveEntity, ent );
}
public DESTROY_ICE_FACE_CUBE( id ) {
if( !is_user_alive(id) || !ICEFROZEN[id] || !IFC_CORE[id] )
return;
for( new i = 1; i < sizeof NoAttackOnThis; i++ ) {
if( NoAttackOnThis[i][0] ) {
static ice; ice = fm_find_ent_by_owner( -1, NoAttackOnThis[i], id );
if( pev_valid( ice ) ) { set_pdata_float( ice, 46, 0000.1, 4 ); set_pdata_float( ice, 47, 0000.1, 4 ); }
}
}
MSGB(id);
fm_set_user_godmode(id,false);
ICEFROZEN[id] = false;
ICE_CUBE( id, 0 );
fm_set_rendering( id );
message_begin(MSG_ONE, get_user_msgid("ScreenFade"), _, 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();
static origin2[3]; get_user_origin( id, origin2 );
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(ICE_MODEL_BR); // model
write_byte(1); // count
write_byte(25); // life
write_byte(0x01); // flags
message_end();
}
stock ICE_CUBE( id, StS ) {
if( StS ) {
static ent, Float: o[3];
if( !is_user_alive( id ) ) {
ICE_CUBE( id, 0 )
return;
}
if( !IFC_CORE[id] )
return;
if( is_valid_ent( ICECUBE[id] ) ) {
if( pev( ICECUBE[id], pev_iuser3 ) != id ) {
if( pev( ICECUBE[id], pev_team ) == 6969 )
remove_entity( ICECUBE[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( ICECUBE[id], o );
IFC_CORE[id] = true;
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, "ICE_FACE_CUBE" );
entity_set_model( ent, ICE_MODELS[0] );
dllfunc( DLLFunc_Spawn, ent );
set_pev( ent, pev_solid, SOLID_BBOX);
set_pev( ent, pev_movetype, MOVETYPE_NONE);
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);
ICECUBE[id] = ent;
IFC_CORE[id] = true;
} else {
if( is_valid_ent( ICECUBE[id] ) ) {
if( pev( ICECUBE[id], pev_team) == 6969 )
remove_entity( ICECUBE[id] );
ICECUBE[id] = -1;
}
}
}
stock Color(const id, const input[], any:...) {
new count = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg, 190, "!4", "^4");
replace_all(msg, 190, "!1", "^1");
replace_all(msg, 190, "!3", "^3");
/* This plugin created by alkaline aka lucy */
if(id) players[0] = id;
else get_players(players, count, "ch"); {
for(new i = 0; i < count; i++) {
if(is_user_connected(players[i])) {
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
refresh() { register_clcmd( "xxx", "xxx",0, "xxx" ); }
public xxx( id ) { fm_give_item( id, "weapon_flashbang" ); cs_set_user_bpammo( id, CSW_FLASHBANG, 15 ); return PLUGIN_HANDLED;}