Raised This Month: $32 Target: $400
 8% 

Solved Question: What is a ConVar.FloatValue's expected value?


Post New Thread Reply   
 
Thread Tools Display Modes
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 12-24-2017 , 00:51   Re: Question: What is a ConVar.FloatValue's expected value?
Reply With Quote #11

I use the "SpecialWarn" message to let me know if it's working.

PHP Code:
if(iCompanionCount && iBotCount iPlayerCount 1)
{
    
flPlayerAloneStartTime[iPlayerIndex] = GetEngineTime();
    
bMsg[iPlayerIndex] = true;
}

else
{
    if(
bMsg[iPlayerIndex] && bIsValidClient(iPlayerIndex))
        
PrintHintText(iPlayerIndex"[ASS] %t""SpecialWarn");
    
bMsg[iPlayerIndex] = false;

When I use CreateTimer(cvPunishDetectionDelay.FloatValue, the message doesn't pop up when I pass the distance limit. When I use CreateTimer(0.1 the message appears.

This is all the relevant code for the ConVar:
PHP Code:
ConVar cvPunishDetectionDelay;

public 
void OnPluginStart()
{
     
cvPunishDetectionDelay CreateConVar("asspunish_detectiondelay""0.1""The Punishment system will check for Speedrunners every time this many seconds pass.\n(0 or X < 1: OFF)\n(X: ON, seconds allowed.)"
}

public 
void OnMapStart()
{
     if(
cvPunishDetectionDelay.IntValue != 0)
          
hPunishTimer CreateTimer(cvPunishDetectionDelay.FloatValueaAutoTimerUpdatePlayer_TIMER_REPEAT);

__________________

Last edited by Psyk0tik; 12-24-2017 at 00:52.
Psyk0tik is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 12-24-2017 , 01:48   Re: Question: What is a ConVar.FloatValue's expected value?
Reply With Quote #12

Quote:
Originally Posted by Crasher_3637 View Post
I use the "SpecialWarn" message to let me know if it's working.

PHP Code:
if(iCompanionCount && iBotCount iPlayerCount 1)
{
    
flPlayerAloneStartTime[iPlayerIndex] = GetEngineTime();
    
bMsg[iPlayerIndex] = true;
}

else
{
    if(
bMsg[iPlayerIndex] && bIsValidClient(iPlayerIndex))
        
PrintHintText(iPlayerIndex"[ASS] %t""SpecialWarn");
    
bMsg[iPlayerIndex] = false;

When I use CreateTimer(cvPunishDetectionDelay.FloatValue, the message doesn't pop up when I pass the distance limit. When I use CreateTimer(0.1 the message appears.

This is all the relevant code for the ConVar:
PHP Code:
ConVar cvPunishDetectionDelay;

public 
void OnPluginStart()
{
     
cvPunishDetectionDelay CreateConVar("asspunish_detectiondelay""0.1""The Punishment system will check for Speedrunners every time this many seconds pass.\n(0 or X < 1: OFF)\n(X: ON, seconds allowed.)"
}

public 
void OnMapStart()
{
     if(
cvPunishDetectionDelay.IntValue != 0)
          
hPunishTimer CreateTimer(cvPunishDetectionDelay.FloatValueaAutoTimerUpdatePlayer_TIMER_REPEAT);

if(cvPunishDetectionDelay.IntValue != 0) <-- maybe this is where it's wrong LOL

try

if(cvPunishDetectionDelay.FloatValue != 0.0

maybe IntValue automatically round down to 0
__________________
8guawong is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 12-24-2017 , 03:00   Re: Question: What is a ConVar.FloatValue's expected value?
Reply With Quote #13

Quote:
Originally Posted by 8guawong View Post
if(cvPunishDetectionDelay.IntValue != 0) <-- maybe this is where it's wrong LOL

try

if(cvPunishDetectionDelay.FloatValue != 0.0

maybe IntValue automatically round down to 0
I started thinking that too when I posted the code here. I'll try this out. XD
__________________
Psyk0tik is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 12-24-2017 , 07:03   Re: Question: What is a ConVar.FloatValue's expected value?
Reply With Quote #14

Quote:
Originally Posted by 8guawong View Post
if(cvPunishDetectionDelay.IntValue != 0) <-- maybe this is where it's wrong LOL

try

if(cvPunishDetectionDelay.FloatValue != 0.0

maybe IntValue automatically round down to 0
Nope, that didn't fix it. Anything less than 1 still rounds off to 0. I guess that answers my question about .FloatValues.
__________________
Psyk0tik is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 12-24-2017 , 10:54   Re: Question: What is a ConVar.FloatValue's expected value?
Reply With Quote #15

This is weird... (O_o)?

cvPunishDetectionDelay = CreateConVar("asspunish_detectiondelay", "0.1", "The Punishment system will check for Speedrunners every time this many seconds pass.\n(0 or X < 1: OFF)\n(X: ON, seconds allowed.)";

Last edited by cravenge; 12-24-2017 at 21:30. Reason: I saw the problem...
cravenge is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 12-24-2017 , 12:28   Re: Question: What is a ConVar.FloatValue's expected value?
Reply With Quote #16

Quote:
Originally Posted by Crasher_3637 View Post
Nope, that didn't fix it. Anything less than 1 still rounds off to 0. I guess that answers my question about .FloatValues.
no you are probably doing something wrong

i was just looking through one of my old plugins and i was creating 0.0 timer and the timer was working

also check the following code

PHP Code:
ConVar testconvar;
public 
void OnPluginStart()
{
    
testconvar CreateConVar("sm_test_convar""0.1");
    
    
LogMessage("sm_test_convar: %f"testconvar.FloatValue);

Code:
sm_test_convar: 0.100000
__________________
8guawong is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 12-24-2017 , 23:18   Re: Question: What is a ConVar.FloatValue's expected value?
Reply With Quote #17

Quote:
Originally Posted by 8guawong View Post
no you are probably doing something wrong

i was just looking through one of my old plugins and i was creating 0.0 timer and the timer was working

also check the following code

PHP Code:
ConVar testconvar;
public 
void OnPluginStart()
{
    
testconvar CreateConVar("sm_test_convar""0.1");
    
    
LogMessage("sm_test_convar: %f"testconvar.FloatValue);

Code:
sm_test_convar: 0.100000
I used TriggerTimer(hPunishTimer, true); as cravenge suggested and it worked.

Quote:
Originally Posted by cravenge View Post
This is weird... (O_o)?

cvPunishDetectionDelay = CreateConVar("asspunish_detectiondelay", "0.1", "The Punishment system will check for Speedrunners every time this many seconds pass.\n(0 or X < 1: OFF)\n(X: ON, seconds allowed.)";
That's just part of the description for the cvar, it doesn't affect how the timer works. I only put that in at the time because I didn't know about the void TriggerTimer(Handle timer, bool reset) function. xD Thanks btw!
__________________
Psyk0tik is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 12-24-2017 , 23:20   Re: Question: What is a ConVar.FloatValue's expected value?
Reply With Quote #18

Here's the final solution:

PHP Code:
if(cvPunishDetectionDelay.IntValue != 0.0)
{
    
hPunishTimer CreateTimer(cvPunishDetectionDelay.FloatValuetAutoTimerUpdatePlayer_TIMER_REPEAT);
    
TriggerTimer(hPunishTimertrue);

__________________

Last edited by Psyk0tik; 12-25-2017 at 04:38.
Psyk0tik is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 12-25-2017 , 01:24   Re: Question: What is a ConVar.FloatValue's expected value?
Reply With Quote #19

glad it worked out for your
also glad i learned something new
didn't even know about TriggerTimer
__________________

Last edited by 8guawong; 12-25-2017 at 01:25.
8guawong is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:37.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode