AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved Cannot fire input (https://forums.alliedmods.net/showthread.php?t=327045)

blacktr4sh 08-29-2020 20:44

Cannot fire input
 
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");
    }
}



All times are GMT -4. The time now is 01:55.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.