sourcemod icon indicating copy to clipboard operation
sourcemod copied to clipboard

GetConVarInt() and ConVar.IntValue

Open Russian85 opened this issue 9 years ago • 4 comments

GetConVarInt() and ConVar.IntValue return wrong number. When number is odd that functions fix it to even number.

Example:

27607405 = 27607404 27607407 = 27607408

Russian85 avatar Aug 06 '17 13:08 Russian85

On what game? Many supported games set the int value from the float value (which loses precision with high numbers like that).

psychonic avatar Aug 06 '17 13:08 psychonic

On what game? Many supported games set the int value from the float value (which loses precision with high numbers like that).

CS:GO

Russian85 avatar Aug 06 '17 13:08 Russian85

Sorry, one more follow-up question...

How is the ConVar value being set in this case?

  • Via config or direct in game console?
  • Via SM in code? If so, SetConVarString? SetConVarFloat? SetConVarInt?
  • Some other way?

psychonic avatar Aug 06 '17 13:08 psychonic

How is the ConVar value being set in this case?

ConVar CVAR;
(CVAR = CreateConVar("swgm_groupid",		"XXXXXXXX",	"Steam group ID.")).AddChangeHook(OnGroupChange);
g_iGroupId = CVAR.IntValue;

Russian85 avatar Aug 06 '17 14:08 Russian85