|
Member
|
02-04-2009
, 20:07
Re: [L4D] HideHUDOnVomit (Blind Luck)
|
#22
|
Quote:
Originally Posted by voiderest
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.
|
Adding that after ServerCommand() should fix the problem.
|
|
|
|