My best try - the defuser model doesn't seem to be working :/
PHP Code:
#pragma semicolon 1
#define PLUGIN_AUTHOR "Totenfluch"
#define PLUGIN_VERSION "1.00"
#include <sourcemod>
#include <sdktools>
#pragma newdecls required
public Plugin myinfo =
{
name = "defuserGlow",
author = PLUGIN_AUTHOR,
description = "make it glow",
version = PLUGIN_VERSION,
url = "http://ggc-base.de"
};
public void OnPluginStart()
{
RegConsoleCmd("sm_def", cmdDef);
}
public Action cmdDef(int client, int args) {
GivePlayerItem(client, "item_defuser");
return Plugin_Handled;
}
public void OnEntityCreated(int entity, const char[] classname)
{
if (StrEqual(classname, "item_defuser")) {
CreateTimer(0.0, makeGlowCb, EntIndexToEntRef(entity));
}
}
public Action makeGlowCb(Handle Timer, int entityEx) {
int entity = EntRefToEntIndex(entityEx);
float fPos[3];
GetEntPropVector(entity, Prop_Send, "m_vecOrigin", fPos);
float fAngles[3];
GetEntPropVector(entity, Prop_Send, "m_angRotation", fAngles);
int kitGlow = CreateEntityByName("prop_dynamic_glow");
DispatchKeyValue(kitGlow, "model", "models/props_docks/cleat_small_01.mdl");
DispatchKeyValue(kitGlow, "disablereceiveshadows", "1");
DispatchKeyValue(kitGlow, "disableshadows", "1");
DispatchKeyValue(kitGlow, "solid", "0");
DispatchKeyValue(kitGlow, "spawnflags", "256");
SetEntProp(kitGlow, Prop_Send, "m_CollisionGroup", 11);
DispatchSpawn(kitGlow);
SetEntPropFloat(kitGlow, Prop_Send, "m_flModelScale", 2.0);
TeleportEntity(kitGlow, fPos, fAngles, NULL_VECTOR);
SetEntProp(kitGlow, Prop_Send, "m_bShouldGlow", true, true);
SetEntPropFloat(kitGlow, Prop_Send, "m_flGlowMaxDist", 15000000.0);
SetGlowColor(kitGlow, "0 255 0");
AcceptEntityInput(kitGlow, "SetGlowColor");
SetEntPropFloat(kitGlow, Prop_Send, "m_flModelScale", 1.0);
SetVariantString("!activator");
AcceptEntityInput(kitGlow, "SetParent", entity);
}
stock void SetGlowColor(int entity, const char[] color)
{
char colorbuffers[3][4];
ExplodeString(color, " ", colorbuffers, sizeof(colorbuffers), sizeof(colorbuffers[]));
int colors[4];
for (int i = 0; i < 3; i++)
colors[i] = StringToInt(colorbuffers[i]);
colors[3] = 255;
SetVariantColor(colors);
AcceptEntityInput(entity, "SetGlowColor");
}