#pragma semicolon 1
#include <sourcemod>
#include <cstrike>
#include <sdktools>
#include <sdkhooks>
public Plugin:myinfo =
{
name = "Dance Erotic Bomb",
author = "PF (Info-Zona)",
description = "",
version = "2.0",
url = ""
}
//Настройка моба
#define MOB_MODEL "models/1ama/1work/item_erotic.mdl"
#define SPRITE "powerfind/bomb_effect/effect_iskra.vmt"
#define SOUND "powerfind/strip.mp3"
//Настройка поворота func_rotating
#define ROTATE_SPEED "1"
#define ROTATE_SPAWNFLAGS "64"
new String:animations[][] =
{
"1_combo1",
"1_combo2",
"1_combo3",
"1_combo4"
};
new iEntity = 0;
new iRotator = 0;
new g_iCollision = -1;
new g_iSolidFlags = -1;
new Handle:TimerAnim;
new Float:fBombPos[3];
public OnPluginStart()
{
HookEvent("bomb_planted", bomb_planted);
HookEvent("bomb_exploded", end);
HookEvent("bomb_defused", end);
HookEvent("round_end", end);
HookEvent("round_start", round_start);
AddFileToDownloadsTable("materials/1ama/1work/item_erotic/CherryPopz_Face_D.vmt");
AddFileToDownloadsTable("materials/1ama/1work/item_erotic/CherryPopz_Face_D.vtf");
AddFileToDownloadsTable("materials/1ama/1work/item_erotic/CherryPopz_Hair_D.vmt");
AddFileToDownloadsTable("materials/1ama/1work/item_erotic/CherryPopz_Hair_D.vtf");
AddFileToDownloadsTable("materials/1ama/1work/item_erotic/i.vmt");
AddFileToDownloadsTable("materials/1ama/1work/item_erotic/i.vtf");
AddFileToDownloadsTable("materials/1ama/1work/item_erotic/CherryPopz_Body_D.vmt");
AddFileToDownloadsTable("materials/1ama/1work/item_erotic/CherryPopz_Body_D.vtf");
AddFileToDownloadsTable("models/1ama/1work/item_erotic.sw.vtx");
AddFileToDownloadsTable("models/1ama/1work/item_erotic.vvd");
AddFileToDownloadsTable("models/1ama/1work/item_erotic.dx80.vtx");
AddFileToDownloadsTable("models/1ama/1work/item_erotic.dx90.vtx");
AddFileToDownloadsTable("models/1ama/1work/item_erotic.mdl");
AddFileToDownloadsTable("materials/powerfind/bomb_effect/effect_iskra.vtf");
AddFileToDownloadsTable("materials/powerfind/bomb_effect/effect_iskra.vmt");
AddFileToDownloadsTable("sound/powerfind/strip.mp3");
}
public Action:round_start(Handle:event, String:name[], bool:dontBroadcast)
{
if(TimerAnim)
{
KillTimer(TimerAnim, false);
TimerAnim = INVALID_HANDLE;
}
return Plugin_Continue;
}
public end(Handle:event, String:name[], bool:dontBroadcast)
{
if (TimerAnim)
{
KillTimer(TimerAnim, false);
TimerAnim = INVALID_HANDLE;
AcceptEntityInput(iRotator, "Stop");
AcceptEntityInput(iRotator, "kill");
AcceptEntityInput(iEntity, "KillHierarchy");
for(new i = 1; i <= MaxClients; i++)
if(IsClientInGame(i) && !IsFakeClient(i))
StopSound(i, SNDCHAN_STATIC, SOUND);
}
/*if(Beam != INVALID_HANDLE)
{
KillTimer(Beam);
Beam = INVALID_HANDLE;
}*/
}
public bomb_planted(Handle:event, String:name[], bool:dontBroadcast)
{
new giC4Index = FindEntityByClassname(MaxClients + 1, "planted_c4");
if(0 < giC4Index)
{
GetEntPropVector(giC4Index, Prop_Send, "m_vecOrigin", fBombPos, 0);
CreateMob(fBombPos);
}
}
public OnMapStart()
{
PrecacheModel(MOB_MODEL, true);
PrecacheDecal(SPRITE, true);
PrecacheSound(SOUND, true);
}
public Action:AnimTimer(Handle:timer, any:entity)
{
SetVariantString(animations[GetRandomInt(0, sizeof(animations)-1)]);
AcceptEntityInput(entity, "SetAnimation");
return Plugin_Continue;
}
CreateMob(Float:fOrigin[3])
{
iEntity = CreateEntityByName("prop_dynamic");
SetEntityModel(iEntity, MOB_MODEL);
SetEntProp(iEntity, Prop_Send, "m_CollisionGroup", 0);
SetEntProp(iEntity, Prop_Send, "m_nSolidType", 0);
SetSolidFlags(iEntity, 152);
SetEntityMoveType(iEntity, MOVETYPE_VPHYSICS);
fOrigin[1] += 50;
TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR);
DispatchSpawn(iEntity);
SetVariantString("1_combo1");
AcceptEntityInput(iEntity, "SetAnimation");
iRotator = CreateEntityByName("func_rotating");
if (iRotator <= 0)
return;
DispatchKeyValueVector(iRotator, "origin", fOrigin);
decl String:rotator_name[20];
Format(rotator_name, 20, "rt_%d", iRotator);
DispatchKeyValue(iRotator, "targetname", rotator_name);
DispatchKeyValue(iRotator, "maxspeed", ROTATE_SPEED);
DispatchKeyValue(iRotator, "dmg", "0");
DispatchKeyValue(iRotator, "solid", "0");
DispatchKeyValue(iRotator, "spawnflags", ROTATE_SPAWNFLAGS);
DispatchSpawn(iRotator);
SetVariantString(rotator_name);
DispatchKeyValueVector(iRotator, "origin", fOrigin);
AcceptEntityInput(iEntity, "SetParent");
AcceptEntityInput(iRotator, "Start");
new sprite = CreateEntityByName("env_sprite");
DispatchKeyValue(sprite, "spawnflags", "1");
DispatchKeyValueFloat(sprite, "scale", 0.5);
DispatchKeyValue(sprite, "rendermode", "1");
DispatchKeyValue(sprite, "rendercolor", "255 255 255");
DispatchKeyValue(sprite, "model", SPRITE);
DispatchSpawn(sprite);
TeleportEntity(sprite, fOrigin, NULL_VECTOR, NULL_VECTOR);
SetVariantString("!activator");
AcceptEntityInput(sprite, "SetParent", iEntity);
new clients[MaxClients+1], total;
for (new i = 1; i <= MaxClients; i++)
if(IsClientInGame(i) && !IsFakeClient(i))
clients[total++] = i;
if(total > 0)
EmitSound(clients, total, SOUND, iEntity, SNDCHAN_STATIC, _, _, 1.0);
TimerAnim = CreateTimer(10.0, AnimTimer, iEntity, TIMER_REPEAT);
}
SetSolidFlags(entity, iFlags)
{
if (g_iCollision == -1 || g_iSolidFlags == -1)
return;
SetEntData(entity, g_iSolidFlags + g_iCollision, iFlags, 2, true);
}
stock DrawRing(Float:pos[3])
{
//TE_SetupBeamRingPoint(pos, 1.0, //Начальный радиус круга
//RING_RADIUS, // Радиус круга
//beamsprite, // Прекеш индекс текстуры
//beamsprite, // Прекеш индекс текстуры 2 (можно дублировать)
//1.0, // Начальный кадр
//30.0, // Скорость отрисовки (FPS)
//2.0, // Срок жизни круга (сек)
//5.0, // Ширина круга
//1.0, // Амплитуда колебаний
//{255, 255, 255, 255}, // Цвет (задан в виде массисва RGBA)
//80, // Скорость вращения текстуры
//0); // Флаг
//TE_SendToAll(0.0);
}
public Action:Timer_Beacon(Handle:timer, any:value)
{
//TE_SetupEnergySplash(fBombPos, fBombPos, true);
//TE_SendToAll();
static Float:RingOrigin[3];
RingOrigin = fBombPos;
RingOrigin[2] += 5.0;
// TE_SetupBeamRingPoint(RingOrigin, 150.0,
// 150.0,
// beamsprite,
// beamsprite,
// 1,
// 15,
// 5.0,
// 8.0,
// 0.0,
// {255, 255, 255, 255},
// 100,
// 0);
// TE_SendToAll();
DrawRing(RingOrigin);
}