The map has 3 func_button's with targetname of "addbutton" and I am trying to color all of them.
I know of SetVariantColor but I made FireInputOn for other entities, inputs and delays.
The problem is that it only colors the first one it finds and then error.
Thanks in advanced.
Error:
Code:
[SM] Exception reported: Tracker stack is out of bounds
[SM] Blaming: Plugin.smx
[SM] Call stack trace:
[SM] [1] AcceptEntityInput(entity, "FireUser1");
[SM] [2] FireInputOn("addbutton", "Color", "0 100 0", "0", "-1");
Code:
Code:
public void OnPluginStart()
{
HookEvent("teamplay_round_start", Event_RoundStart);
}
public Action Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
{
FireInputOn("addbutton", "Color", "0 100 0", "0", "-1");
}
void FireInputOn(const char[] targetName, const char[] input, const char[] value, const char[] delay, const char[] maxTimes)
{
int max = (GetMaxEntities() * 2);
int found = 0;
int[] foundEntities = new int[max];
for (int i = 0; i < max; i++) {
if (!IsValidEntity(i)) continue;
char name[128];
GetEntPropString(i, Prop_Data, "m_iName", name, sizeof(name));
if (StrEqual(name, targetName)) foundEntities[found++] = i;
}
for (int i = 0; i < found; i++) {
int entity = foundEntities[i];
char[] fullInput = "";
// Format(fullInput, 1024, "%s !self:%s:%s:%s:%s", input, input, value, delay, maxTimes);
Format(fullInput, 1024, "OnUser1 !self:%s:%s:%s:%s", input, value, delay, maxTimes);
SetVariantString(fullInput);
// AcceptEntityInput(entity, input);
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "FireUser1");
}
}