View Single Post
high6
Member
Join Date: Feb 2009
Old 02-04-2009 , 20:07   Re: [L4D] HideHUDOnVomit (Blind Luck)
Reply With Quote #22

Quote:
Originally Posted by voiderest View Post
I've been working on a way to run any command/cvar without cheats and for commands removing the flags then putting them back real fast didn't always work.

The solution that I'm going with is to do it kinda fast using a timer.

Code:
public Action:RandomFunction34(thecmd, args)
{
    //code maybe

    SetCommandFlags(thecmd,flags^FCVAR_CHEAT);
    ServerCommand("%s%s",thecmd,args); //I think you use a different one
    new Handle:data;
    CreateDataTimer(0.5, resetcmd, data); //make longer or shorter as you see fit
    WritePackString(data, thecmd);
    WritePackCell(data, flags);

    //code maybe
}

//voiderest wrote the resetcmd function
public Action:resetcmd(Handle:timer, Handle:data)
{
    new String:buf[32];
    ReadPackString(data, buf, 32);
    SetCommandFlags(buf, ReadPackCell(data));
}
Anyone should feel free to use and abuse that code, but leaving the little comment in the code would be nice.
Code:
ServerExecute();
Adding that after ServerCommand() should fix the problem.
high6 is offline