core/smn_console.cpp
changeset 1544 feff70182207
parent 1542 a7fb7373989a
child 1547 78abc407c8a3
     1.1 --- a/core/smn_console.cpp	Sun Oct 14 01:09:40 2007 +0000
     1.2 +++ b/core/smn_console.cpp	Sun Oct 14 02:30:16 2007 +0000
     1.3 @@ -623,28 +623,50 @@
     1.4  	return 1;
     1.5  }
     1.6  
     1.7 -BUILD INTENTIONALLY BROKEN BY BAIL
     1.8 -HAHA
     1.9 -I DOUBT YOU CAN COMPILE THIS, GCC
    1.10 +LOL BUILD IS STILL BROKEN
    1.11 +LOL
    1.12 +Seriously.  Don't compile it.
    1.13  
    1.14  static cell_t sm_GetCmdArgs(IPluginContext *pContext, const cell_t *params)
    1.15  {
    1.16 -	return 4; //:O;//engine->Cmd_Argc() - 1;
    1.17 +	const CCommand *pCmd = g_HL2.PeekCommandStack();
    1.18 +
    1.19 +	if (!pCmd)
    1.20 +	{
    1.21 +		return pContext->ThrowNativeError("No command callback available");
    1.22 +	}
    1.23 +
    1.24 +	return pCmd->ArgC() - 1;
    1.25  }
    1.26  
    1.27  static cell_t sm_GetCmdArg(IPluginContext *pContext, const cell_t *params)
    1.28  {
    1.29 -	//const char *arg = //engine->Cmd_Argv(params[1]);
    1.30 +	const CCommand *pCmd = g_HL2.PeekCommandStack();
    1.31 +
    1.32 +	if (!pCmd)
    1.33 +	{
    1.34 +		return pContext->ThrowNativeError("No command callback available");
    1.35 +	}
    1.36 +
    1.37  	size_t length;
    1.38 +
    1.39 +	const char *arg = pCmd->Arg(params[1]);
    1.40  	
    1.41 -	//pContext->StringToLocalUTF8(params[2], params[3], arg, &length);
    1.42 +	pContext->StringToLocalUTF8(params[2], params[3], arg ? arg : "", &length);
    1.43  
    1.44  	return (cell_t)length;
    1.45  }
    1.46  
    1.47  static cell_t sm_GetCmdArgString(IPluginContext *pContext, const cell_t *params)
    1.48  {
    1.49 -	const char *args = NULL;//engine->Cmd_Args();
    1.50 +	const CCommand *pCmd = g_HL2.PeekCommandStack();
    1.51 +
    1.52 +	if (!pCmd)
    1.53 +	{
    1.54 +		return pContext->ThrowNativeError("No command callback available");
    1.55 +	}
    1.56 +
    1.57 +	const char *args = pCmd->ArgS();
    1.58  	size_t length;
    1.59  
    1.60  	if (!args)