R1KO
fuck society
- Сообщения
- 9,457
- Реакции
- 7,786
- Команда форума
- #41
Разный эффект для каждого игрока.
Сами эффекты не смотрел.
Сами эффекты не смотрел.
PHP:
#include <sdktools>
public Plugin:myinfo =
{
name = "Round Start Effects",
description = "",
author = "",
version = "1.1",
url = ""
};
new const String:g_sColors[][] =
{
"255 0 0",
"0 0 255"
};
public OnPluginStart()
{
HookEvent("player_spawn", player_spawn);
}
public OnMapStart()
{
//PrecacheModel("models/props/cs_office/vending_machine.mdl", true);
PrecacheModel("sprites/laserbeam.vmt", true);
PrecacheModel("sprites/glow01.spr", true);
}
public player_spawn(Handle:event, String:name[], bool:silent)
{
CreateTimer(0.05, TIMER_PlayerSpawn, GetEventInt(event, "userid"));
}
public Action:TIMER_PlayerSpawn(Handle:timer, any:UserID)
{
new iClient = GetClientOfUserId(UserID);
if(iClient && IsPlayerAlive(iClient))
{
new team = GetClientTeam(iClient);
if (team > 1)
{
decl Float:p[3];
GetClientAbsOrigin(iClient, p);
switch(Math_GetRandomInt(1, 8))
{
case 1:
{
Fire(iClient, p);
}
case 2:
{
Fx(iClient);
}
case 3:
{
Beam3(p, g_sColors[team-2]);
}
case 4:
{
Tesla3(p, g_sColors[team-2]);
}
case 5:
{
SpotLight3(iClient, p, g_sColors[team-2]);
}
case 6:
{
Sprite(iClient, p, g_sColors[team-2]);
}
case 7:
{
Beam1(p, g_sColors[team-2]);
}
case 8:
{
Spark(p);
}
}
}
}
return Plugin_Stop;
}
Math_GetRandomInt(min, max)
{
new random = GetURandomInt();
if (random == 0) {
random++;
}
return RoundToCeil(float(random) / (2147483647.0 / float(max - min + 1))) + min - 1;
}
Beam3(Float:center[3], String:sRGB[])
{
decl Float:p1[3];
decl Float:p2[3];
decl Float:p3[3];
if (Get3Coords(center, p1, p2, p3, 50.0))
{
center[2] += 125.0;
Beam3Go(p1, center, sRGB);
Beam3Go(p2, center, sRGB);
Beam3Go(p3, center, sRGB);
}
}
public bool:TraceFilter_Beam3(TraceEnt, mask)
{
return TraceEnt < 1 || TraceEnt > MaxClients;
}
Beam3Go(Float:p[3], Float:air[3], String:sRGB[])
{
new entity = CreateEntityByName("env_beam", -1);
if (entity < 1)
{
LogError("Can't create 'env_beam'");
return;
}
DispatchKeyValueVector(entity, "origin", p);
SetEntPropVector(entity, Prop_Data, "m_vecEndPos", air, 0);
SetEntityModel(entity, "sprites/laserbeam.vmt");
DispatchKeyValue(entity, "texture", "sprites/laserbeam.vmt");
SetEntPropFloat(entity, Prop_Send, "m_fAmplitude", 0.0, 0);
DispatchKeyValue(entity, "life", "0");
DispatchKeyValue(entity, "BoltWidth", "5");
DispatchKeyValue(entity, "rendermode", "3");
DispatchKeyValue(entity, "rendercolor", sRGB);
DispatchKeyValue(entity, "renderamt", "255");
DispatchSpawn(entity);
SetVariantString("OnUser1 !self:kill::1.0:1");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "FireUser1");
}
Beam1(Float:center[3], String:sRGB[])
{
new entity = CreateEntityByName("env_beam", -1);
if (entity < 1)
{
LogError("Can't create 'env_beam'");
return;
}
TR_TraceRayFilter(center, center, 33570827, RayType:1, TraceFilter_Beam3);
if (TR_DidHit(Handle:0))
{
TR_GetEndPosition(center, Handle:0);
center[2] -= 10.0;
}
else
{
center[2] += 250.0;
}
SetEntPropVector(entity, Prop_Data, "m_vecEndPos", center, 0);
SetEntityModel(entity, "sprites/laserbeam.vmt");
DispatchKeyValue(entity, "texture", "sprites/laserbeam.vmt");
SetEntPropFloat(entity, Prop_Send, "m_fAmplitude", 10.0, 0);
DispatchKeyValue(entity, "life", "0");
DispatchKeyValue(entity, "BoltWidth", "10");
DispatchKeyValue(entity, "rendermode", "3");
DispatchKeyValue(entity, "rendercolor", sRGB);
DispatchKeyValue(entity, "renderamt", "255");
DispatchSpawn(entity);
SetVariantString("OnUser1 !self:kill::0.3:1");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "FireUser1");
}
Fire(client, Float:p[3])
{
new entity = CreateEntityByName("info_particle_system", -1);
if (entity < 1)
{
LogError("Can't create 'info_particle_system'");
return;
}
DispatchKeyValue(entity, "effect_name", "env_fire_large");
DispatchKeyValueVector(entity, "origin", p);
DispatchSpawn(entity);
SetVariantString("!activator");
AcceptEntityInput(entity, "SetParent", client);
ActivateEntity(entity);
AcceptEntityInput(entity, "Start");
SetVariantString("OnUser1 !self:kill::1.5:1");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "FireUser1");
}
Fx(client)
{
SetEntityRenderFx(client, RenderFx:13);
CreateTimer(1.5, TIMER_fx, client, 2);
}
public Action:TIMER_fx(Handle:timer, any:client)
{
if (IsClientInGame(client))
{
SetEntityRenderFx(client, RenderFx:0);
}
return Plugin_Stop;
}
Tesla3(Float:center[3], String:sRGB[])
{
center[2] += 35.0;
decl Float:p1[3];
decl Float:p2[3];
decl Float:p3[3];
if (Get3Coords(center, p1, p2, p3, 50.0))
{
Tesla3Go(p1, sRGB);
Tesla3Go(p2, sRGB);
Tesla3Go(p3, sRGB);
}
}
Tesla3Go(Float:p[3], String:sRGB[])
{
new entity = CreateEntityByName("point_tesla", -1);
if (entity < 1)
{
LogError("Can't create 'point_tesla'");
return;
}
DispatchKeyValueVector(entity, "origin", p);
DispatchKeyValue(entity, "texture", "sprites/laserbeam.vmt");
DispatchKeyValue(entity, "m_Color", sRGB);
DispatchKeyValueFloat(entity, "m_flRadius", 150.0);
DispatchKeyValueFloat(entity, "beamcount_min", 5.0);
DispatchKeyValueFloat(entity, "beamcount_max", 15.0);
DispatchKeyValueFloat(entity, "interval_min", 1.0);
DispatchKeyValueFloat(entity, "interval_max", 1.0);
DispatchKeyValueFloat(entity, "lifetime_min", 0.2);
DispatchKeyValueFloat(entity, "lifetime_max", 0.2);
DispatchKeyValueFloat(entity, "thick_min", 10.0);
DispatchKeyValueFloat(entity, "thick_max", 25.0);
DispatchSpawn(entity);
AcceptEntityInput(entity, "DoSpark");
SetVariantString("OnUser1 !self:kill::0.2:1");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "FireUser1");
}
SpotLight3(client, Float:center[3], String:sRGB[])
{
decl Float:p1[3];
decl Float:p2[3];
decl Float:p3[3];
if (Get3Coords(center, p1, p2, p3, 50.0))
{
new entity = CreateEntityByName("func_rotating", -1);
decl String:RotatorName[28];
Format(RotatorName, 25, "rttr%d", entity);
DispatchKeyValue(entity, "targetname", RotatorName);
DispatchKeyValueVector(entity, "origin", center);
DispatchKeyValue(entity, "spawnflags", "64");
DispatchKeyValue(entity, "friction", "20");
SetEntPropFloat(entity, Prop_Data, "m_flMaxSpeed", 250.0, 0);
DispatchKeyValue(entity, "dmg", "0");
DispatchKeyValue(entity, "solid", "0");
DispatchSpawn(entity);
SetVariantString("OnUser1 !self:kill::2.5:1");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "FireUser1");
SpotLight3Go(p1, sRGB, RotatorName);
SpotLight3Go(p2, sRGB, RotatorName);
SpotLight3Go(p3, sRGB, RotatorName);
SetVariantString("!activator");
AcceptEntityInput(entity, "SetParent", client, entity, 0);
AcceptEntityInput(entity, "Start");
}
}
SpotLight3Go(Float:p[3], String:sRGB[], String:RotatorName[])
{
new entity = CreateEntityByName("point_spotlight", -1);
if (entity < 1)
{
LogError("Can't create point_spotlight");
return;
}
DispatchKeyValue(entity, "spawnflags", "2");
DispatchKeyValueVector(entity, "origin", p);
DispatchKeyValue(entity, "SpotlightLength", "150");
DispatchKeyValue(entity, "SpotlightWidth", "25");
DispatchKeyValue(entity, "rendermode", "5");
DispatchKeyValue(entity, "rendercolor", sRGB);
DispatchKeyValue(entity, "renderamt", "255");
DispatchKeyValue(entity, "scale", "5");
DispatchKeyValue(entity, "angles", "-90 0 0");
DispatchSpawn(entity);
SetVariantString(RotatorName);
AcceptEntityInput(entity, "SetParent");
AcceptEntityInput(entity, "LightOn");
SetVariantString("OnUser1 !self:LightOff::1.9:1");
AcceptEntityInput(entity, "AddOutput");
SetVariantString("OnUser1 !self:kill::2.0:1");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "FireUser1");
}
Sprite(client, Float:center[3], String:sRGB[])
{
new entity = CreateEntityByName("env_sprite", -1);
if (entity < 1)
{
LogError("Can't create 'env_sprite'");
return;
}
center[2] += 35.0;
DispatchKeyValueVector(entity, "origin", center);
DispatchKeyValue(entity, "model", "sprites/glow01.spr");
DispatchKeyValue(entity, "rendermode", "5");
DispatchKeyValue(entity, "renderamt", "255");
DispatchKeyValue(entity, "rendercolor", sRGB);
DispatchKeyValue(entity, "scale", "5");
DispatchSpawn(entity);
AcceptEntityInput(entity, "Shocvarprite");
SetVariantString("!activator");
AcceptEntityInput(entity, "SetParent", client, entity, 0);
SetVariantString("OnUser1 !self:HideSprite::2.0:1");
AcceptEntityInput(entity, "AddOutput");
SetVariantString("OnUser1 !self:kill::2.1:1");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "FireUser1");
}
Spark(Float:p[3])
{
new entity = CreateEntityByName("env_spark", -1);
if (entity < 1)
{
LogError("Can't create 'env_spark'");
return;
}
p[2] += 45.0;
DispatchKeyValueVector(entity, "origin", p);
DispatchKeyValue(entity, "Magnitude", "8");
DispatchKeyValue(entity, "MaxDelay", "3");
DispatchKeyValue(entity, "TrailLength", "2");
DispatchSpawn(entity);
AcceptEntityInput(entity, "StartSpark");
SetVariantString("OnUser1 !self:kill::0.3:1");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "FireUser1");
}
bool:Get3Coords(Float:center[3], Float:p1[3], Float:p2[3], Float:p3[3], Float:dist)
{
new entity = CreateEntityByName("prop_dynamic_override", -1);
if (entity < 1)
{
LogError("CreateEntityByName error: prop_dynamic_override");
return false;
}
DispatchKeyValueVector(entity, "origin", center);
//SetEntityModel(entity, "models/props/cs_office/vending_machine.mdl");
DispatchKeyValue(entity, "solid", "0");
DispatchSpawn(entity);
Get3Coords_p(entity, p1, dist);
Get3Coords_p(entity, p2, dist);
Get3Coords_p(entity, p3, dist);
AcceptEntityInput(entity, "Kill");
return true;
}
Get3Coords_p(entity, Float:pos[3], Float:dist)
{
decl Float:a[3];
GetEntPropVector(entity, Prop_Send, "m_angRotation", a, 0);
a[1] += 120.0;
TeleportEntity(entity, NULL_VECTOR, a, NULL_VECTOR);
decl Float:p[3];
GetEntPropVector(entity, Prop_Data, "m_vecAbsOrigin", p, 0);
decl Float:direction[3];
a[0] = 0.0;
a[2] = 0.0;
GetAngleVectors(a, direction, NULL_VECTOR, NULL_VECTOR);
p[0] = p[0] + direction[0] * dist;
p[1] = p[1] + direction[1] * dist;
pos[0] = p[0];
pos[1] = p[1];
pos[2] = p[2];
}