View Single Post
midnight9
Senior Member
Join Date: Nov 2012
Old 06-03-2018 , 06:36   Re: [L4D2] HUD Server Logo
Reply With Quote #5

Hello, im trying execute this script but it doesnt work. The hud does work when i put it in the versus.nut, just doesnt work when i put it in myscript.nut and then try to execute it via command.

The script:

Code:
ModeHUD <-
{
    Fields =
    {
            myname = { slot = g_ModeScript.HUD_FAR_RIGHT, dataval = "My Text", flags = g_ModeScript.HUD_FLAG_ALIGN_CENTER | g_ModeScript.HUD_FLAG_NOBG, name = "myname" }
    }
}
HUDSetLayout(ModeHUD)
g_ModeScript
Code:
RegAdminCmd("sm_runvscript", Command_RunVscript, ADMFLAG_ROOT);


public Action Command_RunVscript(int client, int args)
{
    if(args < 1)
    {
        return Plugin_Handled;
    }

    char vscriptFile[40];
    GetCmdArg(1, vscriptFile, sizeof(vscriptFile));

    int entity = CreateEntityByName("logic_script");
    if( entity != -1 )
    {
        DispatchKeyValue(entity, "vscripts", vscriptFile);
        DispatchSpawn(entity);
        SetVariantString("OnUser1 !self:RunScriptCode::0:-1");
        AcceptEntityInput(entity, "AddOutput");
        SetVariantString("OnUser1 !self:Kill::1:-1");
        AcceptEntityInput(entity, "AddOutput");
        AcceptEntityInput(entity, "FireUser1");
    }
    return Plugin_Handled;
}
I've tried script_execute myscript.nut as well.

Any ideas?
midnight9 is offline