#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <sdkhooks>
#define EFFECT_MODEL "sprites/redglow1.vmt"
public OnMapStart()
{
PrecacheModel(EFFECT_MODEL);
}
...
public Action:Give(client)
{
new weapon = GetPlayerWeaponSlot(client, 0);
if (weapon != -1 || weapon < 0)
{
CS_DropWeapon(client, weapon, true, false);
}
GivePlayerItem(client, "weapon_mp5navy");
return Plugin_Handled;
}
}
public OnEntityCreated(iEntity, const String:sClassName[])
{
if ( StrEqual(sClassName, "weapon_mp5navy") )
{
new iGlowEntity = CreateEntityByName("env_glow");
DispatchKeyValue(iGlowEntity, "model", EFFECT_MODEL);
DispatchKeyValue(iGlowEntity, "rendermode", "3"); // свечение
DispatchKeyValue(iGlowEntity, "scale", "1.0"); // размер свечения
DispatchKeyValue(iGlowEntity, "renderamt", "255"); // прозрачность
DispatchKeyValue(iGlowEntity, "rendercolor", "176 21 21"); // цвет
SetEntityRenderColor(iEntity, 120, 21, 21, 200);
if ( DispatchSpawn(iGlowEntity) )
{
decl String:sTargetName[32], Float:fOrigin[3];
Format(sTargetName, sizeof(sTargetName) - 1, "weapon_mp5navy_%d", iGlowEntity);
DispatchKeyValue(iEntity, "targetname", sTargetName);
GetEntPropVector(iEntity, Prop_Data, "m_vecOrigin", fOrigin);
SetVariantString(sTargetName);
AcceptEntityInput(iGlowEntity, "SetParent");
TeleportEntity(iGlowEntity, fOrigin, NULL_VECTOR, NULL_VECTOR);
AcceptEntityInput(iGlowEntity, "ShowSprite");
AcceptEntityInput(iGlowEntity, "TurnOn");
}
}
}