Guest User

Untitled

a guest
Apr 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1.         public static int GetCVarInt(string name)
  2.         {
  3.             if(HasCVar(name))
  4.             {
  5.                 var cvar = cVars.First(tempvar => tempvar.Name == name);
  6.                 var internalValue = cvar.internalValue;
  7.  
  8.                 if(cvar.Type == CVarType.Int)
  9.                     return (int) internalValue;
  10.                 else if(IgnoreInvalidCVarCasts)
  11.                     return -1;
  12.                 else
  13.                     throw new CVarException(string.Format(TYPE_ERROR(CVarType.Int), cvar.Name, internalValue));
  14.             }
  15.             else if(IgnoreNonExistentCVars)
  16.                 return -1;
  17.             else
  18.                 throw new CVarException(string.Format(NONEXISTENT_GET, name));
  19.         }
Add Comment
Please, Sign In to add comment