//Посетите сайт
http://perfect-soft.at.ua #include <amxmodx>
#include <amxmisc>
#include <fun>
#include <Vexd_Utilities>
#include <fakemeta>
#include <fakemeta_util>
#include <engine>
#include <cstrike>
#define TELEPORT_RADIUS 50
#define XPOS 0
#define YPOS 1
#define ZPOS 2
#define SMOKE_SCALE 30
#define SMOKE_FRAMERATE 12
#define SMOKE_GROUND_OFFSET 6
new const PLUGIN_NAME[] = "CSSB War3FT Teleport Smoke Grenade"
new const PLUGIN_VERSION[] = "1.0"
new const PLUGIN_AUTHOR[] = "CSSB"
// Item ID
//new g_teleport;
// Game Variables
new const Float:g_sign[4][2] = {{1.0, 1.0}, {1.0, -1.0}, {-1.0, -1.0}, {-1.0, 1.0}}
new const g_sound_explosion[] = "weapons/sg_explode.wav"
new const g_classname_grenade[] = "grenade"
// Sprite Index
new iSpriteFlare,iSpriteShockwave,iSpriteNosmoke;
new g_eventid_createsmoke;
// Plugin Initialization
public plugin_init()
{
// Plugin Call
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
register_forward(FM_EmitSound, "forward_emitsound")
register_forward(FM_PlaybackEvent, "forward_playbackevent")
g_eventid_createsmoke = engfunc(EngFunc_PrecacheEvent, 1, "events/createsmoke.sc")
}
// Precache Files
public plugin_precache()
{
// Teleport Sound
precache_sound("warcraft3/blinkarrival.wav");
// Sprite
iSpriteFlare = precache_model("sprites/blueflare2.spr");
iSpriteShockwave = precache_model("sprites/shockwave.spr");
//iSpriteSteam1 = precache_model("sprites/steam1.spr");
iSpriteNosmoke = precache_model("sprites/nosmoke.spr");
}
public forward_emitsound(ent, channel, const sound[])
{
if (!equal(sound, g_sound_explosion) || !is_grenade(ent))
return FMRES_IGNORED
static id, Float:vNewLocationGrenade[3]
id = pev(ent, pev_owner)
pev(ent, pev_origin, vNewLocationGrenade)
//Цилиндр
static vOldLocationUser[3];
get_user_origin(id, vOldLocationUser );
// If we teleport them back, make sure they don't get teleported into the ground
vOldLocationUser[ZPOS] += 15;
// Set up some origins for some special effects!!!
static vCenterOrigin[3], vAxisOrigin[3];
vCenterOrigin[0] = vOldLocationUser[0];
vCenterOrigin[1] = vOldLocationUser[1];
vCenterOrigin[2] = vOldLocationUser[2] + 10;
vAxisOrigin[0] = vOldLocationUser[0];
vAxisOrigin[1] = vOldLocationUser[1];
vAxisOrigin[2] = vOldLocationUser[2] + 10 + TELEPORT_RADIUS;
Create_TE_BEAMCYLINDER(vOldLocationUser, vCenterOrigin, vAxisOrigin, iSpriteShockwave, 0, 0, 3, 60, 0, 255, 255, 255, 255, 0 );
vCenterOrigin[2] += 80;
vAxisOrigin[2] += 80;
Create_TE_BEAMCYLINDER( vOldLocationUser, vCenterOrigin, vAxisOrigin, iSpriteShockwave, 0, 0, 3, 60, 0, 255, 255, 255, 255, 0 );
//Перемещение игрока
// engfunc(EngFunc_EmitSound, ent, CHAN_WEAPON, g_sound_explosion, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
engfunc(EngFunc_SetOrigin, ent, Float:{8191.0, 8191.0, 8191.0})
vNewLocationGrenade[2] += SMOKE_GROUND_OFFSET
create_smoke(vNewLocationGrenade)
if (is_user_alive(id))
{
static Float:mins[3], hull
pev(id, pev_mins, mins)
vNewLocationGrenade[2] -= mins[2] + SMOKE_GROUND_OFFSET
hull = pev(id, pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN
if (is_hull_vacant(vNewLocationGrenade, hull))
engfunc(EngFunc_SetOrigin, id, vNewLocationGrenade)
else { // close to a solid object, trying to find a vacant spot
static Float:vec[3]
vec[2] = vNewLocationGrenade[2]
for (new i; i < sizeof g_sign; ++i) {
vec[0] = vNewLocationGrenade[0] - mins[0] * g_sign[i][0]
vec[1] = vNewLocationGrenade[1] - mins[1] * g_sign[i][1]
if (is_hull_vacant(vec, hull)) {
engfunc(EngFunc_SetOrigin, id, vec)
break
}
}
}
}
// if(!cs_get_user_bpammo(id,CSW_SMOKEGRENADE))
// fm_give_item(id,"weapon_smokegrenade");
//Искры
static vNewLocationUser[3];
get_user_origin(id, vNewLocationUser );
static vStartOrigin[3];
vStartOrigin[0] = vNewLocationUser[0];
vStartOrigin[1] = vNewLocationUser[1];
vStartOrigin[2] = vNewLocationUser[2] + 40;
Create_TE_SPRITETRAIL(vStartOrigin, vNewLocationUser, iSpriteFlare, 30, 10, 1, 50, 10 );
emit_sound( id, CHAN_STATIC,"warcraft3/blinkarrival.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );
return FMRES_SUPERCEDE
}
bool:is_grenade(ent)
{
if (!pev_valid(ent))
return false
static classname[sizeof g_classname_grenade + 1]
pev(ent, pev_classname, classname, sizeof g_classname_grenade)
if (equal(classname, g_classname_grenade))
return true
return false
}
public forward_playbackevent(flags, invoker, eventindex)
{
// we do not need a large amount of smoke
if (eventindex == g_eventid_createsmoke)
return FMRES_SUPERCEDE
return FMRES_IGNORED
}
stock bool:is_hull_vacant(const Float:origin[3], hull)
{
new tr = 0
engfunc(EngFunc_TraceHull, origin, origin, 0, hull, 0, tr)
if (!get_tr2(tr, TraceResult:TR_StartSolid) && !get_tr2(tr, TraceResult:TR_AllSolid) && get_tr2(tr, TraceResult:TR_InOpen))
return true
return false
}
create_smoke(const Float:origin[3])
{
// engfunc because origin are float
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
write_byte(TE_SMOKE)
engfunc(EngFunc_WriteCoord, origin[0])
engfunc(EngFunc_WriteCoord, origin[1])
engfunc(EngFunc_WriteCoord, origin[2])
write_short(iSpriteNosmoke)
write_byte(SMOKE_SCALE)
write_byte(SMOKE_FRAMERATE)
message_end()
}
stock Create_TE_BEAMCYLINDER(origin[3], center[3], axis[3], iSprite, startFrame, frameRate, life, width, amplitude, red, green, blue, brightness, speed)
{
message_begin( MSG_PAS, SVC_TEMPENTITY, origin )
write_byte( TE_BEAMCYLINDER )
write_coord( center[0] ) // center position (X)
write_coord( center[1] ) // center position (Y)
write_coord( center[2] ) // center position (Z)
write_coord( axis[0] ) // axis and radius (X)
write_coord( axis[1] ) // axis and radius (Y)
write_coord( axis[2] ) // axis and radius (Z)
write_short( iSprite ) // sprite index
write_byte( startFrame ) // starting frame
write_byte( frameRate ) // frame rate in 0.1's
write_byte( life ) // life in 0.1's
write_byte( width ) // line width in 0.1's
write_byte( amplitude ) // noise amplitude in 0.01's
write_byte( red ) // color (red)
write_byte( green ) // color (green)
write_byte( blue ) // color (blue)
write_byte( brightness ) // brightness
write_byte( speed ) // scroll speed in 0.1's
message_end()
}
stock Create_TE_SPRITETRAIL(start[3], end[3], iSprite, count, life, scale, velocity, random ){
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( TE_SPRITETRAIL )
write_coord( start[0] ) // start position (X)
write_coord( start[1] ) // start position (Y)
write_coord( start[2] ) // start position (Z)
write_coord( end[0] ) // end position (X)
write_coord( end[1] ) // end position (Y)
write_coord( end[2] ) // end position (Z)
write_short( iSprite ) // sprite index
write_byte( count ) // count
write_byte( life) // life in 0.1's
write_byte( scale) // scale in 0.1's
write_byte( velocity ) // velocity along vector in 10's
write_byte( random ) // randomness of velocity in 10's
message_end()
}