Raised This Month: $51 Target: $400
 12% 

Solved HookConVarChange and FindConVar


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rogeraabbccdd
Veteran Member
Join Date: Jun 2015
Location: de_dust2
Old 10-23-2017 , 01:15   HookConVarChange and FindConVar
Reply With Quote #1

Which is better?
I always use 1 in my plugins.

1.
Spoiler

and

2.
Spoiler
__________________

Please keep in mind, nobody have responsibility to help you, especially who don't try to Google first.
I only read messages in Chinese and English.

GitHub | Discord:Kento#2118

Last edited by rogeraabbccdd; 10-23-2017 at 01:58.
rogeraabbccdd is offline
Timocop
AlliedModders Donor
Join Date: Mar 2013
Location: Germany
Old 10-23-2017 , 01:19   Re: HookConVarChange and FindConVar
Reply With Quote #2

2.
Timocop is offline
ESK0
BANNED
Join Date: May 2014
Location: Czech Republic
Old 10-23-2017 , 01:50   Re: HookConVarChange and FindConVar
Reply With Quote #3

Please do not public your plugins 2
ESK0 is offline
rogeraabbccdd
Veteran Member
Join Date: Jun 2015
Location: de_dust2
Old 10-23-2017 , 01:54   Re: HookConVarChange and FindConVar
Reply With Quote #4

LOL, I think it's time to rewrite all my shit.
Thank you guys.
__________________

Please keep in mind, nobody have responsibility to help you, especially who don't try to Google first.
I only read messages in Chinese and English.

GitHub | Discord:Kento#2118
rogeraabbccdd is offline
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 10-23-2017 , 02:23   Re: HookConVarChange and FindConVar
Reply With Quote #5

I doubt it makes that much of a difference, but if you're calling it really often second *might* be better. Also you should use new syntax by doing cvar.BoolValue instead of GetConVarBool(cvar)
hmmmmm is offline
rogeraabbccdd
Veteran Member
Join Date: Jun 2015
Location: de_dust2
Old 10-23-2017 , 03:22   Re: HookConVarChange and FindConVar
Reply With Quote #6

Quote:
Originally Posted by hmmmmm View Post
I doubt it makes that much of a difference, but if you're calling it really often second *might* be better. Also you should use new syntax by doing cvar.BoolValue instead of GetConVarBool(cvar)
You're right.
I know I can use cvar.BoolValue, these are just quick samples to show my question.
__________________

Please keep in mind, nobody have responsibility to help you, especially who don't try to Google first.
I only read messages in Chinese and English.

GitHub | Discord:Kento#2118
rogeraabbccdd is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-23-2017 , 03:39   Re: HookConVarChange and FindConVar
Reply With Quote #7

It depends on what you're doing. But yeah, if you want to do something as soon as a cvar changes, use 2.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 10-23-2017 , 07:46   Re: HookConVarChange and FindConVar
Reply With Quote #8

2.

I always do it when I want to do it optimized as you should already have saw it here.

Also I saw that you use entity index on timers instead of ref. That is unsafe since the index are constantly changing so you should get entity ref for timers instead of directly the index, like here.
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.


Last edited by Franc1sco; 10-23-2017 at 07:52.
Franc1sco is offline
Send a message via MSN to Franc1sco
rogeraabbccdd
Veteran Member
Join Date: Jun 2015
Location: de_dust2
Old 10-23-2017 , 12:17   Re: HookConVarChange and FindConVar
Reply With Quote #9

Wiki needs an update to help more people.
https://wiki.alliedmods.net/Optimizi...Mod_Scripting)
__________________

Please keep in mind, nobody have responsibility to help you, especially who don't try to Google first.
I only read messages in Chinese and English.

GitHub | Discord:Kento#2118

Last edited by rogeraabbccdd; 10-23-2017 at 21:56.
rogeraabbccdd is offline
Reply



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 19:12.


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